Example #1
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");
            }
        }
Example #2
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");
                }
            }
        }
Example #3
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");
                }
            }
        }
Example #4
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");
            }
        }
        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);
                }
            }
        }
Example #7
0
        public static void ConfirmarForm(string mensaje)
        {
            FormExito form = new FormExito(mensaje);

            form.ShowDialog();
        }