Beispiel #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();
                }
            }
        }
Beispiel #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();
         }
     }
 }
Beispiel #3
0
 public static void Update(LoadBalancingMapRow pLoadBalancingMapRow)
 {
     using (Rbr_Db _db = new Rbr_Db()) {
         using (var _tx = new Transaction(_db, pLoadBalancingMapRow)) {
             LoadBalancingMapManager.Update(_db, pLoadBalancingMapRow);
             _tx.Commit();
         }
     }
 }
Beispiel #4
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();
         }
     }
 }
Beispiel #5
0
        //public static LoadBalancingMapViewRow GetView(short pNodeId, short pCustomerAcctId) {
        //  using (Rbr_Db _db = new Rbr_Db()) {
        //    return LoadBalancingMapManager.GetView(_db, pNodeId, pCustomerAcctId);
        //  }
        //}

        //public static LoadBalancingMapRow Get(short pNodeId, short pCustomerAcctId) {
        //  using (Rbr_Db _db = new Rbr_Db()) {
        //    return LoadBalancingMapManager.Get(_db, pNodeId, pCustomerAcctId);
        //  }
        //}

        public static LoadBalancingMapRow[] GetAll(short pNodeId)
        {
            using (var _db = new Rbr_Db()) {
                return(LoadBalancingMapManager.GetAll(_db, pNodeId));
            }
        }
Beispiel #6
0
 public LoadBalancingMapViewRow[] GetAllViewsByCustomerAcctId(short pCustomerAcctId)
 {
     using (var _db = new Rbr_Db()) {
         return(LoadBalancingMapManager.GetAllViews(_db, pCustomerAcctId));
     }
 }