Ejemplo n.º 1
0
 private void btnAgendar_Click(object sender, EventArgs e)
 {
     if (txtPesClien.Text == "" || comboBox2.Text == "" || comboBox1.Text == "" || comboBox4.Text == "" || cboStatus.Text == "" || dateTimePicker1.Text == "")
     {
         MessageBox.Show("TODOS OS CAMPOS SÃO OBRIGATÓRIOS ", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         clnAgenda     ObjAgenda = new clnAgenda();
         SqlDataReader idServico;
         idServico = ObjAgenda.LocalizarServico(comboBox2.Text);
         idServico.Read();
         ObjAgenda.Procedimento = idServico["id_servico"].ToString();
         idServico.Read();
         ObjAgenda.Nome = Temp2;
         idServico.Read();
         idServico = ObjAgenda.LocalizarEspecialista(comboBox1.Text);
         idServico.Read();
         string id_especialista = idServico["id_funcionario"].ToString();
         ObjAgenda.Especialista = id_especialista;
         ObjAgenda.Hora         = comboBox4.Text.Replace(":", "");
         string data = dateTimePicker1.Text.Replace("/", "");
         ObjAgenda.Status = cboStatus.Text.ToString();
         ObjAgenda.Data   = data;
         ObjAgenda.GravaNoBanco();
         InsereAgendaGrid();
         MessageBox.Show("AGENDADO COM SUCESSO", "AGENDAMENTO", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     //CarregaDataGrid();
 }