public static void AddDialPeerByCountry(CarrierAcctDto pCarrierAcct, EndPointRow pEndPointRow, CountryDto pCountry) { using (var _db = new Rbr_Db()) { using (var _tx = new Transaction(_db, pCarrierAcct, pEndPointRow, pCountry)) { var _countryCarrierRoutes = CarrierAcctManager.GetByCarrierAcctIdCountryId(_db, pCarrierAcct.CarrierAcctId, pCountry.CountryId); var _list = new ArrayList(); foreach (var _carrierRouteRow in _countryCarrierRoutes) { var _carrierAcctEPMapRow = new CarrierAcctEPMapRow { Carrier_acct_id = pCarrierAcct.CarrierAcctId, Carrier_route_id = _carrierRouteRow.Carrier_route_id, End_point_id = pEndPointRow.End_point_id, Priority = 0 }; if (!_list.Contains(_carrierAcctEPMapRow)) { _list.Add(_carrierAcctEPMapRow); } } if (_list.Count > 0) { var _carrierAcctEPMapRows = (CarrierAcctEPMapRow[])_list.ToArray(typeof(CarrierAcctEPMapRow)); foreach (var _carrierAcctEPMapRow in _carrierAcctEPMapRows) { CarrierAcctManager.AddDialPeer(_db, _carrierAcctEPMapRow, pEndPointRow); } } _tx.Commit(); } } }
public static void UpdateEndpoint(EndPointRow pEndPointRow, EndpointContext pEndpointContext) { //pEndpointContext.TransactionType = TxType.Delete; using (var _db = new Rbr_Db()) { using (var _tx = new Transaction(_db, pEndPointRow, pEndpointContext)) { var _original = EndpointManager.Get(_db, pEndPointRow.End_point_id); EndpointManager.Update(_db, _original, pEndPointRow); if (pEndpointContext.CarrierAcctEPMapRowToDelete != null) { foreach (var _carrierAcctEPMapRow in pEndpointContext.CarrierAcctEPMapRowToDelete) { CarrierAcctManager.DeleteDialPeer(_db, _carrierAcctEPMapRow, pEndPointRow); } } if (pEndpointContext.CarrierAcctEPMapRowToAdd != null) { foreach (var _carrierAcctEPMapRow in pEndpointContext.CarrierAcctEPMapRowToAdd) { if (_carrierAcctEPMapRow.Carrier_acct_EP_map_id <= 0) { _carrierAcctEPMapRow.End_point_id = pEndPointRow.End_point_id; CarrierAcctManager.AddDialPeer(_db, _carrierAcctEPMapRow, pEndPointRow); } } } _tx.Commit(); } } }
public void AddRoutes(short pAccountId, int[] pBaseRouteIds, ViewContext pContext) { using (var _db = new Rbr_Db()) { using (var _tx = new Transaction(_db, pAccountId, pBaseRouteIds, pContext)) { if (pContext == ViewContext.Carrier) { var _carrierAcct = CarrierAcctManager.GetAcct(_db, pAccountId); CarrierRouteManager.Add(_db, _carrierAcct, pBaseRouteIds); } else if (pContext == ViewContext.Customer) { //NOTE: same as ServiceDialPlan CustomerRouteManager.Add(_db, pAccountId, pBaseRouteIds); } else if (pContext == ViewContext.Service) { //NOTE: same as CustomerDialPlan CustomerRouteManager.Add(_db, pAccountId, pBaseRouteIds); } else { throw new NotImplementedException("ViewContext: " + pContext); } _tx.Commit(); } } }
public static void DeleteOutboundANIEntries(OutboundANIRow[] pOutboundANIRows) { using (Rbr_Db _db = new Rbr_Db()) { using (Transaction _tx = new Transaction(_db, pOutboundANIRows)) { CarrierAcctManager.DeleteOutboundANIEntries(_db, pOutboundANIRows); _tx.Commit(); } } }
public static void UpdateAcct(CarrierAcctDto pCarrierAcct) { using (var _db = new Rbr_Db()) { using (var _tx = new Transaction(_db, pCarrierAcct)) { CarrierAcctManager.UpdateCarrierAcct(_db, pCarrierAcct); _tx.Commit(); } } }
public static void AddOutboundANI(OutboundANIRow pOutboundANIRow) { using (Rbr_Db _db = new Rbr_Db()) { using (Transaction _tx = new Transaction(_db, pOutboundANIRow)) { CarrierAcctManager.AddOutboundANI(_db, pOutboundANIRow); _tx.Commit(); } } }
public static void DeleteDialPeerByRoute(CarrierAcctDto pCarrierAcct, EndPointRow pEndPointRow, RatedRouteDto pCarrierRoute) { using (var _db = new Rbr_Db()) { using (var _tx = new Transaction(_db, pCarrierAcct, pEndPointRow, pCarrierRoute)) { var _carrierAcctEPMapRow = CarrierAcctManager.GetDialPeer(_db, pCarrierAcct.CarrierAcctId, pEndPointRow.End_point_id, pCarrierRoute.RatedRouteId); CarrierAcctManager.DeleteDialPeer(_db, _carrierAcctEPMapRow, pEndPointRow); _tx.Commit(); } } }
protected CarrierAcctDto getCarrierAcct(Rbr_Db _db) { CarrierAcctDto _carrierAcct = CarrierAcctManager.GetAcct(_db, args.AccountId); if (_carrierAcct == null) { throw new Exception("CarrierAcct not found [Id: " + args.AccountId + "]"); } return(_carrierAcct); }
public static void AddEndpoint(EndPointRow pEndPointRow, EndpointContext pEndpointContext) { using (var _db = new Rbr_Db()) { using (var _tx = new Transaction(_db, pEndPointRow, pEndpointContext)) { //TODO: NEW DAL - VirtualSwitch pEndPointRow.Virtual_switch_id = AppConstants.DefaultVirtualSwitchId; EndpointManager.Add(_db, pEndPointRow, pEndpointContext); //CarrierAcctManager.AddDialPeer(_db, pEndPointRow, pEndpointContext); if (pEndpointContext.CarrierAcctEPMapRowToAdd != null && pEndpointContext.CarrierAcctEPMapRowToAdd.Length > 0) { foreach (var _carrierAcctEPMapRow in pEndpointContext.CarrierAcctEPMapRowToAdd) { _carrierAcctEPMapRow.End_point_id = pEndPointRow.End_point_id; CarrierAcctManager.AddDialPeer(_db, _carrierAcctEPMapRow, pEndPointRow); } } if (pEndpointContext.CustomerAcct != null) { if (pEndpointContext.CustomerAcct.ServiceDto.AccessNumbers != null && pEndpointContext.CustomerAcct.ServiceDto.AccessNumbers.Length > 0) { foreach (var _accessNumber in pEndpointContext.CustomerAcct.ServiceDto.AccessNumbers) { var _newDialPeer = new DialPeerRow { End_point_id = pEndPointRow.End_point_id, Prefix_in = _accessNumber.Number.ToString(), Customer_acct_id = pEndpointContext.CustomerAcct.CustomerAcctId }; CustomerAcctManager.AddDialPeer(_db, _newDialPeer, pEndPointRow); } } else { var _newDialPeer = new DialPeerRow { End_point_id = pEndPointRow.End_point_id, Prefix_in = pEndpointContext.CustomerAcct.PrefixIn, Customer_acct_id = pEndpointContext.CustomerAcct.CustomerAcctId }; CustomerAcctManager.AddDialPeer(_db, _newDialPeer, pEndPointRow); } } _tx.Commit(); } } }
public static void DeleteDialPeerByCountry(CarrierAcctDto pCarrierAcct, EndPointRow pEndPointRow, CountryDto pCountry) { using (var _db = new Rbr_Db()) { using (var _tx = new Transaction(_db, pCarrierAcct, pEndPointRow, pCountry)) { //CarrierAcctManager.DeleteDialPeerByCountry(_db, pCarrierAcct, pCountry, pEndPointRow); var _countryCarrierRoutes = CarrierAcctManager.GetByCarrierAcctIdCountryId(_db, pCarrierAcct.CarrierAcctId, pCountry.CountryId); var _carrierAcctEPMapRows = CarrierAcctManager.GetByCountry(_db, _countryCarrierRoutes, pCarrierAcct.CarrierAcctId, pEndPointRow.End_point_id); foreach (var _carrierAcctEPMapRow in _carrierAcctEPMapRows) { CarrierAcctManager.DeleteDialPeer(_db, _carrierAcctEPMapRow, pEndPointRow); } _tx.Commit(); } } }
public static void AddAcct(CarrierAcctDto pCarrierAcct, int[] pSelectedBaseRouteIds) { using (Rbr_Db _db = new Rbr_Db()) { using (Transaction _tx = new Transaction(_db, pCarrierAcct, pSelectedBaseRouteIds)) { CarrierAcctManager.AddCarrierAcct(_db, pCarrierAcct); //Create Default Route int _defaultCarrierRouteId; CarrierRouteManager.Add(_db, pCarrierAcct, 0, out _defaultCarrierRouteId); pCarrierAcct.DefaultRoute.RatedRouteId = _defaultCarrierRouteId; CarrierRouteManager.Add(_db, pCarrierAcct, pSelectedBaseRouteIds); _tx.Commit(); } } }
public static void AddDialPeerByRoute(CarrierAcctDto pCarrierAcct, EndPointRow pEndPointRow, RatedRouteDto pCarrierRoute) { using (var _db = new Rbr_Db()) { using (var _tx = new Transaction(_db, pCarrierAcct, pEndPointRow, pCarrierRoute)) { var _carrierAcctEPMapRow = new CarrierAcctEPMapRow { Carrier_acct_id = pCarrierAcct.CarrierAcctId, Carrier_route_id = pCarrierRoute.RatedRouteId, End_point_id = pEndPointRow.End_point_id, Priority = 0 }; CarrierAcctManager.AddDialPeer(_db, _carrierAcctEPMapRow, pEndPointRow); _tx.Commit(); } } }
public static void DeleteEndpoint(EndPointRow pEndPointRow) { using (var _db = new Rbr_Db()) { using (var _tx = new Transaction(_db, pEndPointRow)) { CustomerAcctManager.DeleteDialPeersByEndpointId(_db, pEndPointRow.End_point_id); //- Delete Carrier Dialpeers var _dialPeers = _db.CarrierAcctEPMapCollection.GetByEnd_point_id(pEndPointRow.End_point_id); if (_dialPeers != null && _dialPeers.Length > 0) { foreach (var _carrierAcctEPMapRow in _dialPeers) { CarrierAcctManager.DeleteDialPeer(_db, _carrierAcctEPMapRow, pEndPointRow); } } EndpointManager.Delete(_db, pEndPointRow); _tx.Commit(); } } }
public static void Delete(PartnerDto pPartner) { using (Rbr_Db _db = new Rbr_Db()) { using (Transaction _tx = new Transaction(_db, pPartner)) { if (CustomerAcctManager.Exist(_db, pPartner.PartnerId)) { throw new ApplicationException("Partner has Customer Account(s).\r\nCannot delete."); } if (CarrierAcctManager.Exist(_db, pPartner.PartnerId)) { throw new ApplicationException("Partner has Carrier Account(s).\r\nCannot delete."); } //TODO: NEW DAL !!! //ResellAcctManager.DeleteByPartnerId(_db, pPartner.PartnerId); PersonManager.DeleteByPartnerId(_db, pPartner.PartnerId); PartnerManager.Delete(_db, pPartner); _tx.Commit(); } } }
public static int GetUsageCount(int pCallingPlanId) { using (Rbr_Db _db = new Rbr_Db()) { return(CarrierAcctManager.GetUsageCount(_db, pCallingPlanId)); } }
public static IList GetAllOutboundANIEntries(int pCarrierRouteId) { using (Rbr_Db _db = new Rbr_Db()) { return(CarrierAcctManager.GetAllOutboundANIEntries(_db, pCarrierRouteId)); } }
public static CarrierAcctEPMapRow[] GetDialPeers(int pCarrierRouteId) { using (Rbr_Db _db = new Rbr_Db()) { return(CarrierAcctManager.GetDialPeers(_db, pCarrierRouteId)); } }
public static CarrierAcctEPMapRow[] GetDialPeers(short pEndPointId) { using (Rbr_Db _db = new Rbr_Db()) { return(CarrierAcctManager.GetDialPeers(_db, pEndPointId)); } }
public static CarrierAcctEPMapRow GetDialPeer(short pCarrierActId, short pEndPointId, int pCarrierRouteId) { using (Rbr_Db _db = new Rbr_Db()) { return(CarrierAcctManager.GetDialPeer(_db, pCarrierActId, pEndPointId, pCarrierRouteId)); } }
public static CarrierAcctDto[] GetAccts(int pPartnerId) { using (Rbr_Db _db = new Rbr_Db()) { return(CarrierAcctManager.GetAccts(_db, pPartnerId)); } }
public static CarrierAcctDto[] GetAccts() { using (Rbr_Db _db = new Rbr_Db()) { return(CarrierAcctManager.GetAccts(_db)); } }
public static CarrierAcctDto GetAcct(short pCarrierAcctId) { using (Rbr_Db _db = new Rbr_Db()) { return(CarrierAcctManager.GetAcct(_db, pCarrierAcctId)); } }
public static bool IsNameInUseByOtherAcct(string pName, short pCarrierAcctId) { using (Rbr_Db _db = new Rbr_Db()) { return(CarrierAcctManager.IsNameInUseByOtherCarrierAcct(_db, pName, pCarrierAcctId)); } }