コード例 #1
0
 public void AdjustAccountBalance(Guid costCentreId, PaymentMode paymentMode, decimal amount,PaymentNoteType type)
 {
    
     tblPaymentTracker tblpn = _ctx.tblPaymentTracker.FirstOrDefault(n => n.CostCenterId == costCentreId && n.PaymentModeId == (int)paymentMode);
    if(tblpn==null)
    {
        Guid id = Guid.NewGuid();
        tblPaymentTracker pnsave = new tblPaymentTracker
                                       {
                                           Balance = 0,
                                           CostCenterId = costCentreId,
                                           id = id,
                                           PaymentModeId = (int) paymentMode,
                                           PendingConfirmBalance = 0,
                                       };
        _ctx.tblPaymentTracker.AddObject(pnsave);
        _ctx.SaveChanges();
        tblpn = _ctx.tblPaymentTracker.FirstOrDefault(n => n.id == id);
    }
    if (type==PaymentNoteType.Availabe )
        tblpn.Balance += amount;
    else if (type == PaymentNoteType.Unavailable)
        tblpn.PendingConfirmBalance += amount;
    else if (type ==PaymentNoteType.Returns)
    {
        tblpn.Balance += -amount;
        tblpn.PendingConfirmBalance += (-amount);
    }
    
     _ctx.SaveChanges();
 }
コード例 #2
0
 private PaymentTracker Map(tblPaymentTracker tblAccount)
 {
     PaymentTracker acc = new PaymentTracker(tblAccount.id)
     {
        
         CostcentreId = tblAccount.CostCenterId,
         Balance = (decimal)tblAccount.Balance,
         PaymentMode = (PaymentMode)tblAccount.PaymentModeId,
         PendingConfirmBalance = tblAccount.PendingConfirmBalance.Value,
     };
     return acc;
 }
コード例 #3
0
 private PaymentTrackerDTO Map(tblPaymentTracker tbl)
 {
     var dto = new PaymentTrackerDTO
     {
         MasterId = tbl.id,
         CostcentreId = tbl.CostCenterId,
         PaymentModeId = tbl.PaymentModeId,
         Balance = tbl.Balance.HasValue ? tbl.Balance.Value : 0,
         PendingConfirmBalance = tbl.PendingConfirmBalance.HasValue?tbl.PendingConfirmBalance.Value:0
         
     };
     return dto;
 }
コード例 #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tblPaymentTracker EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotblPaymentTracker(tblPaymentTracker tblPaymentTracker)
 {
     base.AddObject("tblPaymentTracker", tblPaymentTracker);
 }
コード例 #5
0
 /// <summary>
 /// Create a new tblPaymentTracker object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="costCenterId">Initial value of the CostCenterId property.</param>
 /// <param name="paymentModeId">Initial value of the PaymentModeId property.</param>
 public static tblPaymentTracker CreatetblPaymentTracker(global::System.Guid id, global::System.Guid costCenterId, global::System.Int32 paymentModeId)
 {
     tblPaymentTracker tblPaymentTracker = new tblPaymentTracker();
     tblPaymentTracker.id = id;
     tblPaymentTracker.CostCenterId = costCenterId;
     tblPaymentTracker.PaymentModeId = paymentModeId;
     return tblPaymentTracker;
 }
コード例 #6
0
 public void Save(PaymentTracker paymentTracker)
 {
     tblPaymentTracker tblpn = _ctx.tblPaymentTracker.FirstOrDefault(n => n.id == paymentTracker.Id);
     if (tblpn == null)
     {
         tblpn = new tblPaymentTracker();
         tblpn.id = paymentTracker.Id;
         _ctx.tblPaymentTracker.AddObject(tblpn);
     }
     tblpn.Balance = paymentTracker.Balance;
     tblpn.CostCenterId = paymentTracker.CostcentreId;
     tblpn.PaymentModeId = (int) paymentTracker.PaymentMode;
     tblpn.PendingConfirmBalance = paymentTracker.PendingConfirmBalance;
     _ctx.SaveChanges();
 }