public FrmSearch(DoctorPanel a)
        {
            InitializeComponent();
            searchPanel1.DoctorPanel = a;
            int x = Screen.PrimaryScreen.WorkingArea.Width;

            this.Left = ((x - this.Width) / 2) + 109;
            this.Top  = (a.label1.Location.X) + 90;

            searchPanel1.rdCitas.Visible     = false;
            searchPanel1.rdPacientes.Visible = false;
            searchPanel1.txtType.Text        = "Médicos";
            searchPanel1.rdMedicos.Checked   = true;
            searchPanel1.rdMedicos.Enabled   = false;
        }
        private void tbSearch_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (DoctorPanel != null && rdMedicos.Checked && listaMedicos.Count() > 0)
            {
                Controller.SpecialtyController sc = new Controller.SpecialtyController();
                DoctorPanel._loadItemsEspecialidadEdit(sc.list());
                DoctorPanel.oldDni                           = listaMedicos[tbSearch.CurrentRow.Index].Persona.dni;
                DoctorPanel.selectedPerson                   = listaMedicos[tbSearch.CurrentRow.Index].Persona.id_person;
                DoctorPanel.txteditCedula.Text               = listaMedicos[tbSearch.CurrentRow.Index].Persona.dni;
                DoctorPanel.txteditNombre.Text               = listaMedicos[tbSearch.CurrentRow.Index].Persona.nombre;
                DoctorPanel.txteditApellido.Text             = listaMedicos[tbSearch.CurrentRow.Index].Persona.apellido;
                DoctorPanel.txteditMail.Text                 = listaMedicos[tbSearch.CurrentRow.Index].Persona.email;
                DoctorPanel.txteditDir.Text                  = listaMedicos[tbSearch.CurrentRow.Index].Persona.direccion;
                DoctorPanel.txteditEstCiv.SelectedItem       = listaMedicos[tbSearch.CurrentRow.Index].Persona.ecivil;
                DoctorPanel.txteditTel.Text                  = listaMedicos[tbSearch.CurrentRow.Index].Persona.telefono;
                DoctorPanel.txteditFNacimiento.Text          = listaMedicos[tbSearch.CurrentRow.Index].Persona.fnac.ToString();
                DoctorPanel.txteditEdad.Text                 = listaMedicos[tbSearch.CurrentRow.Index].Persona.edad.ToString();
                DoctorPanel.txteditPeso.Text                 = listaMedicos[tbSearch.CurrentRow.Index].Persona.peso + "";
                DoctorPanel.txteditSangre.Text               = listaMedicos[tbSearch.CurrentRow.Index].Persona.sangre;
                DoctorPanel.txteditAltura.Text               = listaMedicos[tbSearch.CurrentRow.Index].Persona.altura + "";
                DoctorPanel.txteditDiscapacidad.Text         = "Ninguna";
                DoctorPanel.txteditTitulo.Text               = listaMedicos[tbSearch.CurrentRow.Index].titulo;
                DoctorPanel.txteditespecialidad.SelectedItem = sc.getById(listaMedicos[tbSearch.CurrentRow.Index].id_especialidad.Value).nombre;
                if (listaMedicos[tbSearch.CurrentRow.Index].Persona.tipo == 1)
                {
                    DoctorPanel.radioEditDoctor.Checked    = true;
                    DoctorPanel.radioEditEnfermera.Checked = false;
                }
                else if (listaMedicos[tbSearch.CurrentRow.Index].Persona.tipo == 2)
                {
                    DoctorPanel.radioEditEnfermera.Checked = true;
                    DoctorPanel.radioEditDoctor.Checked    = false;
                }
                DoctorPanel.btnCancel.Show();
                DoctorPanel.btnUpdate.Show();
                DoctorPanel.btnDelete.Show();

                this.Parent.Parent.Dispose();
            }
            else if (CitasPanel != null && rdMedicos.Checked)
            {
                if (tbSearch.SelectedRows.Count > 0)
                {
                    Controller.SpecialtyController sc = new Controller.SpecialtyController();
                    Controller.MedicController     mc = new Controller.MedicController();
                    CitasPanel.txtEspecialidadDoc.Items.Clear();
                    CitasPanel.txtNombreDoc.Text = tbSearch.CurrentRow.Cells[1].Value.ToString();
                    CitasPanel.txtEspecialidadDoc.Items.Add(tbSearch.CurrentRow.Cells[2].Value.ToString());
                    CitasPanel.txtEspecialidadDoc.SelectedIndex = 0;
                    CitasPanel.txtCosto.Text = sc.getByName(tbSearch.CurrentRow.Cells[2].Value.ToString()).costo + "";
                    CitasPanel.id_medic      = listaMedicos[tbSearch.CurrentRow.Index].id_medico;
                    sc = null;
                    this.Parent.Parent.Dispose();
                }
            }
            else if (CitasPanel != null && rdCitas.Checked)
            {
                if (tbSearch.SelectedRows.Count > 0)
                {
                    String  ap     = (listaCitas[tbSearch.CurrentRow.Index].Medico.Persona.apellido);
                    decimal valmod = (listaCitas[tbSearch.CurrentRow.Index]).Medico.Especialidad.costo.Value;
                    decimal reten  = (listaCitas[tbSearch.CurrentRow.Index]).retencion.Value;

                    CitasPanel.id_medic   = (listaCitas[tbSearch.CurrentRow.Index]).Medico.id_medico;
                    CitasPanel.id_pacient = (listaCitas[tbSearch.CurrentRow.Index]).Persona.id_person;
                    citasPanel.id_cita    = (listaCitas[tbSearch.CurrentRow.Index]).id_cita;
                    CitasPanel.txteEspecialidad.Items.Clear();
                    CitasPanel.txteNombresDoc.Text = listaCitas[tbSearch.CurrentRow.Index].Medico.Persona.nombre + " " + ap;
                    CitasPanel.txteEspecialidad.Items.Add(listaCitas[tbSearch.CurrentRow.Index].Medico.Especialidad.nombre);
                    CitasPanel.txteEspecialidad.SelectedIndex = 0;
                    CitasPanel.txteNombrePAc.Text             = listaCitas[tbSearch.CurrentRow.Index].Persona.nombre + " " + listaCitas[tbSearch.CurrentRow.Index].Persona.apellido;
                    CitasPanel.txteApellidos.Text             = listaCitas[tbSearch.CurrentRow.Index].Persona.apellido;
                    CitasPanel.txteEdad.Text     = listaCitas[tbSearch.CurrentRow.Index].Persona.edad.ToString();
                    CitasPanel.txteTelefono.Text = listaCitas[tbSearch.CurrentRow.Index].Persona.telefono;
                    CitasPanel.txteCedula.Text   = listaCitas[tbSearch.CurrentRow.Index].Persona.dni;

                    CitasPanel.txteFecha.Text            = listaCitas[tbSearch.CurrentRow.Index].fecha.ToString();
                    CitasPanel.txteCosto.Text            = listaCitas[tbSearch.CurrentRow.Index].precio + "";
                    CitasPanel.txteRetencion.Text        = reten + "";
                    CitasPanel.textPendientePago.Checked = (listaCitas[tbSearch.CurrentRow.Index].status == 0);
                    CitasPanel.btnAnular.Show();
                    CitasPanel.btnCancel.Show();
                    CitasPanel.btnUpdate.Show();
                    this.Parent.Parent.Dispose();
                }
            }

            else if (PacientePanel != null && rdPacientes.Checked)
            {
                if (tbSearch.SelectedRows.Count > 0)
                {
                    String dir   = listaPacientes[tbSearch.CurrentRow.Index].direccion;
                    String email = listaPacientes[tbSearch.CurrentRow.Index].email;
                    PacientePanel.oldDni               = listaPacientes[tbSearch.CurrentRow.Index].dni.ToString();
                    PacientePanel.txtEditCedula.Text   = listaPacientes[tbSearch.CurrentRow.Index].dni.ToString();
                    PacientePanel.txteditNombre.Text   = listaPacientes[tbSearch.CurrentRow.Index].nombre.ToString();
                    PacientePanel.txteditApellido.Text = listaPacientes[tbSearch.CurrentRow.Index].apellido.ToString();
                    PacientePanel.txtEditDir.Text      = dir;
                    PacientePanel.txtEditEdad.Text     = listaPacientes[tbSearch.CurrentRow.Index].edad.ToString();
                    PacientePanel.txteditTel.Text      = listaPacientes[tbSearch.CurrentRow.Index].telefono.ToString();
                    PacientePanel.txtEditEmail.Text    = email;
                    PacientePanel.btnCancel.Show();
                    PacientePanel.btnDelete.Show();
                    PacientePanel.btnUpdate.Show();
                    this.Parent.Parent.Dispose();
                }
            }
            else if (UserPanel != null && !rdCitas.Checked && !rdMedicos.Checked &&
                     !rdPacientes.Checked)
            {
                if (tbSearch.SelectedRows.Count > 0)
                {
                    UserPanel.txtCedula.Text = tbSearch.CurrentRow.Cells[0].Value.ToString();
                    UserPanel.txtSearch.Text = tbSearch.CurrentRow.Cells[1].Value.ToString();
                    UserPanel.txtEmail.Text  = tbSearch.CurrentRow.Cells[2].Value.ToString();
                    this.Parent.Parent.Dispose();
                }
            }
        }