Пример #1
0
        public Config(string name)
        {
            try
            {
                XmlDocument xd = new XmlDocument();
                xd.Load(name);

                connectionString = xd.SelectSingleNode("/Config/DB/ConnectionString").InnerText;
                
                XmlNodeList nodeList = xd.SelectNodes("/Config/Stocks/Stock");
                for (int i = 0; i < nodeList.Count; i++)
                {
                    Stock stock = new Stock();
                    stock.url = nodeList[i].Attributes[0].InnerText;
                    stock.table = nodeList[i].Attributes[1].InnerText;
                    stock.source = nodeList[i].Attributes[2].InnerText;
                    stock.market = nodeList[i].Attributes[3].InnerText;
                    stock.type = nodeList[i].Attributes[4].InnerText;
                    stock.desc = nodeList[i].Attributes[5].InnerText;

                    stocks.Add(stock);
                }

                xd = null;
            }
            catch (Exception)
            {
            }
        }
Пример #2
0
 public static string InsertStockObject(Stock stock, StockObject so)
 {
     string queryTemp = "INSERT INTO {0} (smarket,stype,symbol,name,last_trade,last_trade_time,change,change_percent,volume) VALUES('{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')";
     return string.Format(queryTemp, stock.table, stock.market, stock.type, so.symbol, so.name, so.lastTrade, so.lastTreadTime, so.change, so.changePercent, so.volume);
 }
Пример #3
0
 public static string DeleteAllStockObjects(Stock stock)
 {
     string queryTemp = "DELETE FROM {0} WHERE smarket='{1}' AND stype='{2}'";
     return string.Format(queryTemp, stock.table, stock.market, stock.type);
 }