示例#1
0
        public static void UpdateAcct(CustomerAcctDto pCustomerAcct)
        {
            using (var _db = new Rbr_Db()) {
                using (var _tx = new Transaction(_db, pCustomerAcct)) {
                    CustomerAcctRow _original = CustomerAcctManager.Get(_db, pCustomerAcct.CustomerAcctId);

                    if (pCustomerAcct.ServiceDto.IsDedicated)
                    {
                        //-- Dedicated, make sure dp's name is created by cust's name
                        pCustomerAcct.ServiceDto.Name = AppConstants.CustomerServiceNamePrefix + pCustomerAcct.Name;

                        //-- Make sure RoutingPlan is the same for Dedicated Service
                        pCustomerAcct.ServiceDto.DefaultRoutingPlan = pCustomerAcct.RoutingPlan;
                        ServiceManager.UpdateService(_db, pCustomerAcct.ServiceDto);
                    }

                    ServiceManager.SaveAccessNumbers(_db, pCustomerAcct);
                    CustomerAcctManager.UpdateAcct(_db, pCustomerAcct);

                    if (pCustomerAcct.PrefixIn != _original.Prefix_in)
                    {
                        CustomerAcctManager.UpdateCustomerDialPeers(_db, pCustomerAcct.CustomerAcctId, pCustomerAcct.PrefixIn, _original.Prefix_in);
                    }

                    if (pCustomerAcct.ResellAccount != null)
                    {
                        CustomerAcctManager.UpdateResellAccount(_db, pCustomerAcct.ResellAccount);
                    }

                    #region TODO: for the next rev

                    //if (CurrentNode.Instance.BelongsToStandalonePlatform) {
                    //  //add LB Map for the actual acct only, not the resell one
                    //  LoadBalancingMapManager.Add(_db, CurrentNode.Instance.Id, pCustomerAcct.CustomerAcctId);
                    //}
                    //else {
                    //  //TODO: !!!!! review it
                    //  //							if ( ! _original.IsPrepaid && pCustomerAcct.CustomerAcctRow.IsPrepaid) {
                    //  //								//TODO: check the logic
                    //  //								//if changed to Prepaid - delete all LB Maps
                    //  //								//user will need to pick Node manually
                    //  //								_db.LoadBalancingMapCollection.DeleteByCustomer_acct_id(pCustomerAcct.CustomerAcctRow.Customer_acct_id);
                    //  //							}
                    //}

                    #endregion for the next rev

                    _tx.Commit();
                }
            }
        }
示例#2
0
        public static void Credit(PersonDto pPerson, CustomerAcctPaymentDto pCustomerAcctPayment)
        {
            using (var _db = new Rbr_Db()) {
                using (var _tx = new Transaction(_db, pPerson, pCustomerAcctPayment)) {
                    pCustomerAcctPayment.DateTime = DateTime.Now;
                    //NOTE: make sure we got prev amnt
                    CustomerAcctRow _customerAcctRow = CustomerAcctManager.Get(_db, pCustomerAcctPayment.CustomerAcctId);
                    pCustomerAcctPayment.PreviousAmount = _customerAcctRow.Current_amount;
                    pCustomerAcctPayment.Person         = pPerson;
                    CustomerAcctManager.Credit(_db, pCustomerAcctPayment);
                    _tx.Commit();

                    PartnerDto     _partner     = PartnerManager.Get(_db, _customerAcctRow.Partner_id);
                    ContactInfoDto _contactInfo = ContactInfoManager.Get(_db, _partner.ContactInfo.ContactInfoId);
                    sendNotification(pPerson, pCustomerAcctPayment, _customerAcctRow, _partner, _contactInfo);
                }
            }
        }