Beispiel #1
0
 public List <BECompraFilter> Listar(BECompraFilter pBECompra)
 {
     try
     {
         List <BECompraFilter> resultado = new DACompra().Listar(pBECompra);
         return(resultado);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #2
0
        //ADMINISTRADOR COMPRAS
        public List <ENCompraDesc> GetComprasClientes()
        {
            List <ENCompraDesc> lbeCompra = null;

            using (SqlConnection con = new SqlConnection(CadenaConexion))
            {
                try
                {
                    con.Open();
                    DACompra odCompra = new DACompra();
                    lbeCompra = odCompra.GetComprasCliente(con);
                }
                catch (Exception ex)
                {
                    GrabarLog(ex);
                }
            }
            return(lbeCompra);
        }
Beispiel #3
0
        public bool  Actualizar(ref string mensaje)
        {
            DBHelper.DatabaseHelper oDatabaseHelper = new DatabaseHelper();
            bool bOk = false;

            try
            {
                // oDatabaseHelper.BeginTransaction();

                DGP.DataAccess.Compra.DACompra DACompra = new DACompra();

                bOk = DACompra.Actualizar(ref mensaje, this.BECompra, oDatabaseHelper);


                if (bOk && this.BECompra.MontoTotal != this.BECompra.MontoTotalBD)
                {
                    DGP.BusinessLogic.Ventas.BLDocumentoPago BLDocumentoPago = new DGP.BusinessLogic.Ventas.BLDocumentoPago();
                    List <DGP.Entities.Ventas.BEDocumento>   ListDocVenta    = BLDocumentoPago.Listar(new DGP.Entities.Ventas.BEDocumento()
                    {
                        IdDocumento = this.BECompra.IdNotaCreditoCompra
                    }, oDatabaseHelper);
                    if (ListDocVenta.Count != 1)
                    {
                        throw new Exception("Error al listar Documento ");
                    }
                    DGP.Entities.Ventas.BEDocumento BEDocumento = ListDocVenta[0];

                    BEDocumento.Monto          = this.BECompra.MontoTotal;
                    BEDocumento.BEUsuarioLogin = BECompra.Auditoria;

                    bOk = bOk && BLDocumentoPago.ActualizarCabecera(BEDocumento, oDatabaseHelper);
                    bOk = bOk && (new BusinessLogic.Ventas.BLAmortizacionVenta()).Eliminar(new DGP.Entities.Ventas.BEAmortizacionVenta()
                    {
                        BEUsuarioLogin = BECompra.Auditoria,
                        IdDocumento    = this.BECompra.IdNotaCreditoCompra
                    }, oDatabaseHelper);
                    DGP.BusinessLogic.Ventas.BLAmortizacionVenta BlAmortizacionVenta = new DGP.BusinessLogic.Ventas.BLAmortizacionVenta();

                    bOk = bOk && BlAmortizacionVenta.Eliminar(new DGP.Entities.Ventas.BEAmortizacionVenta()
                    {
                        IdDocumento = this.BECompra.IdNotaCreditoCompra,

                        BEUsuarioLogin = BECompra.Auditoria,
                        Observacion    = "Elimando desde compra"
                    }, oDatabaseHelper);
                    bOk = bOk && BlAmortizacionVenta.ReaplicarAmortizacion(new DGP.Entities.Ventas.BEVenta()
                    {
                        IdCliente      = this.BECompra.IdProveedor,
                        BEUsuarioLogin = this.BECompra.BEUsuarioLogin
                    }, oDatabaseHelper);
                }
                if (bOk)
                {
                    //if (oDatabaseHelper.Command.Transaction!= null)  oDatabaseHelper.CommitTransaction();
                }
                else
                {
                    //oDatabaseHelper.RollbackTransaction();
                    throw new Exception("Error al registrar Amortización");
                }

                return(bOk);
            }
            catch (Exception ex)
            {
                oDatabaseHelper.RollbackTransaction();
                throw ex;
            }
            finally
            {
                oDatabaseHelper.Dispose();
            }
        }