public void DataDeal(IList<Model.WeekStockModel> dtKLine, bool powerChange, Model.stockinfo stock) { IList<Model.WeekStockModel> oldList = null; IList<Model.WeekStockModel> list = null; string stockCode = stock.stockcode; if (!powerChange) { oldList = GetListFromDb(stockCode);// } if (oldList != null && oldList.Count > 0) { list = oldList; } else { list = new List<Model.WeekStockModel>(); } int count = list.Count; for (int i = count; i < dtKLine.Count; i++) { Model.WeekStockModel model = new Model.WeekStockModel(); list.Add(model); list[i].BeginDate = dtKLine[i].BeginDate; list[i].EndDate = dtKLine[i].EndDate; list[i].Dic["psy"] = GetPsy(dtKLine, i); list[i].Dic["psyma"] = GetPsyMa(dtKLine, list, i); list[i].Status = 1; } BatchSaveData(list, stockCode, powerChange); }
public Model.WeekStockModel ConvertToMonthKLineObject(string val) { string[] ret = val.Split(','); Model.WeekStockModel model = null; if (ret.Length == 11) { model = new Model.WeekStockModel(); model.EndDate = int.Parse(ret[0]);//结束日期 model.BeginDate = int.Parse(ret[10]);//开始日期 model.Dic["powero"] = 0; model.Dic["powerc"] = 0; model.Dic["powerh"] = 0; model.Dic["powerl"] = 0; model.Status = 1; } return model; }
public void DataDeal(IList<Model.WeekStockModel> dtKLine, bool powerChange, Model.stockinfo stock) { IList<Model.WeekStockModel> oldList = null; IList<Model.WeekStockModel> list = null; string stockCode = stock.stockcode; if (!powerChange) { oldList = GetListFromDb(stockCode);// } if (oldList != null && oldList.Count > 0) { list = oldList; } else { list = new List<Model.WeekStockModel>(); } int count = list.Count; for (int i = count; i < dtKLine.Count; i++) { Model.WeekStockModel model = new Model.WeekStockModel(); list.Add(model); list[i].BeginDate = dtKLine[i].BeginDate; list[i].EndDate = dtKLine[i].EndDate; list[i].Dic["xlyg2"] = Get2(dtKLine, list, i); list[i].Dic["xlyg3"] = Get3(dtKLine, list, i); list[i].Dic["xlyg5"] = Get5(dtKLine, list, i); list[i].Dic["xlyg8"] = Get8(dtKLine, list, i); list[i].Dic["xlyg13"] = Get13(dtKLine, list, i); list[i].Dic["xlyg21"] = Get21(dtKLine, list, i); list[i].Dic["xlygup"] = GetUp(dtKLine, list, i); list[i].Dic["xlygdown"] = GetDown(dtKLine, list, i); list[i].Dic["xlygupgui"] = GetUpGui(dtKLine, list, i); list[i].Dic["xlygdowngui"] = GetDownGui(dtKLine, list, i); list[i].Dic["xlygstock"] = GetStock(dtKLine, list, i); list[i].Dic["xlygmoney"] = GetMoney(dtKLine, list, i); list[i].Status = 1; } BatchSaveData(list, stockCode, powerChange); }
public IList<Model.WeekStockModel> DtToList(DataTable dt) { IList<Model.WeekStockModel> list = new List<Model.WeekStockModel>(); for (int i = 0; i < dt.Rows.Count; i++) { Model.WeekStockModel model = new Model.WeekStockModel(); foreach (DataColumn column in dt.Columns) { string columnName = column.ColumnName.ToLower(); if (columnName == "id" || columnName == "stockcode") { continue; } else if (columnName == "begindate") { model.BeginDate = int.Parse(dt.Rows[i]["begindate"].ToString()); } else if (columnName == "enddate") { model.EndDate = int.Parse(dt.Rows[i]["enddate"].ToString()); } else { try { decimal temp = decimal.Parse(dt.Rows[i][columnName].ToString()); model.Dic.Add(columnName, temp); } catch { model.Dic.Add(columnName, 0); } } } list.Add(model); } return list; }