public void LoadSavedState(SimpleSummaryItemState itemState) { ckItem.Checked = itemState.ShowValue; ckDetails.Checked = itemState.ShowDescription; ckMonthly.Checked = itemState.ShowMonthly; ckTotal.Checked = itemState.ShowTotal; textEditItem.EditValue = !string.IsNullOrEmpty(itemState.Value) ? itemState.Value : null; memoEditDetails.EditValue = !string.IsNullOrEmpty(itemState.Description) ? itemState.Description : null; spinEditMonthly.EditValue = itemState.ShowMonthly ? itemState.Monthly : null; spinEditTotal.EditValue = itemState.ShowTotal ? itemState.Total : null; }
public void SaveItems() { ViewSettingsManager.Instance.SimpleSummaryState.ItemsState.Clear(); foreach (var item in _itemsCollection) { var itemState = new SimpleSummaryItemState(); itemState.Order = item.ItemNumber; itemState.ShowValue = item.ShowValue; itemState.ShowDescription = item.ShowDescription; itemState.ShowMonthly = item.ShowMonthly; itemState.ShowTotal = item.ShowTotal; itemState.Value = item.ItemTitle; itemState.Description = item.ItemDetail; itemState.Monthly = item.MonthlyValue; itemState.Total = item.TotalValue; ViewSettingsManager.Instance.SimpleSummaryState.ItemsState.Add(itemState); } ViewSettingsManager.Instance.SimpleSummaryState.ItemsState.Sort((x, y) => x.Order.CompareTo(y.Order)); }
protected override void Deserialize(XmlNode node) { base.Deserialize(node); PresentationDate = DateTime.MinValue; FlightDatesStart = DateTime.MinValue; FlightDatesEnd = DateTime.MinValue; foreach (XmlNode childNode in node.ChildNodes) { bool tempBool = false; DateTime tempDateTime; decimal tempDecimal = 0; switch (childNode.Name) { case "ShowAdvertiser": if (bool.TryParse(childNode.InnerText, out tempBool)) ShowAdvertiser = tempBool; break; case "ShowDecisionMaker": if (bool.TryParse(childNode.InnerText, out tempBool)) ShowDecisionMaker = tempBool; break; case "ShowPresentationDate": if (bool.TryParse(childNode.InnerText, out tempBool)) ShowPresentationDate = tempBool; break; case "ShowFlightDates": if (bool.TryParse(childNode.InnerText, out tempBool)) ShowFlightDates = tempBool; break; case "ShowMonthly": if (bool.TryParse(childNode.InnerText, out tempBool)) ShowMonthly = tempBool; break; case "ShowTotal": if (bool.TryParse(childNode.InnerText, out tempBool)) ShowTotal = tempBool; break; case "TableOutput": if (bool.TryParse(childNode.InnerText, out tempBool)) TableOutput = tempBool; break; case "SlideHeader": SlideHeader = childNode.InnerText; break; case "Advertiser": Advertiser = childNode.InnerText; break; case "DecisionMaker": DecisionMaker = childNode.InnerText; break; case "PresentationDate": if (DateTime.TryParse(childNode.InnerText, out tempDateTime)) PresentationDate = tempDateTime; break; case "FlightDatesStart": if (DateTime.TryParse(childNode.InnerText, out tempDateTime)) FlightDatesStart = tempDateTime; break; case "FlightDatesEnd": if (DateTime.TryParse(childNode.InnerText, out tempDateTime)) FlightDatesEnd = tempDateTime; break; case "MonthlyValue": if (Decimal.TryParse(childNode.InnerText, out tempDecimal)) MonthlyValue = tempDecimal; break; case "TotalValue": if (Decimal.TryParse(childNode.InnerText, out tempDecimal)) TotalValue = tempDecimal; break; case "Items": ItemsState.Clear(); foreach (XmlNode itemNode in childNode.ChildNodes) { var item = new SimpleSummaryItemState(); item.Deserialize(itemNode); ItemsState.Add(item); } ItemsState.Sort((x, y) => x.Order.CompareTo(y.Order)); break; case "ContractSettings": ContractSettings.Deserialize(childNode); break; } } }
protected override void Deserialize(XmlNode node) { base.Deserialize(node); PresentationDate = DateTime.MinValue; FlightDatesStart = DateTime.MinValue; FlightDatesEnd = DateTime.MinValue; foreach (XmlNode childNode in node.ChildNodes) { bool tempBool = false; DateTime tempDateTime; decimal tempDecimal = 0; switch (childNode.Name) { case "ShowAdvertiser": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowAdvertiser = tempBool; } break; case "ShowDecisionMaker": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowDecisionMaker = tempBool; } break; case "ShowPresentationDate": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowPresentationDate = tempBool; } break; case "ShowFlightDates": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowFlightDates = tempBool; } break; case "ShowMonthly": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowMonthly = tempBool; } break; case "ShowTotal": if (bool.TryParse(childNode.InnerText, out tempBool)) { ShowTotal = tempBool; } break; case "TableOutput": if (bool.TryParse(childNode.InnerText, out tempBool)) { TableOutput = tempBool; } break; case "SlideHeader": SlideHeader = childNode.InnerText; break; case "Advertiser": Advertiser = childNode.InnerText; break; case "DecisionMaker": DecisionMaker = childNode.InnerText; break; case "PresentationDate": if (DateTime.TryParse(childNode.InnerText, out tempDateTime)) { PresentationDate = tempDateTime; } break; case "FlightDatesStart": if (DateTime.TryParse(childNode.InnerText, out tempDateTime)) { FlightDatesStart = tempDateTime; } break; case "FlightDatesEnd": if (DateTime.TryParse(childNode.InnerText, out tempDateTime)) { FlightDatesEnd = tempDateTime; } break; case "MonthlyValue": if (Decimal.TryParse(childNode.InnerText, out tempDecimal)) { MonthlyValue = tempDecimal; } break; case "TotalValue": if (Decimal.TryParse(childNode.InnerText, out tempDecimal)) { TotalValue = tempDecimal; } break; case "Items": ItemsState.Clear(); foreach (XmlNode itemNode in childNode.ChildNodes) { var item = new SimpleSummaryItemState(); item.Deserialize(itemNode); ItemsState.Add(item); } ItemsState.Sort((x, y) => x.Order.CompareTo(y.Order)); break; case "ContractSettings": ContractSettings.Deserialize(childNode); break; } } }