private Common.GaokaoForecastModel.GaokaoForecastInfo GetGaokaoForecastInfoNow(DateTime dt) { try { Common.GaokaoForecastModel.GaokaoForecastInfo infoList = null; string strSQL = "select * from SF_GAOKAOFORECAST where ddatetime = to_date('" + dt.ToString("yyyy-MM-dd HH:mm") + "','yyyy-mm-dd hh24:mi') "; OracleHelper oh = new OracleHelper("HAIKOUConnect"); DataTable dTable = oh.ExecuteDataTable(strSQL); if (dTable != null && dTable.Rows.Count > 0) { infoList = new Common.GaokaoForecastModel.GaokaoForecastInfo(); infoList.Ddatetime = dt.ToString("yyyy-MM-dd HH:mm"); infoList.Forecaster = dTable.Rows[0]["FORECASTER"].ToString(); infoList.Weather_trend = dTable.Rows[0]["WAETHERTREND"].ToString(); infoList.Suggest = dTable.Rows[0]["SUGGEST"].ToString(); infoList.Subhead = dTable.Rows[0]["SUBHEAD"].ToString(); } return(infoList); } catch (Exception ex) { OracleHelper.ErrWriter(ex); } return(null); }
//高考专报 public bool InsertGaokaoForecast(DateTime dt, Common.GaokaoForecastModel.GaokaoForecastInfo info, Common.GaokaoForecastModel.GaokaoForecastTBInfo TBinfo, string forecaster) { try { string strSQL = ""; string strSQLTB = ""; string str = ""; string strID = ""; string strIDTB = ""; int result1 = 0; int result = 0; strSQL = "select recid from SF_GAOKAOFORECAST where ddatetime=to_date('" + dt.ToString("yyyy-MM-dd HH:mm") + "','yyyy-mm-dd hh24:mi')"; strSQLTB = "select recid from SF_GAOKAOFORECAST_TB where ddatetime=to_date('" + dt.ToString("yyyy-MM-dd HH:mm") + "','yyyy-mm-dd hh24:mi')"; OracleHelper oh = new OracleHelper("HAIKOUConnect"); strID = oh.db_GreateQuery(strSQL); strIDTB = oh.db_GreateQuery(strSQLTB); if (strID.Length > 0) { strSQL = "update SF_GAOKAOFORECAST set DDATETIME =to_date('" + dt.ToString("yyyy-MM-dd HH:mm") + "','yyyy-mm-dd hh24:mi') " + ",FORECASTER='" + info.Forecaster + "'" + ",WAETHERTREND='" + info.Weather_trend + "'" + ",SUGGEST='" + info.Suggest + "'" + ",SUBHEAD='" + info.Subhead + "'" + ",FILEFLAG=0" + " where RECID=" + strID; } else { strSQL = "insert into SF_GAOKAOFORECAST(DDATETIME,FORECASTER,WAETHERTREND,SUGGEST,SUBHEAD,recid) values(" + " to_date('" + dt.ToString("yyyy-MM-dd HH:mm") + "','yyyy-mm-dd hh24:mi') " + ",'" + info.Forecaster + "'" + ",'" + info.Weather_trend + "'" + ",'" + info.Suggest + "'" + ",'" + info.Subhead + "',seq_SF_GAOKAOFORECAST.Nextval)"; } result1 = oh.db_ExecuteNonQuery(strSQL); //表格数据 strSQLTB = "insert all into SF_GAOKAOFORECAST_TB(DDATETIME,FORECASTTIME,WEATHERPIC,WEATHER,TEMPERATURE,WIND,recid) "; for (int i = 0; i < TBinfo.Forecasttime.Length; i++) { if (i == TBinfo.Forecasttime.Length - 1) { str += "values (to_date('" + dt.ToString("yyyy-MM-dd HH:mm") + "','yyyy-mm-dd hh24:mi') " + ",'" + TBinfo.Forecasttime[i] + "'" + ",'" + TBinfo.Weatherpic[i] + "'" + ",'" + TBinfo.Weatherdes[i] + "'" + ",'" + TBinfo.Temperature[i] + "'" + ",'" + TBinfo.Wind[i] + "',seq_SF_GAOKAOFORECAST_TB.Nextval) SELECT * FROM dual"; } else { str += "values (to_date('" + dt.ToString("yyyy-MM-dd HH:mm") + "','yyyy-mm-dd hh24:mi') " + ",'" + TBinfo.Forecasttime[i] + "'" + ",'" + TBinfo.Weatherpic[i] + "'" + ",'" + TBinfo.Weatherdes[i] + "'" + ",'" + TBinfo.Temperature[i] + "'" + ",'" + TBinfo.Wind[i] + "',seq_SF_GAOKAOFORECAST_TB.Nextval) into SF_GAOKAOFORECAST_TB(DDATETIME,FORECASTTIME,WEATHERPIC,WEATHER,TEMPERATURE,WIND,recid) "; } } strSQLTB += str; result = oh.db_ExecuteNonQuery(strSQLTB); if (result1 <= 0 || result <= 0) { return(false); } } catch (Exception ex) { return(false); } return(true); }
public Common.GaokaoForecastModel.GaokaoForecastInfo GetGaokaoForecastInfo(DateTime dt) { Common.GaokaoForecastModel.GaokaoForecastInfo info = GetGaokaoForecastInfoNow(dt); return(info); }
//高考专报 public bool InsertGaokaoForcast(DateTime dt, Common.GaokaoForecastModel.GaokaoForecastInfo info, Common.GaokaoForecastModel.GaokaoForecastTBInfo TBinfo, string forecaster) { return(hfDAL.InsertGaokaoForecast(dt, info, TBinfo, forecaster)); }