Ejemplo n.º 1
0
 private void pbxBuscar_Click(object sender, EventArgs e)
 {
     dgvPacientes.ClearSelection();
     try
     {
         Turno_Service turnos = new Turno_Service();
         if (cbxDescripcion.SelectedIndex < 0)
         {
             MessageBox.Show("Debe seleccionar un campo para poder buscar");
             return;
         }
         if (mtxtDNI.Text == "  ,   ," && mtxtDNI.Enabled == true)
         {
             MessageBox.Show("Complete el campo con el numero de DNI ");
             return;
         }
         dgvPacientes.DataSource         = turnos.Buscar_turnoPor(cbxDescripcion.SelectedItem.ToString(), txtBusqueda.Text.Trim(), mtxtDNI.Text.Trim());
         dgvPacientes.Columns[0].Visible = false;
         dgvPacientes.Columns[1].Visible = false;
         dgvPacientes.Columns[4].Visible = false;
         dgvPacientes.Columns[5].Visible = false;
         dgvPacientes.Columns[6].Visible = false;
         dgvPacientes.Columns[7].Visible = false;
         dgvPacientes.Columns[8].Visible = false;
         if (dgvPacientes.RowCount == 0)
         {
             MessageBox.Show("No hay datos disponible");
             return;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Ejemplo n.º 2
0
        private void mcAgenda_DateSelected(object sender, DateRangeEventArgs e)
        {
            Horario               Hora        = new Horario();
            Turno_Service         Turno_S     = new Turno_Service();
            DateTime              prueba      = new DateTime(mcAgenda.SelectionRange.Start.Year, mcAgenda.SelectionRange.Start.Month, mcAgenda.SelectionRange.Start.Day);
            List <Turno_Paciente> ListaTurnos = new List <Turno_Paciente>(Turno_S.BuscarTurnos(Medico.ID_Empleado1, mcAgenda.SelectionRange.Start.Day, mcAgenda.SelectionRange.Start.Month, mcAgenda.SelectionRange.Start.Year));
            string Dia;

            //Verifica que no se seleccione una fecha mayor o igual
            if (mcAgenda.SelectionRange.Start.Date >= mcAgenda.TodayDate)
            {
                Dia = prueba.DayOfWeek.ToString();
                switch (Dia)
                {
                case "Monday":
                    Dia = "Lunes";
                    break;

                case "Tuesday":
                    Dia = "Martes";
                    break;

                case "Wednesday":
                    Dia = "Miercoles";
                    break;

                case "Thursday":
                    Dia = "Jueves";
                    break;

                case "Friday":
                    Dia = "Viernes";
                    break;

                case "Saturday":
                    Dia = "Sabado";
                    break;

                case "Sunday":
                    Dia = "Domingo";
                    break;
                }
                CargarDias(Dia);
                if (VerificarDias(Dia) == false)
                {
                    MessageBox.Show("No hay Turnos disponible el " + Dia);
                    PNHorarios.Visible = false;
                }
                else
                {
                    PNHorarios.Visible    = true;
                    btnOcho.Text          = "Libre";
                    btnOcho.Enabled       = true;
                    btnNueve.Text         = "Libre";
                    btnNueve.Enabled      = true;
                    btnDiez.Text          = "Libre";
                    btnDiez.Enabled       = true;
                    btnonce.Text          = "Libre";
                    btnonce.Enabled       = true;
                    btnDoce.Text          = "Libre";
                    btnDoce.Enabled       = true;
                    btntrece.Text         = "Libre";
                    btntrece.Enabled      = true;
                    btncatorce.Text       = "Libre";
                    btncatorce.Enabled    = true;
                    btnQuince.Text        = "Libre";
                    btnQuince.Enabled     = true;
                    btnDieciseis.Text     = "Libre";
                    btnDieciseis.Enabled  = true;
                    btnDiecisiete.Text    = "Libre";
                    btnDiecisiete.Enabled = true;
                    for (int i = 0; i < ListaTurnos.Count; i++)
                    {
                        if (ListaTurnos[i].Hora1.Hours == 8)
                        {
                            btnOcho.Text    = "Ocupado";
                            btnOcho.Enabled = false;
                        }
                        if (ListaTurnos[i].Hora1.Hours == 9)
                        {
                            btnNueve.Text    = "Ocupado";
                            btnNueve.Enabled = false;
                        }
                        if (ListaTurnos[i].Hora1.Hours == 10)
                        {
                            btnDiez.Text    = "Ocupado";
                            btnDiez.Enabled = false;
                        }
                        if (ListaTurnos[i].Hora1.Hours == 11)
                        {
                            btnonce.Text    = "Ocupado";
                            btnonce.Enabled = false;
                        }
                        if (ListaTurnos[i].Hora1.Hours == 12)
                        {
                            btnDoce.Text    = "Ocupado";
                            btnDoce.Enabled = false;
                        }
                        if (ListaTurnos[i].Hora1.Hours == 13)
                        {
                            btntrece.Text    = "Ocupado";
                            btntrece.Enabled = false;
                        }
                        if (ListaTurnos[i].Hora1.Hours == 14)
                        {
                            btncatorce.Text    = "Ocupado";
                            btncatorce.Enabled = false;
                        }
                        if (ListaTurnos[i].Hora1.Hours == 15)
                        {
                            btnQuince.Text    = "Ocupado";
                            btnQuince.Enabled = false;
                        }
                        if (ListaTurnos[i].Hora1.Hours == 16)
                        {
                            btnDieciseis.Text    = "Ocupado";
                            btnDieciseis.Enabled = false;
                        }
                        if (ListaTurnos[i].Hora1.Hours == 17)
                        {
                            btnDiecisiete.Text    = "Ocupado";
                            btnDiecisiete.Enabled = false;
                        }
                    }
                    if (btnOcho.Text == "Ocupado" && btnNueve.Text == "Ocupado" && btnDiez.Text == "Ocupado" && btnonce.Text == "Ocupado" && btnDoce.Text == "Ocupado" && btntrece.Text == "Ocupado" && btncatorce.Text == "Ocupado" && btnQuince.Text == "Ocupado" && btnDieciseis.Text == "Ocupado" && btnDiecisiete.Text == "Ocupado")
                    {
                        MessageBox.Show("No hay Turnos disponible");
                        PNHorarios.Visible = false;
                    }
                }
            }
            else
            {
                MessageBox.Show("La fecha no es Valida");
            }
        }