示例#1
0
        private static CarrierEntity TranslateCarrierEntity(CarrierInfo info, bool isNeedContact = false)
        {
            CarrierEntity entity = new CarrierEntity();

            if (info != null)
            {
                entity.OperatorID       = info.OperatorID;
                entity.CarrierName      = info.CarrierName;
                entity.CarrierShortName = info.CarrierShortName;
                entity.CarrierNo        = info.CarrierNo;
                entity.Type             = info.Type;
                entity.Remark           = info.Remark;
                entity.CarNo            = info.CarNo;
                entity.Status           = info.Status;
                entity.CreateDate       = info.CreateDate;
                entity.ChangeDate       = info.ChangeDate;
                entity.CarrierID        = info.CarrierID;
                if (isNeedContact)
                {
                    entity.listContact = ContactService.GetContactByRule(UnionType.Carrier.ToString(), info.CarrierID);
                    entity.ContactJson = entity.listContact != null && entity.listContact.Count > 0 ? JsonHelper.ToJson(entity.listContact) : "";
                }
            }

            return(entity);
        }
示例#2
0
        public CarrierInfo GetSidBidForCellId(string cellId)
        {
            // leverage our db interface to get the SID/BID for this cellId
            CarrierInfo ci = m_dbMgr.GetSidBidForCellId(cellId);

            return(ci);
        }
示例#3
0
        public void SerializeCarrierInfo_WhenCalled_ReturnedString(CarrierInfo carrierInfo)
        {
            // Act
            var actual = _sut.Serialize(carrierInfo);

            // Assert
            actual.Should().NotBeEmpty();
        }
示例#4
0
        public static CarrierEntity GetCarrierById(long gid)
        {
            CarrierEntity     result = new CarrierEntity();
            CarrierRepository mr     = new CarrierRepository();
            CarrierInfo       info   = mr.GetCarrierByKey(gid);

            result = TranslateCarrierEntity(info);
            return(result);
        }
示例#5
0
        public CarrierInfo GetCarrierByKey(long gid)
        {
            CarrierInfo result  = new CarrierInfo();
            DataCommand command = new DataCommand(ConnectionString, GetDbCommand(CarrierStatement.GetCarrierByKey, "Text"));

            command.AddInputParameter("@CarrierID", DbType.String, gid);
            result = command.ExecuteEntity <CarrierInfo>();
            return(result);
        }
示例#6
0
        public void SerializeCarrierInfo_WhenCalled_ReturnedString(CarrierInfo carrierInfo)
        {
            // Arrange
            var serializer = new JsonSerializer();

            // Act
            var actual = serializer.Serialize(carrierInfo);

            // Assert
            actual.Should().NotBeEmpty();
        }
示例#7
0
        public async Task GetCarrierTest()
        {
            CarrierInfo carrier = await DostavItService.GetCarrierAsync("DelLin");

            Assert.IsNotNull(carrier);
            Assert.IsTrue(!string.IsNullOrEmpty(carrier.Name));
            Assert.IsTrue(!string.IsNullOrEmpty(carrier.FullName));
            Assert.IsTrue(!string.IsNullOrEmpty(carrier.Url));
            Assert.IsTrue(!string.IsNullOrEmpty(carrier.LargeLogoUrl));
            Assert.IsNotNull(carrier.Services);
            Assert.IsTrue(carrier.Services.Any());
        }
示例#8
0
        public string CalculateAirTimeChargeAmount(string totalChargeableTime, CarrierInfo ci)
        {
            double airTimeRate = 0;

            string chargeAmount = String.Empty;

            // get the carrier rate
            if (ci.ServingCarrierType.Equals(Cdr.Rating.ServiceProviderType.Land))
            {
                // if  land based, then we check if VZW to apply the step down airtime rates
                if (ci.HomeCarrier.Equals(Cdr.Rating.ServiceProvider.Verizon))
                {
                    // get the appropriate step down rate
                    if (ci.VZWLandAirTimeRateYear.Equals(Convert.ToInt32(Cdr.Rating.VZWLandAirTimeRate.Year1)))
                    {
                        airTimeRate = _year1StepDownAirTimeRate;
                    }
                    else if (ci.VZWLandAirTimeRateYear.Equals(Convert.ToInt32(Cdr.Rating.VZWLandAirTimeRate.Year2)))
                    {
                        airTimeRate = _year2StepDownAirTimeRate;
                    }
                    else if (ci.VZWLandAirTimeRateYear.Equals(Convert.ToInt32(Cdr.Rating.VZWLandAirTimeRate.Year3)))
                    {
                        airTimeRate = _year3StepDownAirTimeRate;
                    }
                    else
                    {
                        cfw.WriteToLogFile("CiberRater::CalculateAirTimeChargeAmount():AirTimeRateNotFoundFor: " + ci.ServingCarrierSidBid);
                        airTimeRate = _year1StepDownAirTimeRate;
                    }
                }
                else
                {
                    // apply the normal airtime land rates for both USCell and Sprint users
                    airTimeRate = _landBasedRates.AirTimeRate;
                }
            }
            else
            {
                // if not land based, then we check if Sprint
                if (ci.HomeCarrier.Equals(Cdr.Rating.ServiceProvider.Sprint))
                {
                    airTimeRate = _sprintRates.AirTimeRate;
                }
                else
                {
                    airTimeRate = _vzwRates.AirTimeRate;
                }
            }

            chargeAmount = this.CalculateChargeAmount(totalChargeableTime, airTimeRate);
            return(chargeAmount);
        }
 internal IEnumerable <CarrierInfo> InitCarriers()
 {
     return(new[]
     {
         CarrierBasic = new CarrierInfo
         {
             CarrierAssemblyName = "CMS.Ecommerce",
             CarrierClassName = "CMS.Ecommerce.DefaultCarrierProvider",
             CarrierName = "CarrierBasic",
             CarrierDisplayName = "CarrierBasic",
             CarrierSiteID = SiteInfo.SiteID
         }
     });
 }
示例#10
0
        public static CarrierEntity GetCarrierEntityById(long cid)
        {
            CarrierEntity     result = new CarrierEntity();
            CarrierRepository mr     = new CarrierRepository();
            CarrierInfo       info   = mr.GetCarrierByKey(cid);

            if (info != null)
            {
                result = TranslateCarrierEntity(info);
                //获取联系人信息
                result.listContact = ContactService.GetContactByRule(UnionType.Carrier.ToString(), info.CarrierID);
            }
            return(result);
        }
示例#11
0
        public string GetTaxAmount(string tollChargeAmount, string airChargeAmount, CarrierInfo ci)
        {
            string taxAmount = String.Empty;

            if (ci.TaxRate.Equals(0))
            {
                return(taxAmount.PadLeft(10, zero_pad));
            }
            else
            {
                taxAmount = this.CalculateTax(tollChargeAmount, airChargeAmount, ci.TaxRate);
            }

            return(taxAmount.PadLeft(10, zero_pad));
        }
示例#12
0
        public int ModifyCarrier(CarrierInfo Carrier)
        {
            DataCommand command = new DataCommand(ConnectionString, GetDbCommand(CarrierStatement.ModifyCarrier, "Text"));

            command.AddInputParameter("@CarrierName", DbType.String, Carrier.CarrierName);
            command.AddInputParameter("@CarrierShortName", DbType.String, Carrier.CarrierShortName);
            command.AddInputParameter("@CarrierNo", DbType.String, Carrier.CarrierNo);
            command.AddInputParameter("@Type", DbType.String, Carrier.Type);
            command.AddInputParameter("@Remark", DbType.String, Carrier.Remark);
            command.AddInputParameter("@CarNo", DbType.String, Carrier.CarNo);
            command.AddInputParameter("@OperatorID", DbType.Int64, Carrier.OperatorID);
            command.AddInputParameter("@Status", DbType.Boolean, Carrier.Status);
            command.AddInputParameter("@ChangeDate", DbType.DateTime, Carrier.ChangeDate);
            command.AddInputParameter("@CarrierID", DbType.Int64, Carrier.CarrierID);
            return(command.ExecuteNonQuery());
        }
        /// <summary>
        /// Constructor for MobiledgeXIntegration. This class has functions that wrap DistributedMatchEngine functions for ease of use
        /// </summary>
        public MobiledgeXIntegration(CarrierInfo carrierInfo = null, NetInterface netInterface = null, UniqueID uniqueId = null, DeviceInfo deviceInfo = null)
        {
            ConfigureMobiledgeXSettings();
            // Set the platform specific way to get SIM carrier information.
            pIntegration = new PlatformIntegration();

            // Optionally override each interface:
            matchingEngine = new MatchingEngine(
                carrierInfo == null ? pIntegration.CarrierInfo : carrierInfo,
                netInterface == null ? pIntegration.NetInterface : netInterface,
                uniqueId == null ? pIntegration.UniqueID : uniqueId,
                deviceInfo == null ? pIntegration.DeviceInfo : deviceInfo);

            melMessaging = new MelMessaging(appName);
            matchingEngine.SetMelMessaging(melMessaging);
        }
示例#14
0
文件: Form1.cs 项目: nuevollc/Nuevo
        private void TestTaxRate_Click(object sender, EventArgs e)
        {
            CiberTaxMgr     ct  = new CiberTaxMgr();
            CiberDbMgr      cdb = new CiberDbMgr();
            CiberRateEngine cr  = new CiberRateEngine();

            CarrierInfo ci = cdb.GetSidBidForCellId("1633");

            ci.HomeCarrier = ServiceProvider.Verizon;


            string chg = cr.CalculateAirTimeChargeAmount("001030", ci);

            //string tax1 = ct.GetTaxAmount("0000002000", ci );
            //ci = cdb.GetSidBidForCellId("1681");
            //string tax2 = ct.GetTaxAmount("0000002000", ci);
        }
        public Dictionary <string, string> GetDeviceInfo()
        {
            CarrierInfo carrierInfo = overrideCarrierInfo;

            if (carrierInfo == null)
            {
                carrierInfo = new CarrierInfoClass();
            }
            Dictionary <string, string> deviceInfo = new Dictionary <string, string>();

            deviceInfo["DataNetworkPath"] = carrierInfo.GetDataNetworkPath();
            deviceInfo["CarrierName"]     = carrierInfo.GetCurrentCarrierName();
            deviceInfo["SignalStrength"]  = carrierInfo.GetSignalStrength().ToString();
            deviceInfo["DeviceOS"]        = SystemInfo.operatingSystem;
            deviceInfo["DeviceModel"]     = SystemInfo.deviceModel;
            Debug.Log("deviceInfo count: " + deviceInfo.Count);
            return(deviceInfo);
        }
示例#16
0
        public long CreateNew(CarrierInfo Carrier)
        {
            DataCommand command = new DataCommand(ConnectionString, GetDbCommand(CarrierStatement.CreateNewCarrier, "Text"));

            command.AddInputParameter("@CarrierName", DbType.String, Carrier.CarrierName);
            command.AddInputParameter("@CarrierShortName", DbType.String, Carrier.CarrierShortName);
            command.AddInputParameter("@CarrierNo", DbType.String, Carrier.CarrierNo);
            command.AddInputParameter("@Remark", DbType.String, Carrier.Remark);
            command.AddInputParameter("@Type", DbType.String, Carrier.Type);
            command.AddInputParameter("@CarNo", DbType.String, Carrier.CarNo);
            command.AddInputParameter("@OperatorID", DbType.String, Carrier.OperatorID);
            command.AddInputParameter("@CreateDate", DbType.DateTime, Carrier.CreateDate);
            command.AddInputParameter("@ChangeDate", DbType.DateTime, Carrier.ChangeDate);

            //return command.ExecuteNonQuery();
            var o = command.ExecuteScalar <object>();

            return(Convert.ToInt64(o));
        }
示例#17
0
        private static CarrierInfo TranslateCarrierInfo(CarrierEntity entity)
        {
            CarrierInfo info = new CarrierInfo();

            if (info != null)
            {
                info.OperatorID       = entity.OperatorID;
                info.CarrierName      = entity.CarrierName;
                info.CarrierShortName = entity.CarrierShortName;
                info.CarrierNo        = entity.CarrierNo;
                info.Type             = entity.Type;
                info.Remark           = entity.Remark;
                info.CarNo            = entity.CarNo;
                info.Status           = entity.Status;
                info.CreateDate       = entity.CreateDate;
                info.ChangeDate       = entity.ChangeDate;
                info.CarrierID        = entity.CarrierID;
            }


            return(info);
        }
示例#18
0
        public string CalculateLocalLdTollChargeAmount(string totalChargeableTime, CarrierInfo ci)
        {
            double tollRate     = 0;
            string chargeAmount = String.Empty;

            if (ci.ServingCarrierType.Equals(Cdr.Rating.ServiceProviderType.Land))
            {
                tollRate = _landBasedRates.USCanadaTollRate;
            }
            else
            {
                // if not land based, then we check if Sprint, if not we use VZW default rates
                if (ci.HomeCarrier.Equals(Cdr.Rating.ServiceProvider.Sprint))
                {
                    tollRate = _sprintRates.USCanadaTollRate;
                }
                else
                {
                    tollRate = _vzwRates.USCanadaTollRate;
                }
            }
            chargeAmount = this.CalculateChargeAmount(totalChargeableTime, tollRate);
            return(chargeAmount);
        }
 public DeviceInfoIntegration(CarrierInfo overrideCarrierInfo = null)
 {
     this.overrideCarrierInfo = overrideCarrierInfo;
 }
示例#20
0
        /// <summary>
        ///  method to convert the OMC CDR to a CIBER Type 22 record
        ///  need to keep track of the total charges and taxes here
        /// </summary>
        /// <param name="cdr"></param>
        public void ProcessCallRecord(OmcCdr cdr)
        {
            //  22 0 00 000 01151 2 912223280900000 10 912223280900000 1 0610328563400000000 33333 0000000099 0 00000000000000000000000705022220000000000000000010912223280900000000000000000000000000000000000000001  029000000000189900000000000212127000100000051021000000009900000000000000                            000J    INCOMING  CLUSAJACKSON   OHUSA00000000000000000000000000000000000000000000000000000000000000000000000000208040784PIKE  0188
            // 220000000115129122232809000001091222328090000010610328563400000000333330000000099000000000000000000000000705022220000000000000000010912223280900000000000000000000000000000000000000001
            // record type : 22
            // return code : 0
            // ciber return reason code 2N : 00
            // invalidfieldidentifier 3N : 000
            // homecarriersidbid 5N : 01151
            // msid indicator 1N = 2
            // msid 15N : 912223280900000
            // MSISDN/MDN length 2N : 10
            // MSISDN/MDN 15N : 912223280900000
            // ESN/UIMID/EIMIE/MEID indicator 1N :1
            // ESN/UIMID/EIMIE/MEID 19N : 0610328563400000000
            // ServingCarrierSidBid 5N :33333
            // TotalChargesAndTaxes 10N : 0000000099
            /// system reserved filler1 1N : BlankFILL
            /// total state province taxes 10N

            // update our running total
            // cri.BatchTotalChargesAndTaxes

            // create a CIBER record
            // for now it is a type 22 record

            Record22 r22 = new Record22();

            r22.ReturnCode = "0";
            r22.CiberRecordReturnReasonCode = "00";
            r22.InvalidFieldIndentifier     = "000";
            r22.MsidIndicator = "2";  // MIN baby


            // if 911 call, don't process it
            if (cdr.A_Feature_Bits.Equals("EMERGENCY"))
            {
                cfw.WriteToLogFile(DateTime.Now.ToShortDateString() + "OmcToCiberCdrConverter::ConvertToCiber():911CallDetectedForCDRSeqNum:" + cdr.SequenceNumber + "\r\n");
                return;
            }

            try
            {
                // if we have a *good* call, then create the CIBER record and for now if it is *bad* call
                // we log it to the log file.  Figure out what to do with it, create the CIBER or not.
                if ((cdr.disc_code.Equals("201")) || (cdr.disc_code.Equals("202")))
                {
                    r22.CallCompletionIndicator  = "2";
                    r22.CallTerminationIndicator = "2"; // 2 = Normal
                }
                else
                {
                    // double check this
                    r22.CallCompletionIndicator  = "1";
                    r22.CallTerminationIndicator = "3"; // 3 = unknown, 4=incomplete call
                    cfw.WriteToLogFile(DateTime.Now.ToShortDateString() + "OmcToCiberCdrConverter::ConvertToCiber():InvalidDisconnectCode-CallNotTerminatedForCDRSeqNum:" + cdr.SequenceNumber + "\r\n");
                    return;
                }

                // look for the mobile party in our scenario we will always have one mobile unit and one
                // landline, we always grab mobile unit parameters.
                // MO Case:
                if (cdr.a_party_type.Equals("1"))
                {
                    // grab the a party mobile params
                    // MIN
                    r22.Msid = cdr.a_party_num;

                    // MDN  ** double check this and might change it to be the cdr.ocpn field **
                    r22.MsisdnMdnLength = cdr.o_msisdn.Length.ToString();
                    r22.MsisdnMdn       = cdr.o_msisdn;

                    if (cdr.OriginatingEsn.Length == 0)
                    {   // ESN/UIMID/IMEI/MEID
                        // If the ESN/IMEI/MEID Indicator equals “0,”
                        // then the ESN/IMEI/MEID field must be zero filled.
                        // If the ESN/IMEI/MEID Indicator equals 1, 2, or 3, then the
                        // ESN/IMEI/MEID field must contain a value within the range of accepted values specified above.
                        r22.EsnUimidImeiMeidIndicator = "0"; // ESN
                        r22.EsnUimidImeiMeid          = "000000";
                    }
                    else
                    {
                        r22.EsnUimidImeiMeidIndicator = "1"; // ESN

                        // add code to convert this according to Appendix B
                        UInt32 starEsn = Convert.ToUInt32(cdr.OriginatingEsn, 16);
                        string esn     = CalculateEsnValue(starEsn);
                        r22.EsnUimidImeiMeid = esn;
                    }

                    //The value of the Caller ID is dependent on the call direction.
                    //•For Mobile Originated Calls (Call Direction equals “1”), the Caller ID is equal to the Mobile Directory Number.
                    // which in our case is the following field in the type 22 record
                    r22.CallerIdLength = r22.MsisdnMdnLength;
                    r22.CallerId       = r22.MsisdnMdn;

                    // For Mobile Originated Calls, the Called Number Digits represents the Dialed Digits.
                    r22.CalledNumberLength = cdr.b_party_digits.Length.ToString();
                    r22.CalledNumberDigits = cdr.b_party_digits;

                    // MO no TLDN in our scenario
                    r22.TldnLength = "0";
                    r22.Tldn       = "0";

                    // set our call direction : mobile roamer originated = 1, mobile roamer terminated = 2
                    r22.CallDirection = "1";
                }
                else
                {
                    // MT Case:
                    // assume that b party is the mobile party and we grab the b party mobile params
                    // grab the b party mobile params
                    // MIN
                    r22.Msid = cdr.b_party_num;

                    // MDN
                    r22.MsisdnMdnLength = cdr.t_msisdn.Length.ToString();
                    r22.MsisdnMdn       = cdr.t_msisdn;

                    if (cdr.TerminatingEsn.Length == 0)
                    {   // ESN/UIMID/IMEI/MEID
                        // If the ESN/IMEI/MEID Indicator equals “0,”
                        // then the ESN/IMEI/MEID field must be zero filled.
                        // If the ESN/IMEI/MEID Indicator equals 1, 2, or 3, then the
                        // ESN/IMEI/MEID field must contain a value within the range of accepted values specified above.
                        r22.EsnUimidImeiMeidIndicator = "0"; // ESN
                        r22.EsnUimidImeiMeid          = "000000";
                    }
                    else
                    {
                        r22.EsnUimidImeiMeidIndicator = "1"; // ESN

                        // add code to convert this according to Appendix B
                        UInt32 starEsn = Convert.ToUInt32(cdr.TerminatingEsn, 16);
                        string esn     = CalculateEsnValue(starEsn);
                        r22.EsnUimidImeiMeid = esn;
                    }

                    //•For Mobile Terminated Calls (Call Direction equals “2”), the Caller ID is the number of the calling party.
                    r22.CallerIdLength = cdr.a_party_num.Length.ToString();
                    r22.CallerId       = cdr.a_party_num;

                    // For Mobile Terminated Calls (Call Direction equals “2”), the Called Number Digits value MUST equal
                    // the Mobile Directory Number value.
                    r22.CalledNumberLength = r22.MsisdnMdnLength; //cdr.t_msisdn.Length.ToString();
                    r22.CalledNumberDigits = r22.MsisdnMdn;       // ** when we have Verizon phones it should be :** cdr.t_msisdn;

                    // landline to Mobile, MT
                    r22.TldnLength = cdr.a_party_digits.Length.ToString();
                    r22.Tldn       = cdr.A_Party_Digits;

                    // set our call direction : mobile roamer originated = 1, mobile roamer terminated = 2
                    r22.CallDirection = "2";
                }

                // this field is used to indicate the home carrier of the roaming mobile as indicated by the MSID.
                // The MSID must be valid for the specified home carrier SID/BID.
                // look up the HomeCarrierSIDBID based on the MSID
                CarrierInfo ci = GetHomeCarrierSidBid(r22.Msid);
                if (ci.SidBid.Equals(TechDataEnums.SIDBID_NOT_FOUND.ToString()))
                {
                    cfw.WriteToLogFile(DateTime.Now.ToShortDateString() + "OmcToCiberCdrConverter::ProcessCallRecord():SIDBIDNotFoundForMSID: " + r22.Msid);
                    return;
                }
                else
                {
                    r22.HomeCarrierSidBid = ci.SidBid;
                }

                // this is the On-Wave SID/BID, use the same one that is in our header
                r22.ServingCarrierSidBid = cri.SendingCarrierSidBid;

                // yymmdd
                r22.CallDate = cdr.answer.Substring(2, 2) + cdr.answer.Substring(5, 2) + cdr.answer.Substring(8, 2);

                // This field is used to record the routing number associated with a ported or pooled MDN.
                r22.LocationRoutingNumberLengthIndicator = "0";
                r22.LocationRoutingNumber = "0";

                r22.CurrencyType = "1";

                // original Batch Sequence Number
                r22.OriginalBatchSequenceNumber = cri.BatchSequenceNumber;

                r22.InitialCellSite         = cdr.cell_id;
                r22.TimeZoneIndicator       = "99"; //=08 Pacific, for this test use the unknown value of "99";
                r22.DaylightSavingIndicator = "0";
                r22.MessageAccountingDigits = "0";

                // This field is used to record the time that the mobile unit successfully connected to a wireless system.
                // HHMMSS: HH = 00-23, MM = 00-59, SS = 00-59
                r22.AirConnectTime = cdr.answer.Substring(11, 2) + cdr.answer.Substring(14, 2) + cdr.answer.Substring(17, 2);

                // fill these in : ( disc time - seize time )
                // This field is used to record the billable elapsed time used to calculate air time charges
                string ChargeableTime = CalculateAirChargeTime(cdr.DisconnectTime, cdr.SeizeTime);

                r22.AirChargeableTime = ChargeableTime; //  "0001030"; // contains the billable elapsed time in MMMM=0000-9999, SS=00-59

                // This field is used to record the elapsed time associated with a call.
                // MMMMSS: MMMM = 0000-9999, SS = 00-59
                r22.AirElapsedTime = ChargeableTime; // "000545"; // this should be disconnect - answer

                // this needs to be determined
                r22.AirRatePeriod      = "02";
                r22.AirMultiRatePeriod = "1";// 1 = single rate period

                // This field is used to record the charges associated with the air time portion of a call.
                // This field must not contain any taxes; $$$$$$$$¢¢ format.
                string rAirChargeTime = cr.CalculateAirTimeChargeAmount(r22.AirChargeableTime, ci.Carrier);
                r22.AirCharge = rAirChargeTime; // "99";

                // ** calculate this as well
                r22.OtherChargeNumberOneIndicator = "0";
                r22.OtherChargeNumberOne          = "0";

                r22.PrintedCall = "0";

                // determine how we determine if it is fraudulent or not
                r22.FraudIndicator    = "00";
                r22.FraudSubIndicator = "0";

                // special condition when it is a zero, properties get/set take care of this
                r22.SpecialFeaturesUsed = "0";

                // ** fix this to the following
                // this field contains the service call descriptor, section 8 table 18 OR the geographic  name of the
                // called place.
                // called place depends on the call direction
                // for MO, calledDirection=1, the called place is the place that the mobile sub
                // is calling
                // for MT, calledDirection=2, the called place is the place where the mobile sub answered the call
                if (r22.CallDirection.Equals("2"))
                { // MT CALLs
                  // Mobile terminated calls all MT calls are airtime only charges Rate = 1.49
                    r22.CalledPlace          = "INCOMING";
                    r22.CalledStateProvince  = "CL";
                    r22.CalledCountry        = "USA"; // **check to see if we are going to make this International
                    r22.SpecialFeaturesUsed  = "J";   // no toll
                    r22.TollTariffDescriptor = "00";  // na
                    r22.TollRateClass        = "0";   // 0-when no toll associated with this call

                    // No TOLL CHARGES for MT
                    r22.TollConnectTime                = "000000";
                    r22.TollElapsedTime                = "000000";
                    r22.TollChargeableTime             = r22.TollElapsedTime;
                    r22.TollRatePeriod                 = "00"; // not applicable
                    r22.TollMultiRatePeriod            = "0";  // not applicable
                    r22.TollRatingPointLengthIndicator = "0";
                    r22.TollRatingPoint                = "0";
                    r22.TollCharge = "00"; //
                }
                else if (r22.CallDirection.Equals("1"))
                {   // MO CALLs
                    // check for 411 call ** add others here or in separate function
                    // see section 8 table 18
                    if (r22.CalledNumberDigits.Equals("411000000000000"))
                    { // MO:411
                        r22.CalledPlace         = "DIR ASST";
                        r22.CalledStateProvince = "CL";
                        r22.CalledCountry       = "USA";
                        r22.SpecialFeaturesUsed = "0"; // shows no toll charges applied
                        r22.PrintedCall         = "411";

                        // rated as local/ld call including toll
                        r22.TollTariffDescriptor           = "02"; // interstate interlata
                        r22.TollRateClass                  = "1";  // 0-when no toll associated with this call
                        r22.TollConnectTime                = r22.AirConnectTime;
                        r22.TollElapsedTime                = r22.AirElapsedTime;
                        r22.TollChargeableTime             = r22.AirChargeableTime;
                        r22.TollRatePeriod                 = "01";// day, 02=evening, 03=night, 05=latenight, 06 =weekend
                        r22.TollMultiRatePeriod            = "1";
                        r22.TollRatingPointLengthIndicator = "00";
                        r22.TollRatingPoint                = "0"; // when TollRatingPointLengthIndicator=0, this = 0
                        string rTollChargeTime = cr.CalculateLocalLdTollChargeAmount(r22.TollChargeableTime);
                        r22.TollCharge = rTollChargeTime;
                    }
                    else if (r22.CalledNumberDigits.StartsWith("8"))
                    { // MO:TOLL FREE
                        r22.CalledPlace          = "TOLL FREE";
                        r22.CalledStateProvince  = "CL";
                        r22.CalledCountry        = "USA";
                        r22.SpecialFeaturesUsed  = "J";
                        r22.PrintedCall          = "TOLL FREE";
                        r22.TollTariffDescriptor = "00"; // interstate interlata
                        r22.TollRateClass        = "0";  // 0-when no toll associated with this call
                        // *** figure out charges for TOLL FREE
                        r22.TollConnectTime    = "000000";
                        r22.TollElapsedTime    = "000000";
                        r22.TollChargeableTime = r22.TollElapsedTime;
                        // no toll
                        r22.TollRatePeriod                 = "00"; // not applicable
                        r22.TollMultiRatePeriod            = "0";  // not applicable
                        r22.TollRatingPointLengthIndicator = "0";
                        r22.TollRatingPoint                = "0";  // when TollRatingPointLengthIndicator=0, this = 0
                        r22.TollCharge = "00";                     // no toll
                    }
                    else
                    { // MO : International or Local/LD case
                        // this should map to table 31 State/Province mapping
                        NpaNxxData n = npaNxxRdr.GetNpaNxxInfo(r22.CalledNumberDigits.Substring(0, 6));

                        // check International scenario
                        if (n.NpaNxx.Equals(String.Empty))
                        {   // MO:International Rate = 1.49 AirTime + 0.80 Toll
                            // International Call Scenario
                            // add the international tables mapped to table 32
                            if (r22.CalledNumberDigits.Contains("0118522810"))
                            {
                                r22.CalledPlace         = "Hong Kong";
                                r22.CalledStateProvince = "ZZ";
                                r22.CalledCountry       = "HKG";

                                r22.SpecialFeaturesUsed = "D"; // International, but not required.
                                // 01 = International : Originating from a NANP and terminating to Non-NANP
                                // 15 = International : Originating from a NANP and terminating to NANP
                                // 17 = International : Originating from a Non-NANP and terminating to NANP
                                // 18 = International : Originating from and terminating to Non-NANP
                                r22.TollTariffDescriptor = "01"; // see above
                                r22.TollRateClass        = "1";  // dial station, normal completed, 0-when no toll associated with this call
                                // toll charges
                                r22.TollConnectTime    = r22.AirConnectTime;
                                r22.TollElapsedTime    = r22.AirElapsedTime;
                                r22.TollChargeableTime = r22.AirChargeableTime;

                                r22.TollRatePeriod      = "01";// day, 02=evening, 03=night, 05=latenight, 06 =weekend
                                r22.TollMultiRatePeriod = "1";

                                r22.TollRatingPointLengthIndicator = "00";
                                r22.TollRatingPoint = "0";  // when TollRatingPointLengthIndicator=0, this = 0
                                string rTollChargeTime = cr.CalculateInternationalTollChargeAmount(r22.TollChargeableTime);
                                r22.TollCharge = rTollChargeTime;
                            }
                            else if (r22.CalledNumberDigits.Contains("01181354"))
                            {
                                r22.CalledPlace         = "Tokyo";
                                r22.CalledStateProvince = "ZZ";
                                r22.CalledCountry       = "JPN";

                                r22.SpecialFeaturesUsed = "D"; // International, but not required.
                                // 01 = International : Originating from a NANP and terminating to Non-NANP
                                // 15 = International : Originating from a NANP and terminating to NANP
                                // 17 = International : Originating from a Non-NANP and terminating to NANP
                                // 18 = International : Originating from and terminating to Non-NANP
                                r22.TollTariffDescriptor = "01"; // see above
                                r22.TollRateClass        = "1";  // dial station, normal completed, 0-when no toll associated with this call
                                // toll charges
                                r22.TollConnectTime    = r22.AirConnectTime;
                                r22.TollElapsedTime    = r22.AirElapsedTime;
                                r22.TollChargeableTime = r22.AirChargeableTime;

                                r22.TollRatePeriod      = "01";// day, 02=evening, 03=night, 05=latenight, 06 =weekend
                                r22.TollMultiRatePeriod = "1";

                                r22.TollRatingPointLengthIndicator = "00";
                                r22.TollRatingPoint = "0";  // when TollRatingPointLengthIndicator=0, this = 0
                                string rTollChargeTime = cr.CalculateInternationalTollChargeAmount(r22.TollChargeableTime);
                                r22.TollCharge = rTollChargeTime;
                            }
                            else
                            {
                                cfw.WriteToLogFile(DateTime.Now.ToShortDateString() + "OmcToCiberCdrConverter::ProcessCallRecord():NPANXXNotFoundFor: " + r22.CalledNumberDigits);
                                return;
                            }
                        }
                        else
                        { // MO:Local/LD case  : Rate = 1.49 AirTime + 0.50 Toll
                            r22.CalledPlace          = n.City;
                            r22.CalledStateProvince  = n.State;
                            r22.CalledCountry        = "USA";
                            r22.SpecialFeaturesUsed  = "0";  // none
                            r22.TollTariffDescriptor = "02"; // interstate interlata
                            r22.TollRateClass        = "1";  // 0-when no toll associated with this call

                            // toll charges
                            r22.TollConnectTime    = r22.AirConnectTime;
                            r22.TollElapsedTime    = r22.AirElapsedTime;
                            r22.TollChargeableTime = r22.AirChargeableTime;

                            r22.TollRatePeriod      = "01";// day, 02=evening, 03=night, 05=latenight, 06 =weekend
                            r22.TollMultiRatePeriod = "1";

                            r22.TollRatingPointLengthIndicator = "00";
                            r22.TollRatingPoint = "0";  // when TollRatingPointLengthIndicator=0, this = 0
                            string rTollChargeTime = cr.CalculateLocalLdTollChargeAmount(r22.TollChargeableTime);
                            r22.TollCharge = rTollChargeTime;
                        }
                    }
                }

                // description designed by the serving carrier and may range from a city name to a cell site or a trunk/circuit name.
                r22.ServingPlace = "Strata8";

                // for MO , called direction =1, this is the state that is providing service to the mobile subscriber
                // for MT, this is the state/province providing service to the called party
                // must contain a value given in section 8 , table 31
                r22.ServingStateProvince = "WA";
                r22.ServingCountry       = "USA";

                r22.TollStateProvinceTaxes = "0";
                r22.TollLocalTaxes         = "0";
                r22.TollNetworkCarrierId   = "00000"; // this is other ** TBD **  see section 8, table 10, and appendix H

                // let's get the total state/province taxes associated with this record
                r22.TotalStateProvinceTaxes = r22.TollStateProvinceTaxes;
                r22.TotalLocalTaxes         = r22.TollLocalTaxes;

                // total charges is the sum of all the charge fields and taxes in this ciber record
                // r22.TotalChargesAndTaxes = r22.TotalLocalTaxes + r22.TotalStateProvinceTaxes + r22.AirCharge + r22.TollCharge;
                // need to convert to an int
                int intTotalLocalTaxes         = Convert.ToInt32(r22.TotalLocalTaxes);
                int intTotalStateProvinceTaxes = Convert.ToInt32(r22.TotalStateProvinceTaxes);
                int intAirCharge  = Convert.ToInt32(r22.AirCharge);
                int intTollCharge = Convert.ToInt32(r22.TollCharge);

                int totalChargesAndTaxesThisRecord = intTotalLocalTaxes + intTotalStateProvinceTaxes + intAirCharge + intTollCharge;

                // calculate new charges for this file and maintain the total
                // cri.BatchTotalChargesAndTaxes = cri.BatchTotalChargesAndTaxes + ... for out trailer

                // increment the record count if a valid record
                cri.TotalNumberOfRecordsInBatch++;
                //cri.BatchTotalChargesAndTaxes = cri.BatchTotalChargesAndTaxes + r22.
                cri.BatchTotalChargesAndTaxes = cri.BatchTotalChargesAndTaxes + totalChargesAndTaxesThisRecord;

                r22.TotalChargesAndTaxes = totalChargesAndTaxesThisRecord.ToString();

                // finally write this cdr to the file
                // cfw.WriteToFile(r22.ToCiberStringFormat());
            }
            catch (ApplicationException ae)
            {
                cfw.WriteToLogFile(DateTime.Now.ToShortDateString() + ae.Message + "\r\n" + ae.StackTrace);
            }
            catch (IOException ioe)
            {
                cfw.WriteToLogFile(DateTime.Now.ToShortDateString() + ioe.Message + "\r\n" + ioe.StackTrace);
            }
        }
        private void Display(DobCarrier dobCarrier, int indent)
        {
            if (dobCarrier == null)
            {
                return;
            }
            DisplayLabel("DobCarrier info", indent);

            CarrierInfo carrierInfo = dobCarrier.carrierInfo;

            if (carrierInfo != null)
            {
                DisplayValue("DBA name", carrierInfo.dbaName, indent + 1);
                if (carrierInfo.docket != null)
                {
                    DisplayValue("Docket name", carrierInfo.docket.prefix + carrierInfo.docket.number, indent + 1);
                }
                if (carrierInfo.dotNumberSpecified && carrierInfo.dotNumber > 0)
                {
                    DisplayValue("Dot Number", carrierInfo.dotNumber, indent);
                }
                DisplayValue("Duns", carrierInfo.duns, indent + 1);
                IntrastateType intrastate = carrierInfo.intrastate;
                if (intrastate != null)
                {
                    DisplayValue("Intrastate", intrastate.intrastateState.ToString() + intrastate.intrastateCode, indent + 1);
                }
                DisplayValue("Carrier Info Last Update", carrierInfo.lastUpdate, indent + 1);
                DisplayValue("Legal Name", carrierInfo.legalName, indent + 1);

                Display("Mailing address", carrierInfo.mailingAddress, indent + 1);
                Display("Physical address", carrierInfo.physicalAddress, indent + 1);
                if (carrierInfo.scacCode != null)
                {
                    foreach (string code in carrierInfo.scacCode)
                    {
                        DisplayValue("Scacc Code", code, indent + 1);
                    }
                }
                DisplayValue("Website", carrierInfo.website, indent + 1);
            }
            ContactInfo contactInfo = dobCarrier.contactInfo;

            if (contactInfo.contacts != null)
            {
                foreach (Contact contact in contactInfo.contacts)
                {
                    Display(contact, indent + 1);
                }
            }
            DisplayValue("Contact Info Last Update", contactInfo.lastUpdate, indent + 1);

            Document[] documents = dobCarrier.documents;
            if (documents != null)
            {
                foreach (Document document in documents)
                {
                    Display(document, indent + 1);
                }
            }

            Display(dobCarrier.equipment, indent + 1);

            GeographicCoverage geographicCoverage = dobCarrier.geographicCoverage;

            if (geographicCoverage != null)
            {
                LaneType[] lanes = geographicCoverage.lanes;
                if (lanes != null)
                {
                    foreach (LaneType laneType in lanes)
                    {
                        Display(laneType, indent + 1);
                    }
                }
                DisplayValue("Last Geographic Coverage Update Date", geographicCoverage.lastUpdate, indent + 1);
                if (geographicCoverage.operatingStateProvince != null)
                {
                    foreach (StateProvince stateProvince in geographicCoverage.operatingStateProvince)
                    {
                        DisplayValue("Geographic Coverage operation state province", stateProvince, indent + 1);
                    }
                }
                DisplayValue("Geographic Coverage service in mexico", geographicCoverage.serviceInMexico, indent + 1);
            }
        }
示例#22
0
        public static bool ModifyCarrier(CarrierEntity entity)
        {
            long result = 0;

            if (entity != null)
            {
                CarrierRepository mr = new CarrierRepository();

                CarrierInfo CarrierInfo = TranslateCarrierInfo(entity);

                ContactJsonEntity jsonlist = null;
                if (!string.IsNullOrEmpty(entity.ContactJson))
                {
                    try
                    {
                        jsonlist = (ContactJsonEntity)JsonHelper.FromJson(entity.ContactJson, typeof(ContactJsonEntity));
                    }
                    catch (Exception ex)
                    {
                        string str = ex.ToString();
                    }
                }

                if (entity.CarrierID > 0)
                {
                    CarrierInfo.CarrierID  = entity.CarrierID;
                    CarrierInfo.ChangeDate = DateTime.Now;
                    result = mr.ModifyCarrier(CarrierInfo);
                }
                else
                {
                    CarrierInfo.ChangeDate = DateTime.Now;
                    CarrierInfo.CreateDate = DateTime.Now;
                    result = mr.CreateNew(CarrierInfo);
                }

                #region 更新联系人信息
                if (jsonlist != null)
                {
                    List <ContactJson> list = jsonlist.listContact;
                    if (list != null && list.Count > 0)
                    {
                        foreach (ContactJson cc in list)
                        {
                            ContactRepository cr      = new ContactRepository();
                            ContactInfo       contact = new ContactInfo();
                            contact.ContactName = cc.ContactName;
                            contact.Mobile      = cc.Mobile;
                            contact.Telephone   = cc.Telephone;
                            contact.Email       = cc.Email;
                            contact.Remark      = cc.Remark;
                            contact.UnionType   = UnionType.Carrier.ToString();//承运商
                            if (cc.ContactID > 0)
                            {
                                contact.ContactID  = cc.ContactID;
                                contact.UnionID    = entity.CarrierID;
                                contact.ChangeDate = DateTime.Now;
                                cr.ModifyContact(contact);
                            }
                            else
                            {
                                contact.UnionID    = entity.CarrierID > 0 ? entity.CarrierID : result;
                                contact.CreateDate = DateTime.Now;
                                contact.ChangeDate = DateTime.Now;
                                cr.CreateNew(contact);
                            }
                        }
                    }
                }
                #endregion

                List <CarrierInfo> miList = mr.GetAllCarrier();//刷新缓存
                Cache.Add("CarrierALL", miList);
            }
            return(result > 0);
        }
示例#23
0
        public string CalculateInternationalTollChargeAmount(string totalChargeableTime, CarrierInfo ci)
        {
            string chargeAmount      = String.Empty;
            double internationalRate = 0;

            if (ci.ServingCarrierType.Equals(Cdr.Rating.ServiceProviderType.Land))
            {
                internationalRate = _landBasedRates.InternationalRate;
            }
            else
            {
                // if not land based, then we check if Sprint, use VZW default
                if (ci.HomeCarrier.Equals(Cdr.Rating.ServiceProvider.Sprint))
                {
                    internationalRate = _sprintRates.InternationalRate;
                }
                else
                {
                    internationalRate = _vzwRates.InternationalRate;
                }
            }

            chargeAmount = this.CalculateChargeAmount(totalChargeableTime, internationalRate);
            return(chargeAmount);
        }
示例#24
0
        /// <summary>
        /// 依照檢驗計畫取得該物件的datatable
        /// </summary>
        /// <param name="QCTypeData"></param>
        /// <param name="objectName"></param>
        /// <returns></returns>
        public static DataTable GetInspectionData(QCTypeInfo QCTypeData, string objectName)
        {
            string    sql        = "";
            DataTable dtQCTarget = null;

            #region 依照檢驗計畫取得該物件的datatable
            switch (QCTypeData.QCTarget)
            {
            case "MES_WIP_LOT":
            {
                LotInfo lot = LotInfo.GetLotByLot(objectName);
                if (lot == null)
                {
                    throw new Exception(TextMessage.Error.T00378(objectName));
                }

                dtQCTarget = lot.CopyDataToTable(lot.ID);
            }
            break;

            case "MES_WIP_COMP":
            {
                //取得component資訊以及所在的工作站
                sql = @"SELECT L.OPERATION,C.* FROM MES_WIP_COMP C
                                 INNER JOIN MES_WIP_LOT L ON C.CURRENTLOT = L.LOT
                                 WHERE COMPONENTID = #[STRING]";

                ComponentInfo comp = InfoCenter.GetBySQL <ComponentInfo>(sql, objectName);
                if (comp == null)
                {
                    throw new Exception(TextMessage.Error.T00154(objectName));
                }

                dtQCTarget = comp.CopyDataToTable(comp.ID);
            }
            break;

            case "MES_CMS_CAR":
            {
                CarrierInfo carrier = CarrierInfo.GetCarrierByCarrierNo(objectName);
                if (carrier == null)
                {
                    throw new RuleCimesException(TextMessage.Error.T00725(objectName));
                }

                dtQCTarget = carrier.CopyDataToTable(carrier.ID);
            }
            break;

            case "MES_TOOL_MAST":
            {
                ToolInfo tool = ToolInfo.GetToolByName(objectName);
                if (tool == null)
                {
                    throw new Exception(TextMessage.Error.T00592(objectName));
                }
                dtQCTarget = tool.CopyDataToTable(tool.ID);
            }
            break;

            case "MES_MMS_MLOT":
            {
                MaterialLotInfo mlot = MaterialLotInfo.GetMaterialLotByMaterialLot(objectName);
                if (mlot == null)
                {
                    throw new Exception(TextMessage.Error.T00512(objectName));
                }

                dtQCTarget = mlot.CopyDataToTable(mlot.ID);
            }
            break;

            case "MES_EQP_EQP":
            {
                EquipmentInfo equipment = EquipmentInfo.GetEquipmentByName(objectName);
                if (equipment == null)
                {
                    throw new Exception(TextMessage.Error.T00885(objectName));
                }

                dtQCTarget = equipment.CopyDataToTable(equipment.ID);
            }
            break;

            default:
            {
                sql        = string.Format("SELECT * FROM {0} WHERE {1} = #[STRING]", QCTypeData.QCTarget, QCTypeData.IdentityColumn);
                dtQCTarget = DBCenter.GetDataTable(sql, objectName);
                if (dtQCTarget == null || dtQCTarget.Rows.Count == 0)
                {
                    throw new Exception(TextMessage.Error.T00030("InspectionTarget", objectName));
                }
            }
            break;
            }
            #endregion

            return(dtQCTarget);
        }