Exemple #1
0
        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);
        }
Exemple #2
0
 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);
 }
Exemple #3
0
        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);
        }
Exemple #4
0
 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);
 }