public COrder(string orderid, CStore storeLocation, CCustomer customer, DateTime orderedTime) { Orderid = orderid; StoreLocation = storeLocation; Customer = customer; OrderedTime = orderedTime; }
public COrder(string orderid, CStore storeLocation, CCustomer customer, double totalCost) { Orderid = orderid; StoreLocation = storeLocation; Customer = customer; TotalCost = totalCost; }
/// <summary> /// parameterized constructor /// </summary> public COrder(CStore storeLocation, CCustomer customer, DateTime orderedTime, double totalCost, List <CProduct> productList) { StoreLocation = storeLocation; Customer = customer; OrderedTime = orderedTime; TotalCost = totalCost; ProductList = productList; }
public COrder(string orderid, CStore storeLocation, CCustomer customer, DateTime orderedTime, double totalCost) { Orderid = orderid; StoreLocation = storeLocation; Customer = customer; OrderedTime = orderedTime; TotalCost = totalCost; }
/// <summary> /// original behavior to serialize and write data /// </summary> public void WriteStoreData(CStore data) { JsonSerializer serializer = new JsonSerializer(); serializer.Converters.Add(new Newtonsoft.Json.Converters.IsoDateTimeConverter()); serializer.NullValueHandling = NullValueHandling.Ignore; serializer.TypeNameHandling = TypeNameHandling.Auto; serializer.Formatting = Formatting.Indented; using (StreamWriter sw = new StreamWriter(path)) using (JsonWriter writer = new JsonTextWriter(sw)) { serializer.Serialize(writer, data, typeof(CStore)); } /* * string json = JsonConvert.SerializeObject(data); * File.WriteAllText(path,json); */ }
/// <summary> /// customer's behavior to place an order at a store /// <summary> public void PlaceOrder(CStore storeLocation, COrder newOrder) { storeLocation.UpdateInventoryAndCustomerOrder(newOrder); }