コード例 #1
0
        static bool rerateCDR(CDRViewRow_Base pCdrViewRow, IBackgroundWorker pBackgroundWorker)
        {
            try {
                var _customerAcct = CustomerAcct.Get(pCdrViewRow.Customer_acct_id);
                if (_customerAcct == null)
                {
                    pBackgroundWorker.ReportStatus(string.Format("ERROR! CustomerAcct NOT FOUND, {0}", pCdrViewRow.Customer_acct_id));
                    return(false);
                }

                var _customerRoute = CustomerRoute.Get(_customerAcct.ServiceId, _customerAcct.RoutingPlanId, pCdrViewRow.Customer_route_id);
                if (_customerRoute == null)
                {
                    pBackgroundWorker.ReportStatus(string.Format("ERROR! CustomerRoute NOT FOUND, {0}", pCdrViewRow.Customer_route_id));
                    return(false);
                }

                var _carrierAcct = CarrierAcct.Get(pCdrViewRow.Carrier_acct_id);
                if (_carrierAcct == null)
                {
                    pBackgroundWorker.ReportStatus(string.Format("ERROR! CarrierAcct NOT FOUND, {0}", pCdrViewRow.Carrier_acct_id));
                    return(false);
                }

                var _carrierRoute = CarrierRoute.Get(_carrierAcct.Id, pCdrViewRow.Carrier_route_id);
                if (_carrierRoute == null)
                {
                    pBackgroundWorker.ReportStatus(string.Format("ERROR! CarrierRoute NOT FOUND, {0}", pCdrViewRow.Carrier_route_id));
                    return(false);
                }

                var _cdr = new Cdr(pCdrViewRow);
                _customerAcct.RateCall(_customerRoute, ref _cdr);
                pCdrViewRow.Customer_duration = _cdr.CustomerDuration;
                pCdrViewRow.Price             = _cdr.CustomerPrice;
                _carrierAcct.RateCall(_carrierRoute, ref _cdr);
                pCdrViewRow.Carrier_duration = _cdr.CarrierDuration;
                pCdrViewRow.Cost             = _cdr.CarrierCost;
            }
            catch (Exception _ex) {
                pBackgroundWorker.ReportStatus(string.Format("Exception! {0}", _ex.Message));
                TimokLogger.Instance.LogRbr(LogSeverity.Critical, "CdrExportController.rerate", string.Format("Exception:\r\n{0}", _ex));
                return(false);
            }
            return(true);
        }
コード例 #2
0
 public Cdr(CDRViewRow_Base pCdrViewRow)
 {
     if (pCdrViewRow == null)
     {
         throw new ArgumentNullException("pCdrViewRow");
     }
     cdrRow                         = new CDRRow();
     cdrRow.Start                   = pCdrViewRow.Start;
     cdrRow.Date_logged             = pCdrViewRow.Date_logged;
     cdrRow.Duration                = pCdrViewRow.Duration;
     cdrRow.Customer_duration       = pCdrViewRow.Customer_duration;
     cdrRow.Retail_duration         = pCdrViewRow.Retail_duration;
     cdrRow.Carrier_duration        = pCdrViewRow.Carrier_duration;
     cdrRow.Ccode                   = pCdrViewRow.Ccode;
     cdrRow.Local_number            = pCdrViewRow.Local_number;
     cdrRow.Carrier_route_id        = pCdrViewRow.Carrier_route_id;
     cdrRow.Customer_route_id       = pCdrViewRow.Customer_route_id;
     cdrRow.Price                   = pCdrViewRow.Price;
     cdrRow.Cost                    = pCdrViewRow.Cost;
     cdrRow.Orig_IP_address         = pCdrViewRow.Orig_IP_address;
     OrigIP                         = IPUtil.ToString(cdrRow.Orig_IP_address);
     cdrRow.Term_end_point_id       = pCdrViewRow.Term_end_point_id;
     cdrRow.Customer_acct_id        = pCdrViewRow.Customer_acct_id;
     cdrRow.Carrier_acct_id         = pCdrViewRow.Carrier_acct_id;
     cdrRow.Disconnect_cause        = pCdrViewRow.Disconnect_cause;
     cdrRow.Mapped_disconnect_cause = pCdrViewRow.Mapped_disconnect_cause;
     cdrRow.Rbr_result              = pCdrViewRow.Rbr_result;
     cdrRow.Prefix_in               = pCdrViewRow.Prefix_in;
     cdrRow.Prefix_out              = pCdrViewRow.Prefix_out;
     cdrRow.DNIS                    = pCdrViewRow.DNIS;
     cdrRow.ANI                     = pCdrViewRow.ANI;
     cdrRow.Serial_number           = pCdrViewRow.Serial_number;
     cdrRow.Used_bonus_minutes      = pCdrViewRow.Used_bonus_minutes;
     cdrRow.Node_id                 = pCdrViewRow.Node_id;
     cdrRow.Id                      = pCdrViewRow.Id;
 }