Exemple #1
0
        static CustomerAcctDto getAcct(Rbr_Db pDb, CustomerAcctRow pCustomerAcctRow)
        {
            if (pCustomerAcctRow == null)
            {
                return(null);
            }
            var _partner = PartnerManager.Get(pDb, pCustomerAcctRow.Partner_id);

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

            return(mapToCustomerAcct(pCustomerAcctRow, _partner));
        }
Exemple #2
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);
        }