/// <summary> /// Deprecated Method for adding a new object to the Abonos EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToAbonos(Abono abono) { base.AddObject("Abonos", abono); }
/// <summary> /// Create a new Abono object. /// </summary> /// <param name="abonoId">Initial value of the AbonoId property.</param> /// <param name="payCenterId">Initial value of the PayCenterId property.</param> /// <param name="bancoId">Initial value of the BancoId property.</param> /// <param name="cuentaBancariaId">Initial value of the CuentaBancariaId property.</param> /// <param name="monto">Initial value of the Monto property.</param> /// <param name="fechaPago">Initial value of the FechaPago property.</param> /// <param name="referencia">Initial value of the Referencia property.</param> /// <param name="status">Initial value of the Status property.</param> /// <param name="fechaCreacion">Initial value of the FechaCreacion property.</param> /// <param name="baja">Initial value of the Baja property.</param> /// <param name="cuentaId">Initial value of the CuentaId property.</param> /// <param name="proveedorId">Initial value of the ProveedorId property.</param> public static Abono CreateAbono(global::System.Int32 abonoId, global::System.Int32 payCenterId, global::System.Int32 bancoId, global::System.Int32 cuentaBancariaId, global::System.Decimal monto, global::System.DateTime fechaPago, global::System.String referencia, global::System.Int16 status, global::System.DateTime fechaCreacion, global::System.Boolean baja, global::System.Int32 cuentaId, global::System.Int16 proveedorId) { Abono abono = new Abono(); abono.AbonoId = abonoId; abono.PayCenterId = payCenterId; abono.BancoId = bancoId; abono.CuentaBancariaId = cuentaBancariaId; abono.Monto = monto; abono.FechaPago = fechaPago; abono.Referencia = referencia; abono.Status = status; abono.FechaCreacion = fechaCreacion; abono.Baja = baja; abono.CuentaId = cuentaId; abono.ProveedorId = proveedorId; return abono; }
public ActionResult Confirm(AbonoVM model) { bool exito = true; if (!(validations.IsValidReferenciaDeposito(model.Referencia, model.BancoId))) { //todo:Preguntar de esta validacion AddValidationMessage(enumMessageType.BRException, "La referencia especificada ya existe en el sistema. Favor de verificarla."); exito = false; } if (Convert.ToDateTime(model.FechaPago).CompareTo(DateTime.UtcNow.GetCurrentTime()) == 1) { AddValidationMessage(enumMessageType.BRException, "La fecha de depósito debe ser menor o igual a la fecha actual."); exito = false; } if (exito) { if (ModelState.IsValid) { PaycenterBR payCenterBR = new PaycenterBR(); model.CuentaId=payCenterBR.GetOrCreateCuentaPayCenter(PayCenterId, model.TipoCuenta,model.ProveedorId); Abono abono = new Abono { BancoId = model.BancoId, CuentaBancariaId = model.CuentaBancariaId, CuentaId = model.CuentaId, Status = (Int16)enumEstatusMovimiento.Procesando, FechaCreacion = DateTime.UtcNow.GetCurrentTime(), FechaPago = (DateTime)model.FechaPago, Monto = (Decimal)model.Monto, PayCenterId = PayCenterId, Referencia = model.Referencia, RutaFichaDeposito = model.RutaFichaDeposito, ProveedorId = (short)model.ProveedorId }; repository.Add(abono); EstadoCuentaBR estadoCuentaBR = new EstadoCuentaBR(repository.context); var movimiento = estadoCuentaBR.CrearMovimiento(PayCenterId, enumTipoMovimiento.Abono, model.AbonoId, model.CuentaId, (Decimal)model.Monto, enumMotivo.Deposito, PayCenterName); abono.Clave = movimiento.Clave; exito = repository.Save(); //Julius: Tuve que guardar otra vez para guardar el abonoId generado en la BD estadoCuentaBR.ActualizaReferenciaIdMovimiento(movimiento.MovimientoId, abono.AbonoId); repository.Save(); model.AbonoId = abono.AbonoId; AddValidationMessage(enumMessageType.Succeed, "Se ha registrado su depósito con éxito con clave " + movimiento.Clave + ". En breve será revisado y aplicado."); } } else { AddValidationMessage(enumMessageType.BRException, "No fue posible guardar el reporte de depósito."); } model.FechaCreacion = DateTime.UtcNow.GetCurrentTime(); return View(model); }