Beispiel #1
0
        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();
                }
            }
        }