Exemplo n.º 1
0
        private void consultoriosToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ConsultorioDao consultorio = new ConsultorioDao();

            indicacionLabel.Text     = "Consultorio";
            datosTablaDGV.DataSource = consultorio.VerRegistros("consultorio order by horario");
        }
Exemplo n.º 2
0
        private void realizarCitaButton_Click_1(object sender, EventArgs e)
        {
            CitaDao        cita   = new CitaDao();
            ConsultorioDao insert = new ConsultorioDao();

            /*Así inserte todos los registos de las tablas por un total de 700 días desde el 21 de mayo
             * DateTime fecha = diaDTP.Value.Date;
             * for ( int i = 0 ; i < 700 ; i++ ) {
             *  for ( int j = 0 ; j < horaCB.Items.Count ; j++ ) {
             *      horaCB.SelectedIndex = j;
             *      TimeSpan hora = TimeSpan.Parse(horaCB.Text);
             *      DateTime fechaCompleta = fecha.Add(hora);
             *      insert.Insert(fechaCompleta, false , false , false , false , false , false , false);
             *      }
             *      fecha = fecha.AddDays(1);
             *  }*/
            if (consultorioCB.SelectedIndex == -1)
            {
                MessageBox.Show("Seleccione un consultorio");
            }
            else
            {
                if (horaCB.SelectedIndex == -1)
                {
                    MessageBox.Show("Seleccione una hora");
                }
                else
                {
                    if (diaDTP.Value < DateTime.Now.AddDays(-1))
                    {
                        MessageBox.Show("Seleccione una fecha valida");
                    }
                    else
                    {
                        DateTime fecha         = diaDTP.Value.Date;
                        TimeSpan hora          = TimeSpan.Parse(horaCB.Text);
                        DateTime fechaCompleta = fecha.Add(hora);
                        switch (cita.Insert(fechaCompleta, cedulaTB.Text, Convert.ToInt32(nssTB.Text), consultorioCB.Text))
                        {
                        case 0:
                            MessageBox.Show("Cita realizada correctamente\nNumero de cita: " + CacheData.cita);
                            break;

                        case 1:
                            MessageBox.Show("Cedula de doctor no existente");
                            break;

                        case 2:
                            MessageBox.Show("Nss no reconocido");
                            break;

                        case 3:
                            MessageBox.Show("Fecha no disponible");
                            break;

                        case 4:
                            MessageBox.Show("El medico tiene cita a ese horario");
                            break;

                        case 5:
                            MessageBox.Show("Ya cuentas con cita a ese horario");
                            break;
                        }
                    }
                }
            }
        }