public DataStructureObject DoWork(DataStructureObject d, List <String> exceptedList) { foreach (var item in d.inputList) { var dReturn = this.DoWorkSingleItem(item, exceptedList); item.productEvaluatedPrice = dReturn.productEvaluatedPrice; item.tax = dReturn.tax; } d.taxTotalAmount = d.inputList.Sum(x => x.tax); d.totalAmount = d.inputList.Sum(x => x.productglobalPrice); return(d); }
public void LoadData(DataStructureObject d) { Items.Add(d); }
public DataStructure LoadTestData() { DataStructure Items = new DataStructure(); DataStructureObject input1Object = new DataStructureObject(); input1Object.inputList = new List <DataStructureItem>(); input1Object.inputList.Add(new DataStructureItem() { productName = "book", productQuantity = 2, isImported = false, productPrice = 12.49, productglobalPrice = 24.98, productEvaluatedPrice = 0, DataStructureType = "book", input = InputEnum.input1, tax = 0 }); input1Object.inputList.Add(new DataStructureItem() { productName = "music CD", productQuantity = 1, isImported = false, productPrice = 14.99, productglobalPrice = 16.49, productEvaluatedPrice = 0, DataStructureType = "music", input = InputEnum.input1, tax = 0 }); input1Object.inputList.Add(new DataStructureItem() { productName = "chocolate bar", productQuantity = 1, isImported = false, productPrice = 0.85, productglobalPrice = 0.85, productEvaluatedPrice = 0, DataStructureType = "food", input = InputEnum.input1, tax = 0 }); input1Object.taxTotalAmount = 0; input1Object.totalAmount = 0; Items.LoadData(input1Object); DataStructureObject input2Object = new DataStructureObject(); input2Object.inputList = new List <DataStructureItem>(); input2Object.inputList.Add(new DataStructureItem() { productName = "imported box of chocolates", productQuantity = 1, isImported = true, productPrice = 10.00, productglobalPrice = 10.50, productEvaluatedPrice = 0, DataStructureType = "food", input = InputEnum.input2, tax = 0 }); input2Object.inputList.Add(new DataStructureItem() { productName = "imported bottle of perfume", productQuantity = 1, isImported = true, productPrice = 47.50, productglobalPrice = 54.65, productEvaluatedPrice = 0, DataStructureType = "perfume", input = InputEnum.input2, tax = 0 }); input2Object.taxTotalAmount = 0; input2Object.totalAmount = 0; Items.LoadData(input2Object); DataStructureObject input3Object = new DataStructureObject(); input3Object.inputList = new List <DataStructureItem>(); input3Object.inputList.Add(new DataStructureItem() { productName = "imported bottle of perfume", productQuantity = 1, isImported = true, productPrice = 27.99, productglobalPrice = 32.19, productEvaluatedPrice = 0, DataStructureType = "perfume", input = InputEnum.input3, tax = 0 }); input3Object.inputList.Add(new DataStructureItem() { productName = "bottle of perfume", productQuantity = 1, isImported = false, productPrice = 18.99, productglobalPrice = 20.89, productEvaluatedPrice = 0, DataStructureType = "perfume", input = InputEnum.input3, tax = 0 }); input3Object.inputList.Add(new DataStructureItem() { productName = "packet of headache pills", productQuantity = 1, isImported = false, productPrice = 9.75, productglobalPrice = 9.75, productEvaluatedPrice = 0, DataStructureType = "medical", input = InputEnum.input3, tax = 0 }); input3Object.inputList.Add(new DataStructureItem() { productName = "box of imported chocolates", productQuantity = 3, isImported = true, productPrice = 11.25, productglobalPrice = 35.55, productEvaluatedPrice = 0, DataStructureType = "food", input = InputEnum.input3, tax = 0 }); input3Object.taxTotalAmount = 0; input3Object.totalAmount = 0; Items.LoadData(input3Object); return(Items); }