예제 #1
0
        internal static TerminationChoiceDto GetTerminationChoice(Rbr_Db pDb, int pTerminationChoiceId)
        {
            var _terminationChoiceRow = pDb.TerminationChoiceCollection.GetByPrimaryKey(pTerminationChoiceId);
            var _route = CarrierRouteManager.Get(pDb, _terminationChoiceRow.Carrier_route_id);

            return(mapToTerminationChoice(_terminationChoiceRow, _route));
        }
예제 #2
0
        internal static TerminationChoiceDto[] GetAll(Rbr_Db pDb, int pRoutingPlanId, int pRouteId)
        {
            var _list = new List <TerminationChoiceDto>();
            var _terminationChoiceRows = pDb.TerminationChoiceCollection.GetByRoutingPlanIdRouteId_OrderByPriority(pRoutingPlanId, pRouteId);

            foreach (var _terminationChoiceRow in _terminationChoiceRows)
            {
                var _route = CarrierRouteManager.Get(pDb, _terminationChoiceRow.Carrier_route_id);
                _list.Add(mapToTerminationChoice(_terminationChoiceRow, _route));
            }
            return(_list.ToArray());
        }
예제 #3
0
        //-------------------- Private ----------------------------------------------

        static CarrierAcctDto getAcct(Rbr_Db pDb, CarrierAcctRow pCarrierAcctRow)
        {
            if (pCarrierAcctRow == null)
            {
                return(null);
            }
            var _partner = PartnerManager.Get(pDb, pCarrierAcctRow.Partner_id);

            if (_partner == null)
            {
                return(null);
            }
            var _callingPlan = CallingPlanManager.GetCallingPlan(pDb, pCarrierAcctRow.Calling_plan_id);

            if (_callingPlan == null)
            {
                return(null);
            }
            var _carrierAcct = mapToCarrierAcct(pCarrierAcctRow, _partner, _callingPlan);

            _carrierAcct.DefaultRoute = CarrierRouteManager.GetDefaultRoute(pDb, _carrierAcct, RouteState.Valid);

            //-- GetDefaultCarrierRatingInfo
            if (_carrierAcct.IsRatingEnabled)
            {
                var _defaultCarrierRouteRow = pDb.CarrierRouteCollection.GetByPrimaryKey(-pCarrierAcctRow.Carrier_acct_id);
                var _carrierRateHistoryRows = pDb.CarrierRateHistoryCollection.GetByCarrier_route_id(_defaultCarrierRouteRow.Carrier_route_id);
                if (_carrierRateHistoryRows.Length < 1)
                {
                    TimokLogger.Instance.LogRbr(LogSeverity.Critical, "CarrierAcctManager.GetDefaultCarrierRatingInfo", string.Format("Unexpected: _carrierRateHistoryRows.Length = {0}", _carrierRateHistoryRows.Length));
                    throw new Exception(string.Format("CarrierAcctManager.GetDefaultCarrierRatingInfo, Unexpected: _carrierRateHistoryRows.Length = {0}", _carrierRateHistoryRows.Length));
                }
                _carrierAcct.DefaultRatingInfo = RatingManager.GetRatingInfo(pDb, _carrierRateHistoryRows[0].Rate_info_id, false);
            }

            return(_carrierAcct);
        }