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; } } }