Beispiel #1
0
        internal static void UpdateCallingPlan(Rbr_Db pDb, CallingPlanDto pCallingPlan)
        {
            var _callingPlanRow = mapToCallingPlanRow(pCallingPlan);

            pDb.CallingPlanCollection.Update(_callingPlanRow);
            //pDb.AddChangedObject(new CallingPlanKey(TxType.Delete, _callingPlanRow.Calling_plan_id));
            pCallingPlan.Version = _callingPlanRow.Version;
        }
Beispiel #2
0
        internal static void DeleteCallingPlan(Rbr_Db pDb, CallingPlanDto pCallingPlan)
        {
            var _callingPlanRow = mapToCallingPlanRow(pCallingPlan);

            pDb.DialCodeCollection.DeleteByCalling_plan_id(_callingPlanRow.Calling_plan_id);
            pDb.RouteCollection.DeleteByCalling_plan_id(_callingPlanRow.Calling_plan_id);
            pDb.CallingPlanCollection.Delete(_callingPlanRow);
            //pDb.AddChangedObject(new CallingPlanKey(TxType.Delete, _callingPlanRow.Calling_plan_id));
        }
 public static void AddCountriesToCallingPlan(CallingPlanDto pCallingPlan, CountryDto[] pSelectedCountries)
 {
     using (var _db = new Rbr_Db()) {
         using (var _tx = new Transaction(_db, pCallingPlan, pSelectedCountries)) {
             CallingPlanManager.AddCountriesToCallingPlan(_db, pCallingPlan, pSelectedCountries);
             _tx.Commit();
         }
     }
 }
 public static void DeleteCallingPlan(CallingPlanDto pCallingPlan)
 {
     using (var _db = new Rbr_Db()) {
         using (var _tx = new Transaction(_db, pCallingPlan)) {
             CallingPlanManager.DeleteCallingPlan(_db, pCallingPlan);
             _tx.Commit();
         }
     }
 }
Beispiel #5
0
        static CallingPlanRow mapToCallingPlanRow(CallingPlanDto pCallingPlan)
        {
            var _callingPlanRow = new CallingPlanRow();

            _callingPlanRow.Calling_plan_id   = pCallingPlan.CallingPlanId;
            _callingPlanRow.Name              = pCallingPlan.Name;
            _callingPlanRow.Virtual_switch_id = pCallingPlan.VirtualSwitchId;
            _callingPlanRow.Version           = pCallingPlan.Version;
            return(_callingPlanRow);
        }
Beispiel #6
0
        internal static CallingPlanDto mapToCallingPlan(CallingPlanRow pCallingPlanRow)
        {
            var _callingPlan = new CallingPlanDto();

            _callingPlan.CallingPlanId   = pCallingPlanRow.Calling_plan_id;
            _callingPlan.Name            = pCallingPlanRow.Name;
            _callingPlan.VirtualSwitchId = pCallingPlanRow.Virtual_switch_id;
            _callingPlan.Version         = pCallingPlanRow.Version;
            return(_callingPlan);
        }
Beispiel #7
0
        internal static void AddCallingPlan(Rbr_Db pDb, CallingPlanDto pCallingPlan)
        {
            pCallingPlan.VirtualSwitchId = AppConstants.DefaultVirtualSwitchId;

            var _callingPlanRow = mapToCallingPlanRow(pCallingPlan);

            pDb.CallingPlanCollection.Insert(_callingPlanRow);
            pCallingPlan.CallingPlanId = _callingPlanRow.Calling_plan_id;
            pCallingPlan.Version       = _callingPlanRow.Version;
        }
Beispiel #8
0
 internal static void AddCountriesToCallingPlan(Rbr_Db pDb, CallingPlanDto pCallingPlan, CountryDto[] pSelectedCountries)
 {
     foreach (var _country in pSelectedCountries)
     {
         var _properBaseRoute = new BaseRouteDto
         {
             BaseStatus  = Status.Active,
             CallingPlan = pCallingPlan,
             Country     = _country,
             Name        = string.Concat(_country.Name, AppConstants.SubRouteSeparator, AppConstants.ProperNameSuffix),
             Version     = 0
         };
         RoutingManager.AddBaseRoute(pDb, _properBaseRoute);
     }
 }
        static List <BaseRouteDto> getBaseRouteList(Rbr_Db pDb, CallingPlanDto pCallingPlan, IEnumerable <RouteRow> pRouteRows)
        {
            var _routeList = new List <BaseRouteDto>();

            foreach (var _routeRow in pRouteRows)
            {
                var _country = CallingPlanManager.GetCountry(pDb, _routeRow.Country_id);

                var _dialCodeCount = CallingPlanManager.GetDialCodeCount(pDb, _routeRow.Route_id);
                var _routeState    = (_dialCodeCount > 0) ? RouteState.Valid : RouteState.NoDialCodes;

                var _route = mapToBaseRoute(_routeRow, _country, pCallingPlan, _routeState);
                _routeList.Add(_route);
            }
            return(_routeList);
        }
Beispiel #10
0
        static RoutingPlanDto mapToRoutingPlan(RoutingPlanRow_Base pRoutingPlanRow, CallingPlanDto pCallingPlan)
        {
            if (pRoutingPlanRow == null)
            {
                return(null);
            }

            var _routingPlan = new RoutingPlanDto();

            _routingPlan.RoutingPlanId   = pRoutingPlanRow.Routing_plan_id;
            _routingPlan.Name            = pRoutingPlanRow.Name;
            _routingPlan.CallingPlan     = pCallingPlan;
            _routingPlan.VirtualSwitchId = pRoutingPlanRow.Virtual_switch_id;

            return(_routingPlan);
        }
Beispiel #11
0
        static BaseRouteDto mapToBaseRoute(RouteRow pRouteRow, CountryDto pCountry, CallingPlanDto pCallingPlan, RouteState pRouteState)
        {
            if (pRouteRow == null)
            {
                return(null);
            }

            var _baseRoute = new BaseRouteDto();

            _baseRoute.BaseRouteId   = pRouteRow.Route_id;
            _baseRoute.Name          = pRouteRow.Name;
            _baseRoute.BaseStatus    = pRouteRow.RouteStatus;
            _baseRoute.CallingPlan   = pCallingPlan;
            _baseRoute.Country       = pCountry;
            _baseRoute.RoutingNumber = pRouteRow.Routing_number;
            _baseRoute.Version       = pRouteRow.Version;
            _baseRoute.RouteState    = pRouteState;

            return(_baseRoute);
        }
Beispiel #12
0
        static CarrierAcctDto mapToCarrierAcct(CarrierAcctRow pCarrierAcctRow, PartnerDto pPartner, CallingPlanDto pCallingPlan)
        {
            if (pCarrierAcctRow == null)
            {
                return(null);
            }
            if (pPartner == null)
            {
                return(null);
            }
            if (pCallingPlan == null)
            {
                return(null);
            }

            var _carrierAcct = new CarrierAcctDto
            {
                CarrierAcctId = pCarrierAcctRow.Carrier_acct_id,
                IntlDialCode  = pCarrierAcctRow.Intl_dial_code,
                Name          = pCarrierAcctRow.Name,
                Strip1Plus    = pCarrierAcctRow.Strip1plus,
                PrefixOut     = pCarrierAcctRow.Prefix_out,
                Status        = pCarrierAcctRow.AccountStatus,
                RatingType    = pCarrierAcctRow.RatingType,
                MaxCallLength = pCarrierAcctRow.MaxCallLength,
                Partner       = pPartner,
                CallingPlan   = pCallingPlan
            };

            return(_carrierAcct);
        }