Пример #1
0
 public void ProcessProduct(ReceiptRecord receiptRecord)
 {
     _receipt.AddRecord(receiptRecord);
     _receipt.NetTotal += receiptRecord.PriceInfo.NetPrice;
     _receipt.GstTotal += SalesCalculator.CalculateGst(receiptRecord.PriceInfo);
     _receipt.PstTotal += SalesCalculator.CalculatePst(receiptRecord.PriceInfo);
     _receipt.Total += SalesCalculator.CalculateCost(receiptRecord.PriceInfo);
 }
Пример #2
0
 public void Insert(ReceiptRecord receiptRecord)
 {
     using (var context = new TrianglesDataContext())
     {
         context.ReceiptRecords.InsertOnSubmit(receiptRecord);
         context.SubmitChanges();
     }
 }
Пример #3
0
        public void Update(ReceiptRecord receiptRecord)
        {
            using (var context = new TrianglesDataContext())
            {
                var existedReceiptRecord = context.ReceiptRecords.First(x => x.Id == receiptRecord.Id);

                existedReceiptRecord.Participant = receiptRecord.Participant;
                existedReceiptRecord.Description = receiptRecord.Description;
                existedReceiptRecord.Amount = receiptRecord.Amount;

                context.SubmitChanges();
            }
        }
Пример #4
0
 public void ProcessProduct(string barcode)
 {
     var itemName = string.Format("Item #{0}", barcode);
     var receiptRecord = new ReceiptRecord(itemName, _catalog[barcode]);
     ProcessProduct(receiptRecord);
 }