Beispiel #1
0
 internal void Credit(Rbr_Db pDb, RetailAccountPaymentDto pRetailAccountPayment)
 {
     if (!pDb.RetailAccountCollection.Credit(pRetailAccountPayment.RetailAcctId, pRetailAccountPayment.Amount, pRetailAccountPayment.AddedBonusMinutes))
     {
         throw new ApplicationException("Failed to Credit Retail Account; RetailAcctId: " + pRetailAccountPayment.RetailAcctId);
     }
 }
        public static void Credit(PersonDto pPerson, RetailAccountPaymentDto pRetailAccountPayment)
        {
            using (var _db = new Rbr_Db()) {
                using (var _tx = new Transaction(_db, pRetailAccountPayment)) {
                    //NOTE: make sure we got prev amnt
                    RetailAccountRow _retailAccountRow = _db.RetailAccountCollection.GetByPrimaryKey(pRetailAccountPayment.RetailAcctId);
                    pRetailAccountPayment.DateTime             = DateTime.Now;
                    pRetailAccountPayment.PreviousAmount       = _retailAccountRow.Current_balance;
                    pRetailAccountPayment.PreviousBonusMinutes = _retailAccountRow.Current_bonus_minutes;
                    pRetailAccountPayment.Person = pPerson;

                    RetailAccountManager.Instance.Credit(_db, pRetailAccountPayment);
                    RetailAccountManager.Add(_db, pRetailAccountPayment);
                    _tx.Commit();
                }
            }
        }
Beispiel #3
0
        static RetailAccountPaymentDto mapToRetailAccountPayment(RetailAccountPaymentRow pRetailAccountPaymentRow, PersonDto pPerson, BalanceAdjustmentReasonDto pBalanceAdjustmentReason)
        {
            var _retailAccountPayment = new RetailAccountPaymentDto();

            _retailAccountPayment.DateTime                = pRetailAccountPaymentRow.Date_time;
            _retailAccountPayment.RetailAcctId            = pRetailAccountPaymentRow.Retail_acct_id;
            _retailAccountPayment.PreviousAmount          = pRetailAccountPaymentRow.Previous_amount;
            _retailAccountPayment.Amount                  = pRetailAccountPaymentRow.Payment_amount;
            _retailAccountPayment.PreviousBonusMinutes    = pRetailAccountPaymentRow.Previous_bonus_minutes;
            _retailAccountPayment.AddedBonusMinutes       = pRetailAccountPaymentRow.Added_bonus_minutes;
            _retailAccountPayment.Comments                = pRetailAccountPaymentRow.Comments;
            _retailAccountPayment.BalanceAdjustmentReason = pBalanceAdjustmentReason;
            _retailAccountPayment.Person                  = pPerson;
            _retailAccountPayment.CdrKey                  = pRetailAccountPaymentRow.Cdr_key;

            return(_retailAccountPayment);
        }
Beispiel #4
0
        static RetailAccountPaymentRow mapToRetailAccountPaymentRow(RetailAccountPaymentDto pRetailAccountPayment)
        {
            var _retailAccountPaymentRow = new RetailAccountPaymentRow();

            _retailAccountPaymentRow.Date_time              = pRetailAccountPayment.DateTime;
            _retailAccountPaymentRow.Retail_acct_id         = pRetailAccountPayment.RetailAcctId;
            _retailAccountPaymentRow.Previous_amount        = pRetailAccountPayment.PreviousAmount;
            _retailAccountPaymentRow.Payment_amount         = pRetailAccountPayment.Amount;
            _retailAccountPaymentRow.Previous_bonus_minutes = pRetailAccountPayment.PreviousBonusMinutes;
            _retailAccountPaymentRow.Added_bonus_minutes    = pRetailAccountPayment.AddedBonusMinutes;
            _retailAccountPaymentRow.Comments = pRetailAccountPayment.Comments;
            _retailAccountPaymentRow.Balance_adjustment_reason_id = pRetailAccountPayment.BalanceAdjustmentReasonId;
            _retailAccountPaymentRow.Person_id = pRetailAccountPayment.PersonId;
            _retailAccountPaymentRow.Cdr_key   = pRetailAccountPayment.CdrKey;

            return(_retailAccountPaymentRow);
        }
Beispiel #5
0
 internal static void Add(Rbr_Db pDb, RetailAccountPaymentDto pRetailAccountPayment)
 {
     pDb.RetailAccountPaymentCollection.Insert(mapToRetailAccountPaymentRow(pRetailAccountPayment));
 }