public static Dictionary <string, int> VerifyExceed90Day(List <String> ShareClassIdList) { Dictionary <string, int> toCheckDic = new Dictionary <string, int>(); try { string ShareClassIdString = ""; string sql = "select ShareClassId,ISNULL(LastTradeDate,TradingDate) LastTradeDate from ( select row_number() over(partition by ShareClassId order by TradingDate desc) as rownum,ShareClassId ,LastTradeDate,TradingDate from CentralRawData..HistoricalRawPrice where ShareClassId in (" + ShareClassIdString + ")) AA where AA.rownum=1 "; AccessOutputDB accessOutputDB = new AccessOutputDB(); //LastTradingDate DataSet ds = accessOutputDB.getEquityXOICurrentShareClassInfo("0P000002RH"); foreach (var ShareClassId in ShareClassIdList) { toCheckDic.Add(ShareClassId, 0); } foreach (DataRow raw in ds.Tables[0].Rows) { toCheckDic[raw["ShareClassId"].ToString()] = Int32.Parse(raw["LastTradingDate"].ToString()); } foreach (KeyValuePair <string, int> pair in toCheckDic) { if (pair.Value >= 90) { Tool.LogFile("Info:[" + pair.Key + "]超过90天"); } else { Tool.LogFile("Info:[" + pair.Key + "]没有超过90天"); } } return(toCheckDic); } catch (Exception ex) { MessageBox.Show("Error:" + ex.ToString()); return(toCheckDic); } //WebServiceCheck.LoginGID(); //WebServiceCheck.test(); }
public static bool VerifyExceed90Day(string ShareClassIdList) { bool isExceed = false; try { AccessOutputDB accessOutputDB = new AccessOutputDB(); DataSet ds = accessOutputDB.getEquityXOICurrentShareClassInfo(ShareClassIdList); DateTime nowDate = DateTime.Now; DateTime lastTradingDate = DateTime.Parse(ds.Tables[0].Rows[0]["LastTradingDate"].ToString()); return(Int32.Parse((nowDate - lastTradingDate).TotalDays.ToString()) > 90?true:false); } catch (Exception ex) { MessageBox.Show("Error:[" + ShareClassIdList + "查询验证是否超过90天]" + ex.ToString()); Tool.LogFile("Error:[" + ShareClassIdList + "查询验证是否超过90天]"); return(isExceed); } }