Ejemplo n.º 1
0
        internal static BaseRouteDto[] GetUnusedBaseRoutes(Rbr_Db pDb, short pAccountId, int pCallingPlanId, ViewContext pContext, int pRoutingPlanId)
        {
            var _callingPlan = CallingPlanManager.GetCallingPlan(pDb, pCallingPlanId);

            RouteRow[] _routeRows = null;
            if (pContext == ViewContext.Carrier)
            {
                _routeRows = pDb.RouteCollection.GetUnusedByCallingPlanIdCarrierAcctId(pCallingPlanId, pAccountId);
            }
            else if (pContext == ViewContext.Service)
            {
                _routeRows = pDb.RouteCollection.GetUnusedByCallingPlanIdRoutingPlanIdServiceId(pCallingPlanId, pRoutingPlanId, pAccountId);
            }

            if (_routeRows == null || _routeRows.Length == 0)
            {
                return(null);
            }

            var _baseRoutes = new List <BaseRouteDto>();

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

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

                _baseRoutes.Add(mapToBaseRoute(_routeRow, _country, _callingPlan, _routeState));
            }
            return(sortBaseRoutes(_baseRoutes.ToArray()));
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        internal static BaseRouteDto GetProperRoute(Rbr_Db pDb, int pCallingPlanId, int pCountryId)
        {
            var _properRouteRow = GetProper(pDb, pCallingPlanId, pCountryId);

            if (_properRouteRow == null)
            {
                return(null);
            }

            var _callingPlan   = CallingPlanManager.GetCallingPlan(pDb, pCallingPlanId);
            var _country       = CallingPlanManager.GetCountry(pDb, pCountryId);
            var _dialCodeCount = CallingPlanManager.GetDialCodeCount(pDb, _properRouteRow.Route_id);
            var _routeState    = (_dialCodeCount > 0) ? RouteState.Valid : RouteState.NoDialCodes;

            return(mapToBaseRoute(_properRouteRow, _country, _callingPlan, _routeState));
        }