public bool AgregarAbonoCC(Abono _abono) { DAOAbono abono = new DAOAbono(); if (abono.CantidadAbonos(_abono.Factura) == 0) { System.Diagnostics.Debug.WriteLine(abono.CantidadAbonos(_abono.Factura)); if (abono.AgregarPrimerAbono(_abono)) { return true; } else { return false; } } else { if (abono.AgregarAbonoCC(_abono)) { return true; } else { return false; } } }
public List<Entidad> BuscarAbonos(int idfactura) { String cadenaConexion = ConfigurationManager.ConnectionStrings["ConnUricao"].ToString(); SqlConnection conexion = new SqlConnection(); SqlCommand cmd = new SqlCommand(); SqlDataReader dr; Entidad objetoUsuario = FabricaEntidad.CrearAbono(); List<Entidad> miLista = new List<Entidad>(); // List<CuentaPorCobrar> lalista = new List<CuentaPorCobrar>(); try { conexion = new SqlConnection(cadenaConexion); conexion.Open(); cmd = new SqlCommand("dbo.BuscarAbonos", conexion); cmd.CommandType = CommandType.StoredProcedure; //SqlParameter param = new SqlParameter("@cedula", "v-19293743"); SqlParameter param = new SqlParameter("@idFactura", idfactura); cmd.Parameters.Add(param); // cmd.Parameters.AddWithValue("@cedula", "v-19293743"); dr = cmd.ExecuteReader(); while (dr.Read()) { objetoUsuario = new Abono(); (objetoUsuario as Abono).MontoAbono = Convert.ToDouble(dr.GetValue(0).ToString()); (objetoUsuario as Abono).Deuda = Convert.ToDouble(dr.GetValue(1).ToString()); (objetoUsuario as Abono).FechaAbono = dr.GetValue(2).ToString(); miLista.Add(objetoUsuario); } db.CerrarConexion(); } catch (Exception e) { } finally { db.CerrarConexion(); } return miLista; }
public void TestCambiarEstatusCPP() { Proveedor miProveedor = new Proveedor(); miProveedor.Nombre = "Hiperdental"; NumeroCuentaBanco miCuentaBanco = new NumeroCuentaBanco(); miCuentaBanco.NroCuentaBanco = "847384001"; Abono miAbono = new Abono(); List<Abono> listaAbono = new List<Abono>(); listaAbono.Add(miAbono); Empleado miEmpleado = new Empleado(); CuentaPorPagar miCuentaPP = new CuentaPorPagar("1", "2009/02/02", "2011/03/03", "contado", "activo", "proveedor ", "detallito", 222, 222, miProveedor, miEmpleado, miCuentaBanco, listaAbono); DAOCuentasPorPagar SqlCuentaPP = new DAOCuentasPorPagar(); bool cambio = SqlCuentaPP.CambiarEstatusCpp(miCuentaPP); Assert.IsTrue(cambio); }
public override bool Equals(object obj) { if (obj == null || GetType() != obj.GetType()) { return(false); } Abono miAbono = (Abono)obj; //Listas de este objeto: //retorna si es igual al pasado por parametro, o no: /* * return (this.banco == miCuentaPorPagar.Banco) && (this.detalle == miCuentaPorPagar.Detalle) && (this.estatus == miCuentaPorPagar.Estatus) && (this.fechaEmision == miCuentaPorPagar.FechaEmision) && (this.fechaVencimiento == miCuentaPorPagar.FechaVencimiento) && (this.idCuentaBancaria == miCuentaPorPagar.IdCuentaBancaria) && (this.idCuentaPorPagar == miCuentaPorPagar.IdCuentaPorPagar) && (this.montoActualDeuda == miCuentaPorPagar.MontoActualDeuda) && (this.montoInicialDeuda == miCuentaPorPagar.MontoInicialDeuda) && (this.numeroCuentaBancaria == miCuentaPorPagar.NumeroCuentaBancaria) && (this.tipoCuentaBancaria == miCuentaPorPagar.TipoCuentaBancaria) && (this.tipoDeuda == miCuentaPorPagar.TipoDeuda) && (this.tipoPago == miCuentaPorPagar.TipoPago) * && (this.Equals(miCuentaPorPagar)) * ; * */ return(true); //BORARR AL IMPLEMENMTAR DE VERDAD }
public Entidad ConsultarAbono(Entidad _abono) { String cadenaConexion = ConfigurationManager.ConnectionStrings["ConnUricao"].ToString(); SqlConnection conexion = new SqlConnection(); SqlCommand cmd = new SqlCommand(); SqlDataReader dr; Abono objetoCuenta = new Abono(); //List<Totales> miLista = new List<Totales>(); try { conexion = new SqlConnection(cadenaConexion); conexion.Open(); cmd = new SqlCommand("dbo.consultarAbono", conexion); cmd.CommandType = CommandType.StoredProcedure; SqlParameter param = new SqlParameter("@fechaAbono", (_abono as Abono).FechaAbono); cmd.Parameters.Add(param); SqlParameter param1 = new SqlParameter("@factura", (_abono as Abono).Factura); cmd.Parameters.Add(param1); SqlParameter param2 = new SqlParameter("@cuenta", (_abono as Abono).Cuenta); cmd.Parameters.Add(param2); SqlParameter param3 = new SqlParameter("@monto", (_abono as Abono).MontoAbono); cmd.Parameters.Add(param3); dr = cmd.ExecuteReader(); while (dr.Read()) { (objetoCuenta as Abono).Cuenta = Convert.ToInt32(dr.GetValue(0)); (objetoCuenta as Abono).Deuda = Convert.ToDouble(dr.GetValue(1)); (objetoCuenta as Abono).Factura = Convert.ToInt32(dr.GetValue(2)); (objetoCuenta as Abono).FechaAbono = dr.GetValue(3).ToString(); (objetoCuenta as Abono).MontoAbono = Convert.ToDouble(dr.GetValue(4)); } _bd.CerrarConexion(); } catch (Exception e) { } return objetoCuenta; }
public void testConsultarCuentaPorPagar() { string idCuentaPorPagar = "1"; Proveedor miProveedor = new Proveedor(); miProveedor.Nombre = "Hiperdental"; NumeroCuentaBanco miCuentaBanco = new NumeroCuentaBanco(); miCuentaBanco.NroCuentaBanco = "847384001"; Abono miAbono = new Abono(); List<Abono> listaAbono = new List<Abono>(); listaAbono.Add(miAbono); Empleado miEmpleado = new Empleado(); Entidad miCuentaPP = new CuentaPorPagar("1", "2009/02/02", "2011/03/03", "credito", "activo", "proveedor ", "detallazo", 222, 0, miProveedor, miEmpleado, miCuentaBanco, listaAbono); DAOCuentasPorPagar SqlCuentaPP = new DAOCuentasPorPagar(); Entidad otraCuenta = new CuentaPorPagar(); otraCuenta = SqlCuentaPP.ConsultarCuentaPorPagar(idCuentaPorPagar); Assert.IsNotNull(otraCuenta); Assert.AreEqual(otraCuenta, miCuentaPP); }