Example #1
0
        private void BtnGuardar_Click(object sender, EventArgs e)
        {
            if (txtDni.Text.Trim() != "" | txtApellidos.Text.Trim() != "")
            {
                if (Program.evento == 0)
                {
                    try
                    {
                        ObjEntidad.Apellidos    = txtApellidos.Text.ToUpper();
                        ObjEntidad.Nombres      = txtNombres.Text.ToUpper();
                        ObjEntidad.Dni          = txtDni.Text.ToUpper();
                        ObjEntidad.Nacionalidad = txtNacionalidad.Text.ToUpper();
                        ObjEntidad.Mayor        = txtMayor.Text.ToUpper();
                        ObjEntidad.Ascenso      = txtAscenso.Text.ToUpper();
                        ObjEntidad.Telefonos    = txtTelefonos.Text.ToUpper();
                        ObjEntidad.Fecha        = txtFecha.Text.ToUpper();
                        ObjEntidad.Destino      = txtDestino.Text.ToUpper();
                        ObjEntidad.Grupo        = txtGrupo.Text.ToUpper();


                        ObjNegocios.InsertarRegistros(ObjEntidad);
                        MensajeConfirmacion("Se Inserto Correctamente");
                        Program.evento = 0;
                        LimpiarCajas();
                        Close();
                    }
                    catch (Exception)
                    {
                        MensajeError("No se Pudo Insertar el Registro");
                    }
                }
                else
                {
                    try
                    {
                        ObjEntidad.IdPasajeros  = Convert.ToInt32(txtCodigo.Text.ToUpper());
                        ObjEntidad.Apellidos    = txtApellidos.Text.ToUpper();
                        ObjEntidad.Nombres      = txtNombres.Text.ToUpper();
                        ObjEntidad.Dni          = txtDni.Text.ToUpper();
                        ObjEntidad.Nacionalidad = txtNacionalidad.Text.ToUpper();
                        ObjEntidad.Mayor        = txtMayor.Text.ToUpper();
                        ObjEntidad.Ascenso      = txtAscenso.Text.ToUpper();
                        ObjEntidad.Telefonos    = txtTelefonos.Text.ToUpper();
                        ObjEntidad.Fecha        = txtFecha.Text.ToUpper();
                        ObjEntidad.Destino      = txtDestino.Text.ToUpper();
                        ObjEntidad.Grupo        = txtGrupo.Text.ToUpper();

                        ObjNegocios.EditarRegistros(ObjEntidad);

                        MensajeConfirmacion("Se Modifico Correctamente");
                        Program.evento = 0;
                        LimpiarCajas();
                        Close();
                    }
                    catch (Exception)
                    {
                        MensajeError("No se Pudo Editar el Registro");
                    }
                }
            }
            else
            {
                MensajeError("Llene los Campos Correspondientes para Guardar el Registro");
            }
        }