Exemplo n.º 1
0
        private TariffOfTurningLimited GetTariffOfTurningLimitedFromInput()
        {
            TariffOfTurningLimited tariff = new TariffOfTurningLimited();

            tariff.FreeMinutes  = (byte)this.tpd_txtFreeMinutes.IntergerValue;
            tariff.FirstFee     = this.tpd_txtFirstFee.DecimalValue;
            tariff.Turning      = new TimeEntity(tpd_dtTurning.Value.Hour, tpd_dtTurning.Value.Minute);
            tariff.FeeOfTurning = this.tpd_FeeOfTurning.DecimalValue;
            tariff.FeeOfMax     = this.chkTuringLimitedOfMax.Checked ? this.txtTuringLimitedOfMax.DecimalValue : 0;
            return(tariff);
        }
Exemplo n.º 2
0
 private void ShowTariff(TariffOfTurningLimited info)
 {
     this.rdTariffOfTurningLimited.Checked = true;
     this.tpd_txtFreeMinutes.IntergerValue = info.FreeMinutes;
     this.tpd_txtFirstFee.DecimalValue     = info.FirstFee;
     this.tpd_dtTurning.Value           = new DateTime(2000, 1, 1, info.Turning.Hour, info.Turning.Minute, 0);
     this.tpd_FeeOfTurning.DecimalValue = info.FeeOfTurning;
     this.chkTuringLimitedOfMax.Checked = info.FeeOfMax > 0;
     if (this.chkTuringLimitedOfMax.Checked)
     {
         this.txtTuringLimitedOfMax.DecimalValue = info.FeeOfMax;
     }
 }
Exemplo n.º 3
0
        public void TariffOfTurningLimitedTest()
        {
            //免费0分钟,入场收取10元,过第二天6点改收30元,此后每过6点加收30元
            TariffOfTurningLimited tariff = new TariffOfTurningLimited();

            tariff.FreeMinutes  = 0;
            tariff.FirstFee     = 10;
            tariff.Turning      = new TimeEntity(6, 0); //6点钟为转折点
            tariff.FeeOfTurning = 30;

            Assert.IsTrue(tariff.CalculateFee(new DateTime(2012, 1, 17, 2, 11, 13), new DateTime(2012, 1, 18, 6, 0, 0)) == 40);
            Assert.IsTrue(tariff.CalculateFee(new DateTime(2012, 1, 17, 2, 11, 13), new DateTime(2012, 1, 18, 6, 01, 43)) == 70);
            Assert.IsTrue(tariff.CalculateFee(new DateTime(2012, 1, 17, 6, 1, 50), new DateTime(2012, 1, 18, 6, 0, 0)) == 10);
            Assert.IsTrue(tariff.CalculateFee(new DateTime(2012, 1, 17, 6, 1, 50), new DateTime(2012, 1, 18, 6, 1, 50)) == 40);

            Assert.IsTrue(tariff.CalculateFee(new DateTime(2012, 1, 17, 6, 1, 50), new DateTime(2012, 1, 19, 6, 1, 50)) == 70);
            Assert.IsTrue(tariff.CalculateFee(new DateTime(2012, 1, 17, 6, 1, 50), new DateTime(2012, 1, 19, 6, 0, 13)) == 70);
        }