private void btnGrabar_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; if (!ValidarIngreso()) { SustitucionBL objBL_Sustitucion = new SustitucionBL(); SustitucionBE objSustitucion = new SustitucionBE(); objSustitucion.IdSustitucion = IdSustitucion; objSustitucion.DescSustitucion = txtDescripcion.Text; objSustitucion.FlagEstado = true; objSustitucion.Usuario = Parametros.strUsuarioLogin; objSustitucion.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); objSustitucion.IdEmpresa = Parametros.intEmpresaId; if (pOperacion == Operacion.Nuevo) { objBL_Sustitucion.Inserta(objSustitucion); } else { objBL_Sustitucion.Actualiza(objSustitucion); } this.Close(); } } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void tlbMenu_DeleteClick() { try { Cursor = Cursors.WaitCursor; if (XtraMessageBox.Show("Esta seguro de eliminar el registro?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (!ValidarIngreso()) { SustitucionBE objE_Sustitucion = new SustitucionBE(); objE_Sustitucion.IdSustitucion = int.Parse(gvSustitucion.GetFocusedRowCellValue("IdSustitucion").ToString()); objE_Sustitucion.Usuario = Parametros.strUsuarioLogin; objE_Sustitucion.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); objE_Sustitucion.IdEmpresa = Parametros.intEmpresaId; SustitucionBL objBL_Sustitucion = new SustitucionBL(); objBL_Sustitucion.Elimina(objE_Sustitucion); XtraMessageBox.Show("El registro se eliminó correctamente", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); Cargar(); } } Cursor = Cursors.Default; } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Elimina(SustitucionBE pItem) { try { SustitucionDL Sustitucion = new SustitucionDL(); Sustitucion.Elimina(pItem); } catch (Exception ex) { throw ex; } }
public void Actualiza(SustitucionBE pItem) { try { SustitucionDL Sustitucion = new SustitucionDL(); Sustitucion.Actualiza(pItem); } catch (Exception ex) { throw ex; } }
public SustitucionBE Selecciona(int IdSustitucion) { try { SustitucionDL Sustitucion = new SustitucionDL(); SustitucionBE objEmp = Sustitucion.Selecciona(IdSustitucion); return(objEmp); } catch (Exception ex) { throw ex; } }
public void Elimina(SustitucionBE pItem) { Database db = DatabaseFactory.CreateDatabase("cnSSOMABD"); DbCommand dbCommand = db.GetStoredProcCommand("usp_Sustitucion_Elimina"); db.AddInParameter(dbCommand, "pIdSustitucion", DbType.Int32, pItem.IdSustitucion); db.AddInParameter(dbCommand, "pIdEmpresa", DbType.Int32, pItem.IdEmpresa); db.AddInParameter(dbCommand, "pUsuario", DbType.String, pItem.Usuario); db.AddInParameter(dbCommand, "pMaquina", DbType.String, pItem.Maquina); db.ExecuteNonQuery(dbCommand); }
public SustitucionBE Selecciona(int idSustitucion) { Database db = DatabaseFactory.CreateDatabase("cnSSOMABD"); DbCommand dbCommand = db.GetStoredProcCommand("usp_Sustitucion_Selecciona"); db.AddInParameter(dbCommand, "pidSustitucion", DbType.Int32, idSustitucion); IDataReader reader = db.ExecuteReader(dbCommand); SustitucionBE Sustitucion = null; while (reader.Read()) { Sustitucion = new SustitucionBE(); Sustitucion.IdSustitucion = Int32.Parse(reader["idSustitucion"].ToString()); Sustitucion.DescSustitucion = reader["descSustitucion"].ToString(); Sustitucion.FlagEstado = Boolean.Parse(reader["flagestado"].ToString()); } reader.Close(); reader.Dispose(); return(Sustitucion); }
public List <SustitucionBE> ListaCombo(int IdEmpresa) { Database db = DatabaseFactory.CreateDatabase("cnSSOMABD"); DbCommand dbCommand = db.GetStoredProcCommand("usp_Sustitucion_ListaCombo"); db.AddInParameter(dbCommand, "pIdEmpresa", DbType.Int32, IdEmpresa); IDataReader reader = db.ExecuteReader(dbCommand); List <SustitucionBE> Sustitucionlist = new List <SustitucionBE>(); SustitucionBE Sustitucion; while (reader.Read()) { Sustitucion = new SustitucionBE(); Sustitucion.IdSustitucion = Int32.Parse(reader["idSustitucion"].ToString()); Sustitucion.DescSustitucion = reader["descSustitucion"].ToString(); Sustitucionlist.Add(Sustitucion); } reader.Close(); reader.Dispose(); return(Sustitucionlist); }
public void InicializarModificar() { if (gvSustitucion.RowCount > 0) { SustitucionBE objSustitucion = new SustitucionBE(); objSustitucion.IdSustitucion = int.Parse(gvSustitucion.GetFocusedRowCellValue("IdSustitucion").ToString()); objSustitucion.DescSustitucion = gvSustitucion.GetFocusedRowCellValue("DescSustitucion").ToString(); objSustitucion.FlagEstado = Convert.ToBoolean(gvSustitucion.GetFocusedRowCellValue("FlagEstado").ToString()); frmManSustitucionEdit objManSustitucionEdit = new frmManSustitucionEdit(); objManSustitucionEdit.pOperacion = frmManSustitucionEdit.Operacion.Modificar; objManSustitucionEdit.IdSustitucion = objSustitucion.IdSustitucion; objManSustitucionEdit.pSustitucionBE = objSustitucion; objManSustitucionEdit.StartPosition = FormStartPosition.CenterParent; objManSustitucionEdit.ShowDialog(); Cargar(); } else { MessageBox.Show("No se pudo editar"); } }