private void tsbEliminar_Click(object sender, EventArgs e) { try { //ojo revisar esto BLCompra BLDP = new BLCompra(); List <BECompra> lista = new List <BECompra>(); foreach (DataGridViewRow dgvRow in this.dgrvCompras.Rows) { if (Convert.ToBoolean(dgvRow.Cells["Seleccionado"].Value).Equals(true)) { BECompra beCompra = new BECompra(); beCompra.IdCompra = Convert.ToInt32(dgvRow.Cells["IdCompra"].Value.ToString()); beCompra.BEUsuarioLogin = VariablesSession.BEUsuarioSession; beCompra.Observacion = "Eliminado por :" + VariablesSession.BEUsuarioSession.Nombre; BLDP.Eliminar(beCompra); } } CargarGrilla(); } catch (Exception ex) { this.MostrarMensaje(ex.StackTrace, MessageBoxIcon.Error); } }
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { try { string temp = e.ToString() + " clase : " + e.GetType().Name; //ojo revisar esto int IdCompra = Convert.ToInt32((string.IsNullOrEmpty(this.lblIDCompra.Text) ? "0" : this.lblIDCompra.Text)); BLCompra BLDP = new BLCompra(); BECompra beCompra = new BECompra(); beCompra.IdCompra = IdCompra; beCompra.BEUsuarioLogin = VariablesSession.BEUsuarioSession; beCompra.Observacion = "Eliminado por :" + VariablesSession.BEUsuarioSession.Nombre; if (MessageBox.Show("Desea Eliminar la compra?", "Eliminar Compra", MessageBoxButtons.YesNo) == DialogResult.Yes) { //BLDP.Eliminar(beCompra); //this.bdSourceCompras.EndEdit(); this.bdnCompras.Refresh(); } else { //this.bdSourceCompras.CancelEdit(); } } catch (Exception ex) { this.MostrarMensaje(ex.StackTrace, MessageBoxIcon.Error); } }
public bool Eliminar(BECompra beCompra) { string mensaje = string.Empty; try { return(new DACompra().Eliminar(ref mensaje, beCompra)); } catch (Exception ex) { throw new Exception(mensaje); } }
public BLCompra(int IdCompra) { List <BECompraFilter> result = this.Listar(new BECompraFilter() { IdCompra = IdCompra }); if (result.Count == 0) { this.BECompra = new BECompra(); } else if (result.Count == 1) { this.BECompra = result[0]; } else { throw new Exception("Existe mas de una registro de compra. Validar BD"); } }
public bool Eliminar(ref string pmensaje, BECompra bECompra, DatabaseHelper pDatabaseHelper) { DatabaseHelper oDatabaseHelper = (pDatabaseHelper == null) ? new DatabaseHelper() : pDatabaseHelper; try { if (pDatabaseHelper == null) { oDatabaseHelper.BeginTransaction(); } oDatabaseHelper.ClearParameter(); oDatabaseHelper.AddParameter("@IdCompra", bECompra.IdCompra); oDatabaseHelper.AddParameter("@Usuario", (bECompra.Auditoria == null) ? (object)DBNull.Value : bECompra.Auditoria.IdPersonal); int filasAfectadas = oDatabaseHelper.ExecuteNonQuery("DGP_Eliminar_Compra", CommandType.StoredProcedure, DBHelper.ConnectionState.KeepOpen, true); if (pDatabaseHelper == null && filasAfectadas > 0) { oDatabaseHelper.CommitTransaction(); } return(filasAfectadas > 0); } catch (Exception ex) { if (pDatabaseHelper == null) { oDatabaseHelper.RollbackTransaction(); } throw ex; } finally { if (pDatabaseHelper == null) { oDatabaseHelper.Dispose(); } } }
public bool Actualizar(ref string pmensaje, BECompra bECompra, DatabaseHelper pDatabaseHelper) { DatabaseHelper oDatabaseHelper = (pDatabaseHelper == null) ? new DatabaseHelper() : pDatabaseHelper; try { if (pDatabaseHelper == null) { oDatabaseHelper.BeginTransaction(); } oDatabaseHelper.ClearParameter(); oDatabaseHelper.AddParameter("@IdCompra", bECompra.IdCompra); oDatabaseHelper.AddParameter("@idTipoDocumento", (string.IsNullOrEmpty(bECompra.IdTipoDocumentoCompra)) ? (object)DBNull.Value : bECompra.IdTipoDocumentoCompra); oDatabaseHelper.AddParameter("@idClienteProveedor", bECompra.IdProveedor); oDatabaseHelper.AddParameter("@Total_Jabas", bECompra.TotalJabas); oDatabaseHelper.AddParameter("@Total_Peso_Bruto", bECompra.TotalPesoBruto); oDatabaseHelper.AddParameter("@Total_Peso_Tara", bECompra.TotalPesoTara); oDatabaseHelper.AddParameter("@Total_Peso_Neto", bECompra.TotalPesoNeto); oDatabaseHelper.AddParameter("@Total_Devolucion", bECompra.TotalDevolucion); oDatabaseHelper.AddParameter("@Total_Amortizacion", bECompra.TotalAmortizacion); oDatabaseHelper.AddParameter("@Total_Saldo", bECompra.TotalAmortizacion); oDatabaseHelper.AddParameter("@Precio", bECompra.Precio); oDatabaseHelper.AddParameter("@Monto_SubTotal", bECompra.MontoSubTotal); oDatabaseHelper.AddParameter("@Monto_Igv", bECompra.MontoIGV); oDatabaseHelper.AddParameter("@Monto_Total", bECompra.MontoTotal); //oDatabaseHelper.AddParameter("@EsSobrante", bECompra.EsSobrante); oDatabaseHelper.AddParameter("@IdEstado", bECompra.IdEstado);; oDatabaseHelper.AddParameter("@Observacion", bECompra.Observacion); oDatabaseHelper.AddParameter("@IdProducto", bECompra.IdProducto); oDatabaseHelper.AddParameter("@TotalUnidades", bECompra.TotalUnidades); oDatabaseHelper.AddParameter("@Usuario", (bECompra.Auditoria == null) ? (object)DBNull.Value : bECompra.Auditoria.IdPersonal); oDatabaseHelper.AddParameter("@IdNotaCreditoCompra", (bECompra.IdNotaCreditoCompra <= 0) ? (object)DBNull.Value : bECompra.IdNotaCreditoCompra); int filasAfectadas = oDatabaseHelper.ExecuteNonQuery("DGP_Actualizar_Compra", CommandType.StoredProcedure, DBHelper.ConnectionState.KeepOpen, true); if (pDatabaseHelper == null && filasAfectadas > 0) { oDatabaseHelper.CommitTransaction(); } return(filasAfectadas > 0); } catch (Exception ex) { if (pDatabaseHelper == null) { oDatabaseHelper.RollbackTransaction(); } throw ex; } finally { if (pDatabaseHelper == null) { oDatabaseHelper.Dispose(); } } }
public bool Actualizar(ref string pmensaje, BECompra bECompra) { return(this.Actualizar(ref pmensaje, bECompra, null)); }
public bool Insertar(ref string pmensaje, BECompra bECompra) { bool bOk = this.Insertar(ref pmensaje, bECompra, null); return(bOk); }
public bool Eliminar(ref string pmensaje, BECompra bECompra) { return(this.Eliminar(ref pmensaje, bECompra, null)); }
public BLCompra(BECompra beCompra) { this.BECompra = beCompra; }
public BLCompra() { this.BECompra = new BECompra(); }