Beispiel #1
0
        public void Fill(string area, string stockCode)
        {
            Console.WriteLine("正在处理: " + stockCode);
            var cwzyLst = new List<CWZY>();

            using (var db = new StockContext1())
            {
                var htmlContent = webClient.DownloadString(string.Format(baseUrl, stockCode));
                DomFinder _finder = new DomFinder(htmlContent);

                var table = _finder.Find.AllByTagName<HtmlTable>("table")[19];

                for (int i = 0; i < table.Rows.Count;)
                {
                    if ((i % 13) == 0)
                    {
                        CWZY cwzy = new CWZY();
                        cwzy.jzrq = Convert.ToDateTime(table.Rows[i].Cells[1].InnerText);
                        cwzy.mgjzc = Convert.ToDecimal(removeLastChar(table.Rows[i + 1].Cells[1].InnerText));
                        cwzy.mgsy = Convert.ToDecimal(removeLastChar(table.Rows[i + 2].Cells[1].InnerText));
                        cwzy.mgxjhl = Convert.ToDecimal(removeLastChar(table.Rows[i + 3].Cells[1].InnerText));
                        cwzy.mgzbgjj = Convert.ToDecimal(removeLastChar(table.Rows[i + 4].Cells[1].InnerText));
                        cwzy.mgzchj = Convert.ToDecimal(removeLastChar(table.Rows[i + 5].Cells[1].InnerText));
                        cwzy.ldzchj = Convert.ToDecimal(removeLastChar(table.Rows[i + 6].Cells[1].InnerText));
                        cwzy.zchj = Convert.ToDecimal(removeLastChar(table.Rows[i + 7].Cells[1].InnerText));
                        cwzy.cqfzhj = Convert.ToDecimal(removeLastChar(table.Rows[i + 8].Cells[1].InnerText));
                        cwzy.zyywsr = Convert.ToDecimal(removeLastChar(table.Rows[i + 9].Cells[1].InnerText));
                        cwzy.cwfy = Convert.ToDecimal(removeLastChar(table.Rows[i + 10].Cells[1].InnerText));
                        cwzy.jlr = Convert.ToDecimal(removeLastChar(table.Rows[i + 11].Cells[1].InnerText));
                        cwzy.stockCode = stockCode;

                        cwzy.Id = GuidCombGenerator.NewGuid();
                        db.T_cwzy.AddObject(cwzy);
                        i += 13;
                    }
                }

                db.SaveChanges();
            }
        }
Beispiel #2
0
 /// <summary>
 /// Create a new CWZY object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="stockCode">Initial value of the stockCode property.</param>
 public static CWZY CreateCWZY(global::System.Guid id, global::System.String stockCode)
 {
     CWZY cWZY = new CWZY();
     cWZY.Id = id;
     cWZY.stockCode = stockCode;
     return cWZY;
 }
Beispiel #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the T_cwzy EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToT_cwzy(CWZY cWZY)
 {
     base.AddObject("T_cwzy", cWZY);
 }