示例#1
0
        private void btnAddHorario_Click(object sender, EventArgs e)
        {
            if (curso == null)
            {
                frmMensaje mensaje = new frmMensaje("Seleccione un curso", "Error", ""); if (mensaje.ShowDialog() == DialogResult.OK)
                {
                }
                return;
            }
            frmGestionarHorario formGestionarHorario = new frmGestionarHorario(curso);

            if (formGestionarHorario.ShowDialog() == DialogResult.OK)
            {
                horario = formGestionarHorario.HorarioSeleccionado;
                Service.asistencia a = new Service.asistencia();
                horarios.Add(horario);
                Object[] filaHorario = new Object[7];
                filaHorario[0] = horario.clase;
                filaHorario[1] = horario.horaIni.ToShortTimeString();
                filaHorario[2] = horario.horaFin.ToShortTimeString();
                if (horario.colaborador.idPersona != 0)
                {
                    filaHorario[3] = horario.colaborador.nombre;
                }
                else
                {
                    filaHorario[3] = "-";
                }

                filaHorario[4] = horario.fecha.ToShortDateString();
                filaHorario[5] = horario.sede.direccion;
                filaHorario[6] = horario.numVacantes;
                dgvHorarios.Rows.Add(filaHorario);
            }
        }
        public frmGestionarHorario(Service.horario h)
        {
            InitializeComponent();
            Formateador f = new Formateador();

            f.formGestionarHorario(this, "Gestionar Horario", pnlCtn, btnGuardar, btnModificar, btnCancelar);
            f.formatearBotonLila(btnEliminarDocente);
            cboSede.DataSource    = Program.dbController.listarSedes();
            cboSede.DisplayMember = "direccion";
            dtpHoraIni.MinDate    = DateTime.Parse("1/01/1970 9:00");
            dtpHoraIni.MaxDate    = DateTime.Parse("1/01/1970 21:00");
            dtpHoraFin.MinDate    = DateTime.Parse("1/01/1970 11:00");
            dtpHoraFin.MaxDate    = DateTime.Parse("1/01/1970 23:00");
            txtNumClase.MaxLength = 3;
            txtNumVac.MaxLength   = 3;


            //llena los datos
            cboSede.SelectedItem    = h.sede;
            dtpFechaMatricula.Value = h.fecha;
            dtpHoraIni.Value        = h.horaIni;
            dtpHoraFin.Value        = h.horaFin;
            //cboHoraFin.SelectedItem = (String)h.horaIni.ToShortTimeString();
            //cboHoraIni.SelectedItem = (String)h.horaFin.ToShortTimeString();
            txtNumClase.Text = h.clase.ToString();
            txtNumVac.Text   = h.numVacantes.ToString();

            //docente nulo
            if (h.colaborador.idPersona != 0)
            {
                txtDNIDocente.Text    = h.colaborador.dni;
                txtNombreDocente.Text = h.colaborador.nombre;
            }
        }
示例#3
0
        private void dgvHorarios_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int index = dgvHorarios.CurrentRow.Index;

            horario = horarios[index];
            //Console.WriteLine(horario.idHorario+horario.numVacantes);
            frmGestionarHorario formGestionarHorario = new frmGestionarHorario(horario, curso);

            if (formGestionarHorario.ShowDialog() == DialogResult.OK)
            {
                horarios[index] = formGestionarHorario.HorarioSeleccionado;
                //Console.WriteLine(horarios[index].idHorario+ horarios[index].numVacantes);
                DataGridViewRow row = dgvHorarios.CurrentRow;
                row.Cells[0].Value = horarios[index].clase;
                row.Cells[1].Value = horarios[index].horaIni.ToShortTimeString();
                row.Cells[2].Value = horarios[index].horaFin.ToShortTimeString();
                if (horario.colaborador != null)
                {
                    row.Cells[3].Value = horarios[index].colaborador.nombre;
                }
                else
                {
                    row.Cells[3].Value = '-';
                }
                row.Cells[4].Value = horarios[index].fecha.ToShortDateString();
                row.Cells[5].Value = horarios[index].sede.direccion;
                row.Cells[6].Value = horarios[index].numVacantes;
            }
        }
示例#4
0
        private void dgvHorarios_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            Console.WriteLine(horarios[dgvHorarios.CurrentRow.Index].sede.direccion);
            horario = horarios[dgvHorarios.CurrentRow.Index];
            frmGestionarHorario formGestionarHorario = new frmGestionarHorario(horario);

            if (formGestionarHorario.ShowDialog() == DialogResult.OK)
            {
                Console.WriteLine("entra al gestionar horario con un horario");
            }
        }
示例#5
0
        private void btnSeleccionarHorario_Click(object sender, EventArgs e)
        {
            if (dgvHorarios.RowCount != 0)
            {
                Service.horario    h = horarios[dgvHorarios.CurrentRow.Index];
                Service.asistencia a = new Service.asistencia();

                a.horario = h;

                if (cliente is Service.gestante)
                {
                    a.persona = cliente;
                }
                else
                {
                    a.persona = (Service.persona)cboBebes.SelectedItem;
                }
                Program.dbController.registrarClienteEnHorario(a);
                frmMensaje mensaje = new frmMensaje("Cliente registrado en horario", "Mensaje Confirmación", "Confirmar");
            }
        }
示例#6
0
        private void btnEliminarHorario_Click(object sender, EventArgs e)
        {
            if (curso == null)
            {
                frmMensaje mensaje = new frmMensaje("Seleccione un curso", "Error", ""); if (mensaje.ShowDialog() == DialogResult.OK)
                {
                }
                return;
            }
            frmMensaje dr = new frmMensaje("Seguro que quiere eliminar horario?", "", "Confirmar");

            if (dr.DialogResult == DialogResult.OK)
            {
                horario = horarios[dgvHorarios.CurrentRow.Index];
                horarios.Remove(horario);
                dgvHorarios.Rows.Remove(dgvHorarios.CurrentRow);
            }
            else if (dr.DialogResult == DialogResult.Cancel)
            {
                return;
            }
        }
        private void btnSeleccionarHorario_Click(object sender, EventArgs e)
        {
            if (dgvHorarios.RowCount != 0)
            {
                Service.horario    h = horarios[dgvHorarios.CurrentRow.Index];
                Service.asistencia a = new Service.asistencia();

                a.horario = h;

                if (cliente is Service.gestante)
                {
                    a.persona = cliente;
                }
                else
                {
                    a.persona = (Service.persona)cboBebes.SelectedItem;
                }

                IEnumerable <Service.curso> cur = Program.dbController.cruceHorario(horarios[dgvHorarios.CurrentRow.Index], cliente.idPersona);
                if (cur == null)
                {
                    Program.dbController.registrarClienteEnHorario(a);
                    frmMensaje mensaje = new frmMensaje("Cliente registrado en horario", "Mensaje Confirmación", "Confirmar"); if (mensaje.ShowDialog() == DialogResult.OK)
                    {
                    }
                }
                else
                {
                    foreach (Service.curso c in cur)
                    {
                        frmMensaje mensaje = new frmMensaje("Cuce de horarios con la clase " + c.horario[0].clase + " del curso " + c.nombre, "Advertencia", ""); if (mensaje.ShowDialog() == DialogResult.OK)
                        {
                        }
                        break;
                    }
                }
            }
        }
示例#8
0
        public frmGestionarHorario(Service.horario h)
        {
            InitializeComponent();
            Formateador f = new Formateador();

            f.formGestionarHorario(this, "Gestionar Horario", pnlCtn, btnGuardar, btnModificar, btnCancelar);
            cboSede.DataSource    = Program.dbController.listarSedes();
            cboSede.DisplayMember = "direccion";

            //llena los datos
            cboSede.SelectedItem    = h.sede;
            dtpFechaMatricula.Value = h.fecha;
            cboHoraFin.SelectedItem = (String)h.horaIni.ToShortTimeString();
            cboHoraIni.SelectedItem = (String)h.horaFin.ToShortTimeString();
            txtNumClase.Text        = h.clase.ToString();
            txtNumVac.Text          = h.numVacantes.ToString();

            //docente nulo
            if (h.colaborador != null)
            {
                txtDNIDocente.Text    = h.colaborador.dni;
                txtNombreDocente.Text = h.colaborador.nombre;
            }
        }
示例#9
0
 private void btnEliminarHorario_Click(object sender, EventArgs e)
 {
     horario = horarios[dgvHorarios.CurrentRow.Index];
     horarios.Remove(horario);
     dgvHorarios.Rows.Remove(dgvHorarios.CurrentRow);
 }