Пример #1
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);
        }
Пример #2
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;
        }
Пример #3
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;
        }
Пример #4
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;
        }
Пример #5
0
        /// <summary>
        /// method to get the SID/BID based on the pico cellId
        /// which is the onwaves sidbid for the specific site
        /// whether be a vessel or land based.
        /// </summary>
        /// <param name="cellId">The cellid of the pico</param>
        /// <returns></returns>
        public CarrierInfo GetSidBidForCellId(string cellId)
        {
            string        str = string.Empty;
            CarrierInfo   ci  = new CarrierInfo();
            StringBuilder sb  = new StringBuilder();

            sb.Append("SELECT sidBid, landBased, taxRate, airTimeRateYear from SidBidCellId where cellid = '" + cellId + "'");

            DataSet ds = new DataSet();

            try
            {
                using (SqlConnection dataConnection = new SqlConnection(_connectionString))
                {
                    dataConnection.Open();
                    // execute and fill
                    SqlDataAdapter myDaptor = new SqlDataAdapter(sb.ToString(), dataConnection);
                    myDaptor.Fill(ds);

                    // if we have too many SID/BIDS or none at all it is not a Verizon customer
                    // no need to create the CIBER record for this guy
                    if (ds.Tables.Count > 1)
                    {
                        return(ci);
                    }
                    else if (ds.Tables.Count == 0)
                    {
                        return(ci);
                    }

                    // make sure there is only one SID/BID returned here
                    foreach (DataTable myTable in ds.Tables)
                    {
                        //r.count = myTable.Rows.Count.ToString();

                        // only one row with the sidbid
                        foreach (DataRow myRow in myTable.Rows)
                        {
                            ci.ServingCarrierSidBid = myRow.ItemArray[0].ToString().Trim();
                            str = myRow.ItemArray[1].ToString().Trim();
                            double tx       = Convert.ToDouble(myRow.ItemArray[2].ToString().Trim());
                            int    rateYear = Convert.ToInt16(myRow.ItemArray[3].ToString().Trim());
                            if (str.Equals("Land"))
                            {
                                ci.ServingCarrierType     = Cdr.Rating.ServiceProviderType.Land;
                                ci.TaxRate                = tx;
                                ci.VZWLandAirTimeRateYear = rateYear;
                            }
                            else
                            {
                                ci.ServingCarrierType = Cdr.Rating.ServiceProviderType.Vessel;
                            }
                        }
                    }
                }
            }
            catch (System.Exception e)
            {
                FileWriter.Instance.WriteToLogFile("CiberDbMgr::GetSidBidForCellId():FailedTryingToGetTheSidBidInTheDB");
                FileWriter.Instance.WriteToLogFile("ECaught:" + e.Message + e.StackTrace);
            }

            return(ci);
        }
Пример #6
0
        /// <summary>
        /// method to get the SID/BID based on the pico cellId
        /// which is the onwaves sidbid for the specific site
        /// whether be a vessel or land based.
        /// </summary>
        /// <param name="cellId">The cellid of the pico</param>
        /// <returns></returns>
        public CarrierInfo GetSidBidForCellId(string cellId)
        {
            string str = string.Empty;
            CarrierInfo ci = new CarrierInfo();
            StringBuilder sb = new StringBuilder();
            sb.Append("SELECT sidBid, landBased, taxRate, airTimeRateYear from SidBidCellId where cellid = '" + cellId + "'");

            DataSet ds = new DataSet();

            try
            {
                using (SqlConnection dataConnection = new SqlConnection(_connectionString))
                {
                    dataConnection.Open();
                    // execute and fill
                    SqlDataAdapter myDaptor = new SqlDataAdapter(sb.ToString(), dataConnection);
                    myDaptor.Fill(ds);

                    // if we have too many SID/BIDS or none at all it is not a Verizon customer
                    // no need to create the CIBER record for this guy
                    if (ds.Tables.Count > 1)
                        return ci;
                    else if (ds.Tables.Count == 0)
                        return ci;

                    // make sure there is only one SID/BID returned here
                    foreach (DataTable myTable in ds.Tables)
                    {
                        //r.count = myTable.Rows.Count.ToString();

                        // only one row with the sidbid
                        foreach (DataRow myRow in myTable.Rows)
                        {
                            ci.ServingCarrierSidBid = myRow.ItemArray[0].ToString().Trim();
                            str = myRow.ItemArray[1].ToString().Trim();
                            double tx = Convert.ToDouble(myRow.ItemArray[2].ToString().Trim());
                            int rateYear = Convert.ToInt16( myRow.ItemArray[3].ToString().Trim());
                            if (str.Equals("Land"))
                            {
                                ci.ServingCarrierType = Cdr.Rating.ServiceProviderType.Land;
                                ci.TaxRate = tx;
                                ci.VZWLandAirTimeRateYear = rateYear;
                            }
                            else
                                ci.ServingCarrierType = Cdr.Rating.ServiceProviderType.Vessel;
                        }
                    }

                }

            }
            catch (System.Exception e)
            {
                FileWriter.Instance.WriteToLogFile("CiberDbMgr::GetSidBidForCellId():FailedTryingToGetTheSidBidInTheDB");
                FileWriter.Instance.WriteToLogFile("ECaught:" + e.Message + e.StackTrace);
            }

            return ci;
        }