public Transaction(TransactionSaveFile savedTransaction) { Type = savedTransaction.Type; DateTimePurchase = savedTransaction.PurchaseTime; Cost = savedTransaction.Cost; foreach (KeyValuePair <string, double> item in savedTransaction.ItemsBought) { ItemsBought.Add(new Purchase(World.Current.GetItemFromShopShelf(item.Key), item.Value)); } }
public WorkingDaySaveFile(WorkingDay wd, int Num) { Date = wd.Date; OpeningTime = wd.OpeningTime; ClosingTime = wd.ClosingTime; if (Num != 0) { //We save today first, so if num is 0 we're saving today foreach (Transaction t in wd.transactions) { //Should only be one of each if (t.Type == Words.Current.CustomerPurchase) { CustomerCosts = t.Cost; } else if (t.Type == Words.Current.ShopOrder) { OrderCosts = t.Cost; } } } else { int i = 1; foreach (Transaction t in wd.transactions) { TransactionSaveFile save = new TransactionSaveFile(t, i); i++; } } EmployeeStartTimes = new Dictionary <int, DateTime>(); foreach (KeyValuePair <Employee, DateTime> emDa in wd.EmployeesStartingTimes) { EmployeeStartTimes.Add(emDa.Key.EmployeeID, emDa.Value); } EmployeeEndTimes = new Dictionary <int, DateTime>(); foreach (KeyValuePair <Employee, DateTime> emDa in wd.EmployeeEndTimes) { EmployeeEndTimes.Add(emDa.Key.EmployeeID, emDa.Value); } string JSON = JsonUtility.ToJson(this); PlayerPrefs.SetString("WorkingDay" + Num, JSON); }