public XmlDocument SaveInXml() { var doc = new XmlDocument(); var root = doc.AppendChild(doc.CreateElement("account")); DealInfo.AddAttribute(root, "Id", Id); DealInfo.AddAttribute(root, "Broker", Broker); DealInfo.AddAttribute(root, "Account", Account); DealInfo.AddAttribute(root, "Trader", Trader); DealInfo.AddAttribute(root, "Login", Login); DealInfo.AddAttribute(root, "InitBalance", InitBalance); var rootDeal = root.AppendChild(doc.CreateElement("deals")); foreach (var deal in deals) { deal.SaveInXml(rootDeal); } var rootBalance = root.AppendChild(doc.CreateElement("balances")); foreach (var balance in balances) { balance.SaveInXml(rootBalance); } return(doc); }
public BalanceInfo(XmlNode dealNode) { Ticket = dealNode.Attributes["Ticket"].Value; Date = DateTime.ParseExact(dealNode.Attributes["Date"].Value, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); Amount = DealInfo.ParseDecimalSafe(dealNode.Attributes["Amount"].Value); }
public void SaveInXml(XmlNode parent) { var nod = parent.AppendChild(parent.OwnerDocument.CreateElement("balance")); DealInfo.AddAttribute(nod, "Ticket", Ticket); DealInfo.AddAttribute(nod, "Amount", Amount); DealInfo.AddAttribute(nod, "Date", Date); }
public BalanceInfo(List <string> cells) { Ticket = cells[0]; Amount = DealInfo.ParseDecimalSafe(cells[3]); Date = DateTime.ParseExact(cells[1], "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); }