static public Project.EquityData GetData_FromEquityXML(string strXML) { Project.EquityData result = new Project.EquityData(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(strXML); XmlNodeList BasicParams = xmlDoc.GetElementsByTagName("EquityData"); XmlNode BasicParam = BasicParams.Item(0); XmlNodeList InnerParams = BasicParam.ChildNodes; XmlNode tmpStr = InnerParams[0]; for (int i = 0; i < InnerParams.Count; i++) { if (InnerParams[i].Name.Equals("Amount")) { result.Amount = ToDouble(InnerParams[i].InnerText); } if (InnerParams[i].Name.Equals("IncrRate")) { result.Appreciation = ToDouble(InnerParams[i].InnerText); } if (InnerParams[i].Name.Equals("HasSchedule")) { result.HasSchedule = Convert.ToBoolean(InnerParams[i].InnerText); } if (InnerParams[i].Name.Equals("Interest")) { result.Interest = ToDouble(InnerParams[i].InnerText); } if (InnerParams[i].Name.Equals("Schedule")) { tmpStr = InnerParams[i]; } } if (result.HasSchedule) { result.Schedule = new double[tmpStr.ChildNodes.Count]; int count = 0; foreach (XmlNode SubParam in tmpStr.ChildNodes) { result.Schedule[count] = ToDouble(SubParam.InnerText); count++; } } return(result); }
static public string Create_EquityXML(Project.EquityData data) { string result = "<EquityData>"; result += "<Amount>" + data.Amount + "</Amount>"; result += "<IncrRate>" + data.Appreciation + "</IncrRate>"; result += "<HasSchedule>" + data.HasSchedule + "</HasSchedule>"; result += "<Interest>" + data.Interest + "</Interest>"; result += "<Schedule>"; if (data.HasSchedule) { for (int i = 0; i < data.Schedule.Length; i++) { result += "<Month" + (i + 1).ToString() + ">" + data.Schedule[i].ToString() + "</Month" + (i + 1).ToString() + ">"; } } result += "</Schedule>"; result += "</EquityData>"; return(result); }
static public BasicErrors DoBasicChecks(double ConcP, int CP, int Delay, Project.Coin coin, Project.EquityData equityData) { if (CP / 12.0 > ConcP) { return(BasicErrors.ConstructionPeriod_Bigger_ConcP); } if (CP < Delay) { return(BasicErrors.ConstructionPeriod_Smaller_Delay); } if ((CP + Delay) / 12.0 > ConcP) { return(BasicErrors.ConstructionPeriodAndDelay_Bigger_ConcP); } if (coin.DebtTenor < (CP + Delay) / 12) { return(BasicErrors.CoinGP_Bigger_Tenor); } if (equityData.Interest > coin.RateDuringCP) { return(BasicErrors.OtherInvestorEquity_Bigger_CoinInterest); } return(BasicErrors.NoError); }