Ejemplo n.º 1
0
        public void Deserialize(XmlNode node)
        {
            bool tempBool;

            foreach (XmlNode childNode in node.ChildNodes)
            {
                switch (childNode.Name)
                {
                case "UniqueID":
                {
                    Guid temp;
                    if (Guid.TryParse(childNode.InnerText, out temp))
                    {
                        UniqueID = temp;
                    }
                }
                break;

                case "Index":
                {
                    double temp;
                    if (Double.TryParse(childNode.InnerText, out temp))
                    {
                        Index = temp;
                    }
                }
                break;

                case "Name":
                    Name = childNode.InnerText;
                    break;

                case "ShowAverageRate":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowAverageRate = tempBool;
                    }
                    break;

                case "ShowCPP":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowCPP = tempBool;
                    }
                    break;

                case "ShowCost":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowCost = tempBool;
                    }
                    break;

                case "ShowDay":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowDay = tempBool;
                    }
                    break;

                case "ShowDaypart":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowDaypart = tempBool;
                    }
                    break;

                case "ShowDiscount":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowDiscount = tempBool;
                    }
                    break;

                case "ShowGRP":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowGRP = tempBool;
                    }
                    break;

                case "ShowLenght":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowLenght = tempBool;
                    }
                    break;

                case "ShowLogo":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowLogo = tempBool;
                    }
                    break;

                case "ShowNetRate":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowNetRate = tempBool;
                    }
                    break;

                case "ShowRate":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowRate = tempBool;
                    }
                    break;

                case "ShowRating":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowRating = tempBool;
                    }
                    break;

                case "ShowStation":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowStation = tempBool;
                    }
                    break;

                case "ShowProgram":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowProgram = tempBool;
                    }
                    break;

                case "ShowTime":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowTime = tempBool;
                    }
                    break;

                case "ShowSpots":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowSpots = tempBool;
                    }
                    break;

                case "ShowEmptySpots":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowEmptySpots = tempBool;
                    }
                    break;

                case "ShowTotalCPP":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowTotalCPP = tempBool;
                    }
                    break;

                case "ShowTotalGRP":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowTotalGRP = tempBool;
                    }
                    break;

                case "ShowTotalPeriods":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowTotalPeriods = tempBool;
                    }
                    break;

                case "ShowTotalRate":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowTotalRate = tempBool;
                    }
                    break;

                case "ShowTotalSpots":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        ShowTotalSpots = tempBool;
                    }
                    break;

                case "OutputPerQuater":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        OutputPerQuater = tempBool;
                    }
                    break;

                case "OutputMaxPeriods":
                {
                    int temp;
                    if (Int32.TryParse(childNode.InnerText, out temp))
                    {
                        OutputMaxPeriods = temp;
                    }
                }
                break;

                case "OutputNoBrackets":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        OutputNoBrackets = tempBool;
                    }
                    break;

                case "UseDecimalRates":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        UseDecimalRates = tempBool;
                    }
                    break;

                case "UseGenericDateColumns":
                    if (bool.TryParse(childNode.InnerText, out tempBool))
                    {
                        UseGenericDateColumns = tempBool;
                    }
                    break;

                case "Programs":
                    foreach (XmlNode programNode in childNode.ChildNodes)
                    {
                        var program = new Program(this);
                        program.Deserialize(programNode);
                        Programs.Add(program);
                    }
                    break;

                case "Summary":
                    Summary.Deserialize(childNode);
                    break;

                case "ContractSettings":
                    ContractSettings.Deserialize(childNode);
                    break;
                }
            }
        }