private void HorarioDoDia() { ClnAgendaDeHorario agenda = new ClnAgendaDeHorario(); if (dateTimePicker1.Value.DayOfWeek.ToString() == "Segunda" || dateTimePicker1.Value.DayOfWeek.ToString() == "Monday") { PreencherComboHorario(agenda.BuscarporDiaSegunda()); } else if (dateTimePicker1.Value.DayOfWeek.ToString() == "Terca" || dateTimePicker1.Value.DayOfWeek.ToString() == "Tuesday") { PreencherComboHorario(agenda.BuscarporDiaTerca()); } else if (dateTimePicker1.Value.DayOfWeek.ToString() == "Quarta" || dateTimePicker1.Value.DayOfWeek.ToString() == "Wednesday") { PreencherComboHorario(agenda.BuscarporDiaQuarta()); } else if (dateTimePicker1.Value.DayOfWeek.ToString() == "Quinta" || dateTimePicker1.Value.DayOfWeek.ToString() == "Thursday") { PreencherComboHorario(agenda.BuscarporDiaQuinta()); } else if (dateTimePicker1.Value.DayOfWeek.ToString() == "Sexta" || dateTimePicker1.Value.DayOfWeek.ToString() == "Friday") { PreencherComboHorario(agenda.BuscarporDiaSexta()); } else if (dateTimePicker1.Value.DayOfWeek.ToString() == "Sabado" || dateTimePicker1.Value.DayOfWeek.ToString() == "Saturday") { PreencherComboHorario(agenda.BuscarporDiaSabado()); } else if (dateTimePicker1.Value.DayOfWeek.ToString() == "Domingo" || dateTimePicker1.Value.DayOfWeek.ToString() == "Sunday") { PreencherComboHorario(agenda.BuscarporDiaDomingo()); } }
public void PreencherComboHorario(DataSet pesquisa) { ClnAgendaDeHorario tipo = new ClnAgendaDeHorario(); DataSet ds = pesquisa; comboBoxHorario.DataSource = ds.Tables[0]; comboBoxHorario.DisplayMember = "Horarioinicial"; comboBoxHorario.ValueMember = "Horarioinicial"; }
//atualiza o grid private void AtualizarGrid() { DataSet ds = new DataSet(); ClnAgendaDeHorario agenda = new ClnAgendaDeHorario(); agenda.Servico = textBoxPesquisar.Text; ds = agenda.BuscarporNome(); dgv1.DataSource = ds.Tables[0]; }
//função que é chamada para excluir algum horario private void botaoExcluir_Click(object sender, EventArgs e) { string mensagem = "Deseja excluir o cadastro," + comboBoxFuncionario.Text + " ?"; int resposta = Convert.ToInt16(MessageBox.Show(mensagem, "Excluir cadastro", MessageBoxButtons.YesNo, MessageBoxIcon.Question)); if (resposta == 6) { ClnAgendaDeHorario agenda = new ClnAgendaDeHorario(); agenda.Excluir(comboBoxFuncionario.Text); } LimparTxt(groupBox1); AtualizarGrid(); }
//função do grid private void dgv1_CellContentClick(object sender, DataGridViewCellEventArgs e) { dgv1.CurrentRow.Selected = true; ClnAgendaDeHorario agenda = new ClnAgendaDeHorario(); if (dgv1.RowCount > 0) { comboBoxFuncionario.Text = dgv1.CurrentRow.Cells[0].Value.ToString(); comboBoxServico.Text = dgv1.CurrentRow.Cells[1].Value.ToString(); comboBoxDia.Text = dgv1.CurrentRow.Cells[2].Value.ToString(); dateTimePicker1.Text = dgv1.CurrentRow.Cells[3].Value.ToString(); dateTimePicker2.Text = dgv1.CurrentRow.Cells[4].Value.ToString(); } }
private void botaoEditar_Click(object sender, EventArgs e) { ClnAgendaDeHorario agenda = new ClnAgendaDeHorario(); agenda.Servico = comboBoxServico.Text; agenda.NomeFuncionario = comboBoxFuncionario.Text; agenda.Horario = dateTimePicker1.Value.ToShortTimeString(); agenda.Horariofinal = dateTimePicker2.Value.ToShortTimeString(); agenda.Dia = comboBoxDia.Text; ClnFuncionario func = new ClnFuncionario(); agenda.Cd_funcionario = func.BuscarId(comboBoxFuncionario.Text); agenda.Atualizar(); AtualizarGrid(); LimparTxt(groupBox1); }
//funçao que cadastra o agendamento private void botaoConfirmar_Click(object sender, EventArgs e) { ClnAgendaDeHorario agenda = new ClnAgendaDeHorario(); agenda.Servico = comboBoxServico.Text; agenda.NomeFuncionario = comboBoxFuncionario.Text; agenda.Horario = dateTimePicker1.Value.ToShortTimeString(); agenda.Horariofinal = dateTimePicker2.Value.ToShortTimeString(); agenda.Dia = comboBoxDia.Text; if (verificaText(groupBox1)) { agenda.Gravar(); AtualizarGrid(); LimparTxt(groupBox1); } }
//função do grid private void dgv1_CellContentClick(object sender, DataGridViewCellEventArgs e) { dgv1.CurrentRow.Selected = true; ClnAgendaDeHorario agenda = new ClnAgendaDeHorario(); if (dgv1.RowCount > 0) { comboBoxFuncionario.Text = dgv1.CurrentRow.Cells[1].Value.ToString(); comboBoxCliente.Text = dgv1.CurrentRow.Cells[2].Value.ToString(); comboBoxServico.Text = dgv1.CurrentRow.Cells[3].Value.ToString(); dateTimePicker1.Value = Convert.ToDateTime(dgv1.CurrentRow.Cells[4].Value.ToString()); dateTimePicker3.Value = DateTime.ParseExact(dgv1.CurrentRow.Cells[5].Value.ToString(), "HH:mm", System.Globalization.CultureInfo.CurrentCulture, System.Globalization.DateTimeStyles.None); //comboBoxStatus.Text = dgv1.CurrentRow.Cells[6].Value.ToString(); textBoxValor.Text = dgv1.CurrentRow.Cells[7].Value.ToString(); } }