string SaveDb() { if (SaveOjb == null) { return(null); } SaveDataTask sdt = SaveOjb as SaveDataTask; DataSet ds = sdt.Data as DataSet; jgdb.Save(ds, sdt.Sqls); return(null); }
string UpdateHQData(JRGCDBClass jgdb, DataRow tdr, DateTime EndT) { DataTable dt = tdr.Table.Clone(); //DataTable DBdt = new DataTable(); //DBdt.Columns.Add("SectorCode"); //DBdt.Columns.Add("HQDate"); //DBdt.Columns.Add("POpen"); //DBdt.Columns.Add("PHigh"); //DBdt.Columns.Add("PClose"); //DBdt.Columns.Add("PLow"); //DBdt.Columns.Add("Zf"); //DBdt.Columns.Add("Volume"); string GLCode = tdr["SectorCode"].ToString(); string GLName = tdr["SectorName"].ToString(); DateTime LunchDate = (DateTime)tdr["SectorCreateDate"]; DateTime HQDate = LunchDate; if (tdr["HQModifyDate"] != null) { DateTime tDate; if (DateTime.TryParse(tdr["HQModifyDate"].ToString(), out tDate)) { HQDate = tDate; } } GLClassProcess glcp = new GLClassProcess(); DateTime BegT = HQDate; DataTable WDtb = glcp.getHQData(GLCode, BegT, EndT); if (WDtb == null) { throw (new Exception("无法从万得获取到数据!")); } CheckPin = string.Format("概念{0}:{1}获取到行情数据{2}条!", GLCode, GLName, (WDtb == null ? 0 : WDtb.Rows.Count)); DataRow[] drs = WDtb.Select("VOLUME is not null", "DateTime"); DataTable savetb = WDtb.Clone(); for (int i = 0; i < drs.Length; i++) { savetb.Rows.Add(drs[i].ItemArray); } savetb.Columns["WINDCODE"].ColumnName = "SectorCode"; savetb.Columns["DateTime"].ColumnName = "HQDate"; savetb.Columns["OPEN"].ColumnName = "POpen"; savetb.Columns["HIGH"].ColumnName = "PHigh"; savetb.Columns["CLOSE"].ColumnName = "PClose"; savetb.Columns["LOW"].ColumnName = "PLow"; //savetb.Columns["PCT_CHG"].ColumnName = "Zf"; savetb.Columns["VOLUME"].ColumnName = "Volume"; string sql = string.Format("select * from SectorHQTable where SectorCode='{0}' and HQDate between '{1}' and '{2}'", GLCode, BegT, EndT); SaveDataTask sdt = new SaveDataTask(); this.SaveDataPool.Add(sdt); sdt.Sqls = new string[] { "", "" }; DataSet ds = new DataSet(); ds.Tables.Add(savetb); sdt.Data = ds; sdt.Sqls[0] = sql; CheckPin = string.Format("概念{0}:{1}已提交数据保存程序执行。最后日期{2}!", GLCode, GLName, EndT.ToShortDateString()); return(null); //this.SaveDataPool.Add(sdt); sql = string.Format("select * from SectorTable where SectorCode='{0}'", GLCode, BegT, EndT); tdr["HQModifyDate"] = EndT; if (savetb != null && savetb.Rows.Count > 0) { tdr["HQStartDate"] = savetb.Rows[0]["HQDate"]; } dt.Rows.Add(tdr.ItemArray); if (dt.Rows.Count > 1) { throw (new Exception("概念信息重复!")); } ds.Tables.Add(dt); sdt.Sqls[1] = sql; //update sectortable set hqmodifydate = sectorcreatedate CheckPin = string.Format("概念{0}:{1}已提交数据保存程序执行。最后日期{2}!", GLCode, GLName, EndT.ToShortDateString()); dt = null; return(null); }