private void btnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         List <Error> ListaErrores = this.ValidarDatos();
         if (ListaErrores.Count == 0)
         {
             ChechkList        Datos = this.ObtenerDatos();
             CheckList_Negocio cn    = new CheckList_Negocio();
             cn.ABCChecKList(Datos);
             if (Datos.Completado)
             {
                 MessageBox.Show("Datos guardados correctamente.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this._DatosCheckList = Datos;
                 this.DialogResult    = DialogResult.OK;
             }
             else
             {
                 MessageBox.Show("Ocurrió un error al guardar los datos.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             this.MostrarMensajeError(ListaErrores);
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmNuevoCheckList ~ btnGuardar_Click");
         MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 private void LlenarComboTipoCheck()
 {
     try
     {
         TipoChechkList Datos = new TipoChechkList {
             IncluirSelect = true, Conexion = Comun.Conexion
         };
         CheckList_Negocio CN = new CheckList_Negocio();
         this.cmbTipoCheckList.DataSource    = CN.LlenarComboTipoCheck(Datos);
         this.cmbTipoCheckList.DisplayMember = "Descripcion";
         this.cmbTipoCheckList.ValueMember   = "IDTipoCheckList";
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #3
0
 private void LlenarGridChecList(bool Band)
 {
     try
     {
         ChechkList DatosAux = new ChechkList {
             Conexion = Comun.Conexion, BuscarTodos = Band
         };
         CheckList_Negocio CN = new CheckList_Negocio();
         CN.ObtenerCatCheck(DatosAux);
         this.dgvCheckList.AutoGenerateColumns = false;
         this.dgvCheckList.DataSource          = DatosAux.TablaDatos;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #4
0
 private void BusquedaCheck(string TextoCheck)
 {
     try
     {
         ChechkList DatosAux = new ChechkList {
             Conexion = Comun.Conexion, Titulo = TextoCheck, BuscarTodos = false
         };
         CheckList_Negocio CN = new CheckList_Negocio();
         CN.ObtenercheckBusqueda(DatosAux);
         this.dgvCheckList.AutoGenerateColumns = false;
         this.dgvCheckList.DataSource          = DatosAux.TablaDatos;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #5
0
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.dgvCheckList.SelectedRows.Count == 1)
         {
             ChechkList DatosAux = this.ObtenerDatosCheckList();
             if (!string.IsNullOrEmpty(DatosAux.IDCheckList))
             {
                 CheckList_Negocio CN = new CheckList_Negocio();
                 DatosAux.Conexion  = Comun.Conexion;
                 DatosAux.IDUsuario = Comun.IDUsuario;
                 DatosAux.Opcion    = 3;
                 CN.ABCChecKList(DatosAux);
                 if (DatosAux.Completado)
                 {
                     MessageBox.Show("Registro Eliminado.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                     Int32 RowToDelete = this.dgvCheckList.Rows.GetFirstRow(DataGridViewElementStates.Selected);
                     if (RowToDelete > -1)
                     {
                         this.dgvCheckList.Rows.RemoveAt(RowToDelete);
                     }
                     else
                     {
                         this.LlenarGridChecList(false);
                     }
                 }
                 else
                 {
                     MessageBox.Show("Error al eliminar los datos. Contacte a Soporte Técnico.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
         }
         else
         {
             MessageBox.Show("Seleccione un registro.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmCheckList ~ btnEliminar_Click");
         MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Visible = true;
     }
 }