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); }
public void Insert(ReceiptRecord receiptRecord) { using (var context = new TrianglesDataContext()) { context.ReceiptRecords.InsertOnSubmit(receiptRecord); context.SubmitChanges(); } }
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(); } }
public void ProcessProduct(string barcode) { var itemName = string.Format("Item #{0}", barcode); var receiptRecord = new ReceiptRecord(itemName, _catalog[barcode]); ProcessProduct(receiptRecord); }