private void btnHoras_Click(object sender, EventArgs e)
        {
            DatosHorasXDias HD = new DatosHorasXDias();
            int             IDM, IDD;

            try
            {
                IDM = (int)dgvPlanillaMedicos.CurrentCell.Value;
                IDD = (int)dgvDias.CurrentCell.Value;
                dgvHoras.DataSource = HD.ListarXHoraXdiaXmed(IDM, IDD);

                dgvHoras.Columns[0].HeaderText = "Hora Inicio";
                dgvHoras.Columns[1].HeaderText = "Hora Fin";

                dgvHoras.Columns[2].Visible = false;
                dgvHoras.Columns[3].Visible = false;
                dgvHoras.Columns[4].Visible = false;
                dgvHoras.Columns[5].Visible = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Beispiel #2
0
        private void btnAlta_Click(object sender, EventArgs e)
        {
            DatosMedicos medicosService = new DatosMedicos();
            Medico       nuevoMedico    = new Medico();

            try
            {
                nuevoMedico.Nombre         = txtNombreMedico.Text;
                nuevoMedico.Apellido       = txtApelidoMedico.Text;
                nuevoMedico.Edad           = int.Parse(txtEdadMedico.Text);
                nuevoMedico.Fnac           = dtpNacimientoMedico.Value;
                nuevoMedico.Nmatricula     = int.Parse(txtMatriculaMedico.Text);
                nuevoMedico.Especialidades = new List <Especialidad>();
                nuevoMedico.OS             = new List <ObraSocial>();
                nuevoMedico.Dia            = new List <Dia>();

                foreach (var item in lstbCargaEspecialidades.Items)
                {
                    nuevoMedico.Especialidades.Add((Especialidad)item);
                }

                foreach (var item in lstbCargaOS.Items)
                {
                    nuevoMedico.OS.Add((ObraSocial)item);
                }

                //ARREGLAR LOS DIAS Y HORARIOS, PORQUE MUESTRA TODOS?
                foreach (var item in lstbxDias.Items)
                {
                    nuevoMedico.Dia.Add((Dia)item);
                }

                medicosService.AltaMedico(ref nuevoMedico);

                DatosHorasXDias DH = new DatosHorasXDias();

                foreach (var item in lstbCargaHorasDias.Items)
                {
                    DH.AltaHorasXDias((TurnoHorario)item, nuevoMedico);
                }

                DatosUsuario DU = new DatosUsuario();
                try
                {
                    DU.AltaUsuario(nuevoMedico);
                    MessageBox.Show("NUEVO USUARIO CARGADO." +
                                    "\n USUARIO:" + nuevoMedico.Apellido.ToString() + ", CONTRASEÑA:" + nuevoMedico.Nmatricula);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }


                Close();

                MessageBox.Show("Profesional Cargado.");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }