示例#1
0
        public static void SerializeTransaction(StockPlayer player, Offer offer)
        {
            XDocument document;

            try
            {
                document = XDocument.Load("transactions.txt");
            }
            catch
            {
                document = new XDocument(new XElement("Transactions"));
            }

            document.Root.Add(new XElement("Transaction",
                                           new XElement("Player", player.Name),
                                           new XElement("DateOfTransaction", DateTime.UtcNow),
                                           new XElement("Date", offer.Date.ToString()),
                                           new XElement("Instrument", offer.Instrument),
                                           new XElement("Value", offer.Value.ToString())
                                           ));
            document.Save("transactions.txt");
        }
示例#2
0
 public void Subscribe(StockPlayer stockPlayer)
 {
     subscribers.Add(stockPlayer);
 }