private void btnGrabar_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; if (!ValidarIngreso()) { TipoEntregaBL objBL_TipoEntrega = new TipoEntregaBL(); TipoEntregaBE objTipoEntrega = new TipoEntregaBE(); objTipoEntrega.IdTipoEntrega = IdTipoEntrega; objTipoEntrega.DescTipoEntrega = txtDescripcion.Text; objTipoEntrega.FlagEstado = true; objTipoEntrega.Usuario = Parametros.strUsuarioLogin; objTipoEntrega.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); objTipoEntrega.IdEmpresa = Parametros.intEmpresaId; if (pOperacion == Operacion.Nuevo) { objBL_TipoEntrega.Inserta(objTipoEntrega); } else { objBL_TipoEntrega.Actualiza(objTipoEntrega); } 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()) { TipoEntregaBE objE_TipoEntrega = new TipoEntregaBE(); objE_TipoEntrega.IdTipoEntrega = int.Parse(gvTipoEntrega.GetFocusedRowCellValue("IdTipoEntrega").ToString()); objE_TipoEntrega.Usuario = Parametros.strUsuarioLogin; objE_TipoEntrega.Maquina = WindowsIdentity.GetCurrent().Name.ToString(); objE_TipoEntrega.IdEmpresa = Parametros.intEmpresaId; TipoEntregaBL objBL_TipoEntrega = new TipoEntregaBL(); objBL_TipoEntrega.Elimina(objE_TipoEntrega); 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(TipoEntregaBE pItem) { try { TipoEntregaDL TipoEntrega = new TipoEntregaDL(); TipoEntrega.Elimina(pItem); } catch (Exception ex) { throw ex; } }
public void Actualiza(TipoEntregaBE pItem) { try { TipoEntregaDL TipoEntrega = new TipoEntregaDL(); TipoEntrega.Actualiza(pItem); } catch (Exception ex) { throw ex; } }
public TipoEntregaBE Selecciona(int IdEmpresa, int IdTipoEntrega) { try { TipoEntregaDL TipoEntrega = new TipoEntregaDL(); TipoEntregaBE objEmp = TipoEntrega.Selecciona(IdEmpresa, IdTipoEntrega); return(objEmp); } catch (Exception ex) { throw ex; } }
public void Elimina(TipoEntregaBE pItem) { Database db = DatabaseFactory.CreateDatabase("cnSSOMABD"); DbCommand dbCommand = db.GetStoredProcCommand("usp_TipoEntrega_Elimina"); db.AddInParameter(dbCommand, "pIdTipoEntrega", DbType.Int32, pItem.IdTipoEntrega); 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 TipoEntregaBE Selecciona(int IdEmpresa, int idTipoEntrega) { Database db = DatabaseFactory.CreateDatabase("cnSSOMABD"); DbCommand dbCommand = db.GetStoredProcCommand("usp_TipoEntrega_Selecciona"); db.AddInParameter(dbCommand, "pIdEmpresa", DbType.Int32, IdEmpresa); db.AddInParameter(dbCommand, "pidTipoEntrega", DbType.Int32, idTipoEntrega); IDataReader reader = db.ExecuteReader(dbCommand); TipoEntregaBE TipoEntrega = null; while (reader.Read()) { TipoEntrega = new TipoEntregaBE(); TipoEntrega.IdTipoEntrega = Int32.Parse(reader["idTipoEntrega"].ToString()); TipoEntrega.DescTipoEntrega = reader["descTipoEntrega"].ToString(); TipoEntrega.FlagEstado = Boolean.Parse(reader["flagestado"].ToString()); } reader.Close(); reader.Dispose(); return(TipoEntrega); }
public List <TipoEntregaBE> ListaCombo(int IdEmpresa) { Database db = DatabaseFactory.CreateDatabase("cnSSOMABD"); DbCommand dbCommand = db.GetStoredProcCommand("usp_TipoEntrega_ListaCombo"); db.AddInParameter(dbCommand, "pIdEmpresa", DbType.Int32, IdEmpresa); IDataReader reader = db.ExecuteReader(dbCommand); List <TipoEntregaBE> TipoEntregalist = new List <TipoEntregaBE>(); TipoEntregaBE TipoEntrega; while (reader.Read()) { TipoEntrega = new TipoEntregaBE(); TipoEntrega.IdTipoEntrega = Int32.Parse(reader["idTipoEntrega"].ToString()); TipoEntrega.DescTipoEntrega = reader["descTipoEntrega"].ToString(); TipoEntregalist.Add(TipoEntrega); } reader.Close(); reader.Dispose(); return(TipoEntregalist); }
public void InicializarModificar() { if (gvTipoEntrega.RowCount > 0) { TipoEntregaBE objTipoEntrega = new TipoEntregaBE(); objTipoEntrega.IdTipoEntrega = int.Parse(gvTipoEntrega.GetFocusedRowCellValue("IdTipoEntrega").ToString()); objTipoEntrega.DescTipoEntrega = gvTipoEntrega.GetFocusedRowCellValue("DescTipoEntrega").ToString(); objTipoEntrega.FlagEstado = Convert.ToBoolean(gvTipoEntrega.GetFocusedRowCellValue("FlagEstado").ToString()); frmManTipoEntregaEdit objManTipoEntregaEdit = new frmManTipoEntregaEdit(); objManTipoEntregaEdit.pOperacion = frmManTipoEntregaEdit.Operacion.Modificar; objManTipoEntregaEdit.IdTipoEntrega = objTipoEntrega.IdTipoEntrega; objManTipoEntregaEdit.pTipoEntregaBE = objTipoEntrega; objManTipoEntregaEdit.StartPosition = FormStartPosition.CenterParent; objManTipoEntregaEdit.ShowDialog(); Cargar(); } else { MessageBox.Show("No se pudo editar"); } }