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 static void AddDialPeersForEndpoint(short pEndpointId, string pPrefix, short pCustomerAcctId, RetailType pRetailType) { using (var _db = new Rbr_Db()) { using (var _tx = new Transaction(_db, pEndpointId, pPrefix, pCustomerAcctId, pRetailType)) { var _endpointRow = EndpointManager.Get(_db, pEndpointId); if (_endpointRow == null) { throw new Exception(string.Format("Endpoint NOT FOUND, EndpointId={0}", pEndpointId)); } var _dialPeerRow = CustomerAcctManager.GetDialPeerRow(_db, pEndpointId, pPrefix); if (_dialPeerRow == null) { _dialPeerRow = new DialPeerRow { End_point_id = pEndpointId, Prefix_in = pPrefix, Customer_acct_id = pCustomerAcctId }; CustomerAcctManager.AddDialPeer(_db, _dialPeerRow, _endpointRow); } //-- If Retail, add accessNumber DialPeers if (pRetailType == RetailType.PhoneCard || pRetailType == RetailType.Residential) { var _accessNumberRows = ServiceManager.GetAccessNumbers(_db, pCustomerAcctId); foreach (var _accessNumberRow in _accessNumberRows) { _dialPeerRow = new DialPeerRow { End_point_id = pEndpointId, Prefix_in = _accessNumberRow.Access_number.ToString(), Customer_acct_id = pCustomerAcctId }; CustomerAcctManager.AddDialPeer(_db, _dialPeerRow, _endpointRow); } } _tx.Commit(); } } }
public static EndPointRow GetEndpoint(short pEndPointId) { using (var _db = new Rbr_Db()) { return(EndpointManager.Get(_db, pEndPointId)); } }