Exemplo n.º 1
0
        private void btnEditarSocio_Click(object sender, EventArgs e)
        {
            if (tablaSocio.SelectedRows.Count > 0)
            {
                DateTime fechanac;
                DateTime.TryParse(tablaSocio.CurrentRow.Cells[6].Value.ToString(), out fechanac);

                FormMantenimientoSocio form = new FormMantenimientoSocio();

                form.editar = true;

                form.txtBoxIdSocio.Text       = tablaSocio.CurrentRow.Cells[0].Value.ToString();
                form.txtBoxNombre.Text        = tablaSocio.CurrentRow.Cells[2].Value.ToString();
                form.txtBoxApellido.Text      = tablaSocio.CurrentRow.Cells[3].Value.ToString();
                form.comboBoxSexo.Text        = tablaSocio.CurrentRow.Cells[4].Value.ToString();
                form.txtBoxDni.Text           = tablaSocio.CurrentRow.Cells[5].Value.ToString();
                form.datePickerFechaNac.Value = fechanac;
                form.txtBoxNacionalidad.Text  = tablaSocio.CurrentRow.Cells[7].Value.ToString();
                form.comboBoxEstcivil.Text    = tablaSocio.CurrentRow.Cells[8].Value.ToString();
                form.txtBoxDireccion.Text     = tablaSocio.CurrentRow.Cells[9].Value.ToString();
                form.txtBoxTelefono.Text      = tablaSocio.CurrentRow.Cells[10].Value.ToString();
                form.txtBoxEmail.Text         = tablaSocio.CurrentRow.Cells[11].Value.ToString();
                form.comboBoxPago.Text        = tablaSocio.CurrentRow.Cells[12].Value.ToString();

                form.ShowDialog();
                ListarSocios();
            }
            else
            {
                FormNotificacion.VerificarForm("Seleccione una fila para editar");
            }
        }
Exemplo n.º 2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            Validaciones.ValidarCampos(ref txtBoxNombre, "string");
            Validaciones.ValidarCampos(ref txtBoxApellido, "string");
            Validaciones.ValidarCampos(ref txtBoxDni, "int");
            Validaciones.ValidarCampos(ref txtBoxNacionalidad, "string");
            Validaciones.ValidarCampos(ref txtBoxEmail, "string");
            Validaciones.ValidarCampos(ref txtBoxDireccion, "string");
            Validaciones.ValidarCampos(ref txtBoxTelefono, "double");
            Validaciones.ValidarCampoCombo(ref comboBoxPago, "string");
            Validaciones.ValidarCampoCombo(ref comboBoxEstcivil, "string");
            Validaciones.ValidarCampoCombo(ref comboBoxSexo, "string");
            Validaciones.ValidarCampoCombo(ref comboBoxTipoPlan, "string");

            try
            {
                SocioPleno socio = new SocioPleno();

                socio.InsertarSocioPleno(Convert.ToInt32(txtBoxIdSocio.Text), comboBoxTipoPlan.Text);
                FormExito.ConfirmarForm("Se ha guardado correctamente");

                Close();
            }
            catch (Exception ex)
            {
                //MessageBox.Show("PASO ESTO PAI: " + ex);
                FormNotificacion.VerificarForm("Atención. Uno o más datos son incorrectos");
            }
        }
Exemplo n.º 3
0
 private void btnCalcularPrecioFinal_Click(object sender, EventArgs e)
 {
     Validaciones.ValidarCampos(ref txtBoxPrecioBase, "double");
     try
     {
         SocioDeportivo socio = new SocioDeportivo(lblTipoPago.Text, Convert.ToDouble(txtBoxPrecioBase.Text), lblInscripcion.Text);
         this.precioFinal    = socio.Calcularpreciofinal();
         lblPrecioFinal.Text = Convert.ToString(this.precioFinal);
     }
     catch (Exception)
     {
         FormNotificacion.VerificarForm("Los datos ingresados son incorrectos");
     }
 }
Exemplo n.º 4
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            Validaciones.ValidarCampos(ref txtBoxNombre, "string");
            Validaciones.ValidarCampos(ref txtBoxApellido, "string");
            Validaciones.ValidarCampos(ref txtBoxDireccion, "string");
            Validaciones.ValidarCampos(ref txtBoxDni, "int");
            Validaciones.ValidarCampos(ref txtBoxTelefono, "long");
            Validaciones.ValidarCampos(ref txtBoxEmail, "string");
            Validaciones.ValidarCampos(ref txtBoxNacionalidad, "string");
            Validaciones.ValidarCampoCombo(ref comboBoxSexo, "string");
            Validaciones.ValidarCampoCombo(ref comboBoxEstcivil, "string");
            Validaciones.ValidarCampoCombo(ref comboBoxPago, "string");

            if (!editar)
            {
                try
                {
                    Socio socio = new Socio();
                    socio.InsertarSocio(txtBoxNombre.Text, txtBoxApellido.Text, comboBoxSexo.Text, Convert.ToInt32(txtBoxDni.Text), datePickerFechaNac.Value.Date, txtBoxNacionalidad.Text, comboBoxEstcivil.Text, txtBoxDireccion.Text, Convert.ToInt64(txtBoxTelefono.Text), txtBoxEmail.Text, comboBoxPago.Text);

                    FormExito.ConfirmarForm("Se ha guardado correctamente");

                    Close();
                }
                catch (Exception ex)
                {
                    FormNotificacion.VerificarForm("Atención. Uno o más datos son incorrectos");
                }
            }
            if (editar)
            {
                try
                {
                    Socio socio = new Socio();

                    socio.EditarSocio(Convert.ToInt32(txtBoxIdSocio.Text), txtBoxNombre.Text, txtBoxApellido.Text, comboBoxSexo.Text, Convert.ToInt32(txtBoxDni.Text), datePickerFechaNac.Value.Date, txtBoxNacionalidad.Text, comboBoxEstcivil.Text, txtBoxDireccion.Text, Convert.ToInt64(txtBoxTelefono.Text), txtBoxEmail.Text, comboBoxPago.Text);

                    FormExito.ConfirmarForm("Se ha editado correctamente");

                    Close();

                    editar = false;
                }
                catch (Exception ex)
                {
                    FormNotificacion.VerificarForm("Atención. Uno o más datos son incorrectos");
                }
            }
        }
Exemplo n.º 5
0
        private void btnGuardarProfesor_Click(object sender, EventArgs e)
        {
            Validaciones.ValidarCampos(ref txtBoxNombreProfesor, "string");
            Validaciones.ValidarCampos(ref txtBoxApellidoProfesor, "string");
            Validaciones.ValidarCampos(ref txtBoxDireccionProfesor, "string");
            Validaciones.ValidarCampos(ref txtBoxDniProfesor, "int");
            Validaciones.ValidarCampos(ref txtBoxTelefonoProfesor, "long");
            Validaciones.ValidarCampos(ref txtBoxEmailProfesor, "string");
            //Validaciones.ValidarCampoCombo(ref comboBoxSexoProfesor, "string");

            if (!editar)
            {
                try
                {
                    Profesor profesor = new Profesor();

                    profesor.InsertarProfesor(txtBoxNombreProfesor.Text, txtBoxApellidoProfesor.Text, comboBoxSexoProfesor.Text, Convert.ToInt32(txtBoxDniProfesor.Text), datePickerFechaNacProfesor.Value.Date, txtBoxDireccionProfesor.Text, Convert.ToInt64(txtBoxTelefonoProfesor.Text), txtBoxEmailProfesor.Text);

                    FormExito.ConfirmarForm("Se ha guardado correctamente");

                    Close();
                }
                catch (Exception ex)
                {
                    FormNotificacion.VerificarForm("Atención. Uno o más datos son incorrectos");
                }
            }
            if (editar)
            {
                try
                {
                    Profesor profesor = new Profesor();

                    profesor.EditarProfesor(Convert.ToInt32(txtBoxIdProfesor.Text), txtBoxNombreProfesor.Text, txtBoxApellidoProfesor.Text, comboBoxSexoProfesor.Text, Convert.ToInt32(txtBoxDniProfesor.Text), datePickerFechaNacProfesor.Value.Date, txtBoxDireccionProfesor.Text, Convert.ToInt64(txtBoxTelefonoProfesor.Text), txtBoxEmailProfesor.Text);

                    FormExito.ConfirmarForm("Se ha editado correctamente");
                    Close();
                    editar = false;
                }
                catch (Exception ex)
                {
                    FormNotificacion.VerificarForm("Atención. Uno o más datos son incorrectos");
                }
            }
        }
Exemplo n.º 6
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                SocioDeportivo socio = new SocioDeportivo();

                socio.InsertarSocioDeportivo(Convert.ToInt32(txtBoxIdSocio.Text), comboBoxInscripcion.Text);
                FormExito.ConfirmarForm("Se ha guardado correctamente");


                Close();
                lista();
            }
            catch (Exception)
            {
                FormNotificacion.VerificarForm("Atención. Uno o más datos son incorrectos");
            }
        }
Exemplo n.º 7
0
        private void btnEditarDeporte_Click(object sender, EventArgs e)
        {
            if (tablaDeporte.SelectedRows.Count > 0)
            {
                FormMantenimientoDeporte form = new FormMantenimientoDeporte();

                form.editar = true;
                form.txtBoxIdDeporte.Text     = tablaDeporte.CurrentRow.Cells[0].Value.ToString();
                form.txtBoxIdProfesor.Text    = tablaDeporte.CurrentRow.Cells[1].Value.ToString();
                form.txtBoxNombreDeporte.Text = tablaDeporte.CurrentRow.Cells[3].Value.ToString();
                form.comboBoxDiasDeporte.Text = tablaDeporte.CurrentRow.Cells[6].Value.ToString();
                form.comboBoxHorarios.Text    = tablaDeporte.CurrentRow.Cells[7].Value.ToString();

                form.ShowDialog();
                ListarDeporte();
            }
            else
            {
                FormNotificacion.VerificarForm("Seleccione una fila para editar");
            }
        }
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            if (tablaSocioDeportivo.SelectedRows.Count > 0)
            {
                DialogResult    result = new DialogResult();
                FormAdvertencia form   = new FormAdvertencia("¿Estas seguro de eliminar?");
                result = form.ShowDialog();
                if (result == DialogResult.OK)
                {
                    Socio socio   = new Socio();
                    int   idSocio = Convert.ToInt32(tablaSocioDeportivo.CurrentRow.Cells[0].Value.ToString());
                    socio.EliminarSocio(idSocio);

                    FormExito.ConfirmarForm("Se eliminó correctamente");
                    ListarSociosDeportivos();
                }
            }
            else
            {
                FormNotificacion.VerificarForm("Seleccione una fila para eliminar");
            }
        }
        private void btnGuardarDeporte_Click(object sender, EventArgs e)
        {
            Validaciones.ValidarCampos(ref txtBoxNombreDeporte, "string");

            if (!editar)
            {
                try
                {
                    if (tablaListaProfesores.SelectedRows.Count > 0)
                    {
                        Deporte depo = new Deporte();
                        txtBoxIdProfesor.Text = tablaListaProfesores.CurrentRow.Cells[0].Value.ToString();

                        string nombre     = txtBoxNombreDeporte.Text;
                        string horarios   = comboBoxHorarios.Text;
                        string dias       = comboBoxDiasDeporte.Text;
                        int    idProfesor = Convert.ToInt32(idProf);

                        depo.InsertarDeporte(txtBoxNombreDeporte.Text, comboBoxDiasDeporte.Text, comboBoxHorarios.Text, Convert.ToInt32(txtBoxIdProfesor.Text));

                        FormExito.ConfirmarForm("Se ha guardado correctamente");
                        Close();
                    }
                    else
                    {
                        MessageBox.Show("Elige un profesor");
                    }
                }
                catch (Exception ex)
                {
                    FormNotificacion.VerificarForm("Atención. Uno o más datos son incorrectos");
                }
            }
            if (editar)
            {
                try
                {
                    if (tablaListaProfesores.SelectedRows.Count > 0)
                    {
                        FormDeporte form = new FormDeporte();

                        string idProfe = tablaListaProfesores.CurrentRow.Cells[0].Value.ToString();

                        Deporte depo = new Deporte();



                        depo.EditarDeporte(Convert.ToInt32(txtBoxIdDeporte.Text), txtBoxNombreDeporte.Text, comboBoxDiasDeporte.Text, comboBoxHorarios.Text, Convert.ToInt32(tablaListaProfesores.CurrentRow.Cells[0].Value.ToString()));

                        Close();
                        editar = false;
                    }
                    else
                    {
                        MessageBox.Show("Elija una fila");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("No se pudo editar" + ex);
                }
            }
        }
Exemplo n.º 10
0
        public static void VerificarForm(string mensaje)
        {
            FormNotificacion form = new FormNotificacion(mensaje);

            form.ShowDialog();
        }