public decimal?rateCostCalculation(string condition = null, int?userDemand = null, decimal?Duration = null)
        {
            decimal?valueResult = null;
            decimal decCostRate = decimal.Parse(CostRate);

            if (CostCalculationMethod.Equals("PerSecond"))
            {
                valueResult = decCostRate * Duration;
            }
            else if (CostCalculationMethod.Equals("PerPacket"))
            {
                if (PacketType.Equals("Data"))
                {
                    valueResult = decimal.Parse(PacketLimit) * decCostRate;
                }
                else
                {
                    valueResult = (decCostRate * Duration) * decCostRate;
                }
            }
            else
            {
                valueResult = 0;
            }

            return(valueResult * (Convert.ToDecimal(110) / Convert.ToDecimal(100)));
        }
        public decimal?CalculateProductUnitPrices(string condition = "", int?userDemand = 0, decimal?duration = 0)
        {
            int?hasil = null;

            if (CostCalculationMethod.Equals("FixPerRoute"))
            {
                hasil = 1 * Int32.Parse(CostRate);
            }
            if (CostCalculationMethod.Equals("PerMiles"))
            {
                hasil = Int32.Parse(RouteMilleage) * (Int32.Parse(CostRate) / 2);
            }
            if (CostCalculationMethod.Equals("PerMilesWithCondition"))
            {
                var nilai = 0;
                if (condition == "GoodWeather")
                {
                    nilai = 5;
                }
                else if (condition == "BadWeather")
                {
                    nilai = 15;
                }
                hasil = (Int32.Parse(RouteMilleage) * Int32.Parse(CostRate) / 2) * (((nilai + (userDemand / 50)) + 95)) / 100;
            }
            return(hasil * (Convert.ToDecimal(110) / Convert.ToDecimal(100)));
        }
Beispiel #3
0
        public int rateCostCalculation(string Condition, int UserDemand)
        {
            var hasil = 0;

            if (CostCalculationMethod.Equals("FixPerRoute"))
            {
                hasil = 1 * CostRate;
            }
            if (CostCalculationMethod.Equals("PerMiles"))
            {
                hasil = RouteMilleage * (CostRate / 2);
            }
            if (CostCalculationMethod.Equals("PerMilesWithCondition"))
            {
                var nilai = 0;
                if (Condition == "GoodWeather")
                {
                    nilai = 5;
                }
                else if (Condition == "BadWeather")
                {
                    nilai = 15;
                }
                hasil = (RouteMilleage * CostRate / 2) * (((nilai + (UserDemand / 50)) + 95)) / 100;
            }


            return(hasil);
        }
        public decimal?RateCostCalculation(string condition, int?userDemand, decimal?Duration)
        {
            int?valueResult = null;

            if (CostCalculationMethod.Equals("FixPerRoute"))
            {
                valueResult = 1 * Int32.Parse(CostRate);
            }
            if (CostCalculationMethod.Equals("PerMiles"))
            {
                valueResult = Int32.Parse(RouteMilleage) * (Int32.Parse(CostRate) / 2);
            }
            if (CostCalculationMethod.Equals("PerMilesWithCondition"))
            {
                var nilai = 0;
                if (condition == "GoodWeather")
                {
                    nilai = 5;
                }
                else if (condition == "BadWeather")
                {
                    nilai = 15;
                }
                valueResult = (Int32.Parse(RouteMilleage) * Int32.Parse(CostRate) / 2) * (((nilai + (userDemand / 50)) + 95)) / 100;
            }
            return(valueResult * (Convert.ToDecimal(110) / Convert.ToDecimal(100)));
        }
Beispiel #5
0
        public int RateCostCalculation(string condition, int userDemand)
        {
            var hitung = 0;

            if (CostCalculationMethod.Equals("FixPerRoute"))
            {
                hitung = 1 * this.CostRate;
            }
            if (CostCalculationMethod.Equals("PerMiles"))
            {
                hitung = (this.RouteMilleage * this.CostRate) / 2;
            }
            if (CostCalculationMethod.Equals("PerMilesWithCondition"))
            {
                var tamp = 0;
                if (condition == "GoodWeather")
                {
                    tamp = 5;
                }
                else if (condition == "BadWeather")
                {
                    tamp = 15;
                }
                hitung = (RouteMilleage * CostRate / 2) * (((tamp + (userDemand / 50)) + 95)) / 100;
            }

            return(hitung);
        }
        public override decimal calculateProductCost()
        {
            decimal DecCostRate = decimal.Parse(CostRate);
            var     temp        = this.parameter;

            if (CostCalculationMethod.Equals("PerSecond"))
            {
                return(DecCostRate * this.parameter.getNonNullDuration());
            }
            else if (CostCalculationMethod.Equals("PerPacket"))
            {
                if (PacketType.Equals("Data"))
                {
                    return(decimal.Parse(PacketLimit) * DecCostRate);
                }
                else
                {
                    return(DecCostRate * this.parameter.getNonNullDuration());
                }
            }
            else
            {
                return(0);
            }
        }