private Common.DuanwuForecastModel.DuanwuForecastInfo GetDuanwuForecastTBInfoNow(DateTime dt) { try { Common.DuanwuForecastModel.DuanwuForecastInfo infoList = null; string strSQL = "select * from sf_duanwuforecast 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.DuanwuForecastModel.DuanwuForecastInfo(); 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.Weather_details = dTable.Rows[0]["WEATHERFORECAST"].ToString(); infoList.Pic = dTable.Rows[0]["WEATHERPIC"].ToString(); infoList.PicDes = dTable.Rows[0]["WEATHERPICDES"].ToString(); infoList.Subhead = dTable.Rows[0]["SUBHEAD"].ToString(); } return(infoList); } catch (Exception ex) { OracleHelper.ErrWriter(ex); } return(null); }
//端午专报 public bool InsertDuanwuForecast(DateTime dt, Common.DuanwuForecastModel.DuanwuForecastInfo info, Common.DuanwuForecastModel.DuanwuForecastTBInfo 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_duanwuforecast where ddatetime=to_date('" + dt.ToString("yyyy-MM-dd HH:mm") + "','yyyy-mm-dd hh24:mi')"; strSQLTB = "select recid from sf_duanwuforecast_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_duanwuforecast set DDATETIME =to_date('" + dt.ToString("yyyy-MM-dd HH:mm") + "','yyyy-mm-dd hh24:mi') " + ",FORECASTER='" + info.Forecaster + "'" + ",WAETHERTREND='" + info.Weather_trend + "'" + ",WEATHERFORECAST='" + info.Weather_details + "'" + ",WEATHERPIC='" + info.Pic + "'" + ",WEATHERPICDES='" + info.PicDes + "'" + ",SUBHEAD='" + info.Subhead + "'" + ",FILEFLAG=0" + " where RECID=" + strID; } else { strSQL = "insert into sf_duanwuforecast(DDATETIME,FORECASTER,WAETHERTREND,WEATHERFORECAST,WEATHERPIC,WEATHERPICDES,SUBHEAD,recid) values(" + " to_date('" + dt.ToString("yyyy-MM-dd HH:mm") + "','yyyy-mm-dd hh24:mi') " + ",'" + info.Forecaster + "'" + ",'" + info.Weather_trend + "'" + ",'" + info.Weather_details + "'" + ",'" + info.Pic + "'" + ",'" + info.PicDes + "'" + ",'" + info.Subhead + "',SEQ_sf_duanwuforecast.Nextval)"; } result1 = oh.db_ExecuteNonQuery(strSQL); //表格数据 strSQLTB = "insert all into sf_duanwuforecast_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_duanwuforecast_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_duanwuforecast_tb.Nextval) into sf_duanwuforecast_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.DuanwuForecastModel.DuanwuForecastInfo GetDuanwuForecastInfo(DateTime dt) { Common.DuanwuForecastModel.DuanwuForecastInfo info = GetDuanwuForecastTBInfoNow(dt); return(info); }
//端午专报 public bool InsertDuanwuForcast(DateTime dt, Common.DuanwuForecastModel.DuanwuForecastInfo info, Common.DuanwuForecastModel.DuanwuForecastTBInfo TBinfo, string forecaster) { return(hfDAL.InsertDuanwuForecast(dt, info, TBinfo, forecaster)); }