Exemplo n.º 1
0
        public static void DeleteAcct(CustomerAcctDto pCustomerAcct)
        {
            using (var _db = new Rbr_Db()) {
                using (var _tx = new Transaction(_db, pCustomerAcct)) {
                    //TODO: HasCDRs should become CustomerAcct property !!!
                    if (CDRController.HasCDRsByCustomerAcctId(pCustomerAcct.CustomerAcctId))
                    {
                        pCustomerAcct.Status = Status.Archived;
                        CustomerAcctManager.UpdateAcct(_db, pCustomerAcct);
                        return;
                    }

                    LoadBalancingMapManager.Delete(_db, pCustomerAcct);

                    if (pCustomerAcct.ServiceType == ServiceType.Retail)
                    {
                        int _retailAcctsCount = RetailAccountManager.Instance.GetCount(_db, pCustomerAcct.CustomerAcctId);
                        if (_retailAcctsCount > 0)
                        {
                            throw new Exception("Cannot delete Customer Account, it has Retail Accounts.");
                        }
                        ServiceManager.SaveAccessNumbers(_db, pCustomerAcct);                         //delete/unassign CustomerAcct's AccessNumbers...
                    }

                    CustomerAcctManager.DeleteResellAccountByCustomerAcctId(_db, pCustomerAcct.CustomerAcctId);
                    CustomerAcctManager.DeleteDialPeersByCustomerAcctId(_db, pCustomerAcct.CustomerAcctId);
                    CustomerAcctManager.DeleteAcct(_db, pCustomerAcct.CustomerAcctId);

                    //if (pCustomerAcct.ServiceDto.IsDedicated) {
                    //	ServiceManager.DeleteService(_db, pCustomerAcct.ServiceDto);
                    //}
                    _tx.Commit();
                }
            }
        }
Exemplo n.º 2
0
 public static void DeleteByCustomerAcct(CustomerAcctDto pCustomerAcct)
 {
     using (Rbr_Db _db = new Rbr_Db()) {
         using (Transaction _tx = new Transaction(_db, pCustomerAcct)) {
             LoadBalancingMapManager.Delete(_db, pCustomerAcct);
             _tx.Commit();
         }
     }
 }
Exemplo n.º 3
0
 public static void Delete(NodeViewRow pNodeViewRow, CustomerAcctDto pCustomerAcct)
 {
     using (Rbr_Db _db = new Rbr_Db()) {
         using (Transaction _tx = new Transaction(_db, pNodeViewRow, pCustomerAcct)) {
             LoadBalancingMapRow _loadBalancingMapRow = LoadBalancingMapManager.Get(_db, pNodeViewRow.Node_id, pCustomerAcct.CustomerAcctId);
             LoadBalancingMapManager.Delete(_db, _loadBalancingMapRow);
             _tx.Commit();
         }
     }
 }