コード例 #1
0
ファイル: ShoppingCart.cs プロジェクト: njmube/SIQPOS
 public ShoppingCart(Guid sessionId, string userName, Currency currency, TaxRate taxRate, ChargeRate chargeRate)
 {
     this.Id = Guid.NewGuid();
     this.SessionId = sessionId;
     this.UserName = userName;
     this.Items = new List<Item>();
     this.ItemsRemoved = new List<ItemRemoved>();
     this.Date = DateTime.Now;
     this.Currency = currency;
     this.TransactionNumber = string.Empty;
     this.Note = string.Empty;
     this.Payment = new Payment(PaymentTypes.Cash, 0d, 0d);
     var chargeAmount = chargeRate.Apply(0d);
     var taxAmount = taxRate.Apply(0d);
     var discountAmount = DiscountRate.None.Apply(0d, 0);
     this.Summary = new Summary(taxAmount, discountAmount, chargeAmount, 0d);
 }
コード例 #2
0
ファイル: ShoppingCart.cs プロジェクト: njmube/SIQPOS
 private void CalculateCharge()
 {
     if (Summary.ChargeAmount.Percent > 0)
     {
         var chargeRate = new ChargeRate(ChargeType.Percent, Summary.ChargeAmount.Percent);
         var chargeAmount = chargeRate.Apply(Summary.SubTotal - Summary.DiscountTotalAmount);
         this.Summary = new Summary(Summary.TaxAmount, Summary.DiscountTotalAmount, chargeAmount, Summary.SubTotal);
     }
 }
コード例 #3
0
ファイル: ShoppingCart.cs プロジェクト: njmube/SIQPOS
 public void ChangeCharge(ChargeRate chargeRate)
 {
     var chargeAmount = chargeRate.Apply(Summary.SubTotal);
     this.Summary = new Summary(Summary.TaxAmount, Summary.DiscountTotalAmount, chargeAmount, Summary.SubTotal);
     CalculateCharge();
     CalculateTax();
 }