private void cbDayView2_SelectionChanged(object sender, SelectionChangedEventArgs e) { m_Appointments2.Clear(); FuncionarioDTO funcionario = funcionarioBLL.ReadName(cbDayView2.SelectedItem.ToString())[0]; m_Appointments2 = ListarApontamentos(Convert.ToInt32(funcionario.Pessoa.IdPessoa)); AddUpdateAppSettings("Setting2", cbDayView2.SelectedIndex.ToString()); dayView2.Invalidate(); bool result = false; if (Boolean.TryParse(funcionario.Pessoa.PessoaFisica.Genero.ToString(), out result)) { if (Convert.ToBoolean(funcionario.Pessoa.PessoaFisica.Genero)) { dayView2.Renderer = new Office11Renderer(); } else { dayView2.Renderer = new Office12Renderer(); } } else { dayView2.Renderer = new Office12Renderer(); } }
/// <summary> /// Preenche todos os apontamentos solicitados para o banco no dayview /// </summary> private void FillAppointments() { m_Appointments.Clear(); m_Appointments2.Clear(); m_Appointments = ListarApontamentos(Convert.ToInt32(funcionarioBLL.ReadName(cbDayView1.SelectedItem.ToString())[0].Pessoa.IdPessoa)); m_Appointments2 = ListarApontamentos(Convert.ToInt32(funcionarioBLL.ReadName(cbDayView2.SelectedItem.ToString())[0].Pessoa.IdPessoa)); }
private AgendamentoCollectionDTO ListarApontamentos(int agenda) { AgendamentoCollectionDTO listaAgendamento = new AgendamentoCollectionDTO(); listaAgendamento = agendamentoBLL.ReadDateRange(calendarAppointment.SelectedDate.Value, calendarAppointment.SelectedDate.Value.AddDays(7), agenda); foreach (AgendamentoDTO item in listaAgendamento) { item.Servicos = new ServicoCollectionDTO(); item.Servicos = agendamentoServicoBLL.ReadService(item); item.Title = string.Empty; int temp = 1;; if (item.Servicos != null && item.Servicos.Count > 0) { foreach (ServicoDTO servico in item.Servicos) { if (item.Servicos.Count == temp) { item.Title = item.Title + servico.DescricaoServico; } else { item.Title = item.Title + servico.DescricaoServico + ", "; } temp++; } } } return(listaAgendamento); }
/// <summary> /// Consulta todas informações no banco. /// </summary> /// <returns>Retorna uma coleção de objetos com as informações encontradas no banco.</returns> public AgendamentoCollectionDTO ReadDateRange(DateTime startDate, DateTime endDate, int _agenda) { try { dataBaseAccess.AddParameters("_dataInicial", startDate.Date); dataBaseAccess.AddParameters("_dataFinal", endDate.Date); dataBaseAccess.AddParameters("_agenda", _agenda); DataTable dataTable = new DataTable(); dataTable = dataBaseAccess.Consult(CommandType.StoredProcedure, "sp_agendamento_data"); AgendamentoCollectionDTO appointments = new AgendamentoCollectionDTO(); foreach (DataRow row in dataTable.Rows) { AgendamentoDTO appointment = new AgendamentoDTO(); appointment.IdAgendamento = Convert.ToInt32(row["IdAgendamento"]); int temp; if (Int32.TryParse(row["IdPessoaCliente"].ToString(), out temp)) { appointment.Cliente.Pessoa.IdPessoa = temp; } else { appointment.Cliente.Pessoa.IdPessoa = null; } appointment.Cliente.Pessoa.NomePessoa = row["NomePessoa"].ToString(); appointment.StartDate = Convert.ToDateTime(row["DataInicio"].ToString()); appointment.EndDate = Convert.ToDateTime(row["DataFim"].ToString()); appointment.Observacoes = row["Observacoes"].ToString(); appointment.Atendido = Convert.ToInt32(row["IdAtendimento"]); string corFundo = row["CorFundo"].ToString(); string[] coresFundos = corFundo.Split(','); appointment.Color = Color.FromArgb(Convert.ToInt32(coresFundos[0]), Convert.ToInt32(coresFundos[1]), Convert.ToInt32(coresFundos[2]), Convert.ToInt32(coresFundos[3])); string corBorda = row["CorBorda"].ToString(); string[] coresBordas = corBorda.Split(','); appointment.BorderColor = Color.FromArgb(Convert.ToInt32(coresBordas[0]), Convert.ToInt32(coresBordas[1]), Convert.ToInt32(coresBordas[2]), Convert.ToInt32(coresBordas[3])); appointment.Layer = Convert.ToInt32(row["Agenda"]); appointments.Add(appointment); } return(appointments); } catch (Exception ex) { StringBuilder message = new StringBuilder(); message.Append("Não foi possível realizar a consulta de agenamento: ").Append(ex.Message); throw new Exception(message.ToString()); } finally { dataBaseAccess.ClearParameters(); } }
private void dayView2_ResolveAppointments(object sender, ResolveAppointmentsEventArgs args) { AgendamentoCollectionDTO m_Apps = new AgendamentoCollectionDTO(); foreach (AgendamentoDTO m_App in m_Appointments2) { if ((m_App.StartDate >= args.StartDate) && (m_App.StartDate <= args.EndDate)) { m_Apps.Add(m_App); } } args.Appointments = m_Apps; }
public ResolveAppointmentsEventArgs(DateTime start, DateTime end) { m_StartDate = start; m_EndDate = end; m_Appointments = new AgendamentoCollectionDTO(); }