Beispiel #1
0
        static public string Create_SGAXML(Project.SGA sga)
        {
            string result = "<SGA>";

            result += "<Rate>" + sga.Rate + "</Rate>";
            result += "<Type>" + sga.Type + "</Type>";
            result += "<MinCost>" + sga.MinCost + "</MinCost>";

            result += "</SGA>";

            return(result);
        }
Beispiel #2
0
        static public Project.SGA GetData_FromSGAXML(string strXML)
        {
            Project.SGA result = new Project.SGA();

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(strXML);

            XmlNode BasicParam = xmlDoc.GetElementsByTagName("SGA").Item(0);

            XmlNodeList InnerParams = BasicParam.ChildNodes;

            for (int i = 0; i < InnerParams.Count; i++)
            {
                if (InnerParams[i].Name.Equals("Rate"))
                {
                    result.Rate = ToDouble(InnerParams[i].InnerText);
                }
                if (InnerParams[i].Name.Equals("Type"))
                {
                    switch (InnerParams[i].InnerText)
                    {
                    case "Total Revenues":
                        result.Type = Project.SGAType.TotalRevenues;
                        break;

                    case "Gross Income":
                        result.Type = Project.SGAType.GrossIncome;
                        break;
                    }
                }
                if (InnerParams[i].Name.Equals("MinCost"))
                {
                    result.MinCost = ToDouble(InnerParams[i].InnerText);
                }
            }

            return(result);
        }