private void ParseStockList(string sSymbol, List<string[]> lStockInfo) { var currentStock = from cs in db.StockDatas where cs.Symbol == sSymbol select cs; db.StockDatas.DeleteAllOnSubmit(currentStock); db.SubmitChanges(); foreach (string[] sStockDay in lStockInfo) { DateTime dtDate = DateTime.Parse(sStockDay[0]); StockData sd = new StockData(); sd.Id = Guid.NewGuid(); sd.Symbol = sSymbol; sd.Day = dtDate; sd.Price_Open = decimal.Parse(sStockDay[1]); sd.Price_High = decimal.Parse(sStockDay[2]); sd.Price_Low = decimal.Parse(sStockDay[3]); sd.Price_Close = decimal.Parse(sStockDay[4]); sd.Volume = int.Parse(sStockDay[5]); sd.Unknown_Value = decimal.Parse(sStockDay[6]); db.StockDatas.InsertOnSubmit(sd); this.OnStockDayComplete(new EventArgs(), sSymbol, dtDate); } db.SubmitChanges(); this.OnFileComplete(new EventArgs(), sSymbol); this.iCurrentFile++; }
partial void UpdateStockData(StockData instance);
partial void DeleteStockData(StockData instance);
partial void InsertStockData(StockData instance);