private Common.NationalForecastModel.NationalForecastInfo GetNationalForecastInfoNow(DateTime dt)
        {
            try
            {
                Common.NationalForecastModel.NationalForecastInfo infoList = null;
                string       strSQL = "select * from sf_nationalforecast 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.NationalForecastModel.NationalForecastInfo();
                    infoList.Ddatetime       = dt.ToString("yyyy-MM-dd HH:mm");
                    infoList.Forecaster      = dTable.Rows[0]["FORECASTER"].ToString();
                    infoList.Summary         = dTable.Rows[0]["SUMMARY"].ToString();
                    infoList.Weather_trend   = dTable.Rows[0]["WAETHERTREND"].ToString();
                    infoList.Weather_details = dTable.Rows[0]["WEATHERFORECAST"].ToString();
                }
                return(infoList);
            }
            catch (Exception ex)
            {
                OracleHelper.ErrWriter(ex);
            }
            return(null);
        }
        //国庆专报
        public bool InsertNationalForecast(DateTime dt, Common.NationalForecastModel.NationalForecastInfo info, Common.NationalForecastModel.NationalForecastTBInfo 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_NATIONALFORECAST where ddatetime=to_date('" + dt.ToString("yyyy-MM-dd HH:mm") + "','yyyy-mm-dd hh24:mi')";
                strSQLTB = "select recid from SF_NATIONALFORECASTTB 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_NATIONALFORECAST set DDATETIME =to_date('" + dt.ToString("yyyy-MM-dd HH:mm") + "','yyyy-mm-dd hh24:mi') "
                             + ",FORECASTER='" + info.Forecaster + "'"
                             + ",SUMMARY='" + info.Summary + "'"
                             + ",WAETHERTREND='" + info.Weather_trend + "'"
                             + ",WEATHERFORECAST='" + info.Weather_details + "'"
                             + ",FILEFLAG=0"
                             + " where RECID=" + strID;
                }
                else
                {
                    strSQL = "insert into SF_NATIONALFORECAST(DDATETIME,FORECASTER,SUMMARY,WAETHERTREND,WEATHERFORECAST) values("
                             + " to_date('" + dt.ToString("yyyy-MM-dd HH:mm") + "','yyyy-mm-dd hh24:mi') "
                             + ",'" + info.Forecaster + "'"
                             + ",'" + info.Summary + "'"
                             + ",'" + info.Weather_trend + "'"
                             + ",'" + info.Weather_details + "')";
                }
                result1 = oh.db_ExecuteNonQuery(strSQL);

                //表格数据
                strSQLTB = "insert all into SF_NATIONALFORECASTTB(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_NATIONALFORECASTTB.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_NATIONALFORECASTTB.Nextval) into SF_NATIONALFORECASTTB(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.NationalForecastModel.NationalForecastInfo GetNationalForecastInfo(DateTime dt)
 {
     Common.NationalForecastModel.NationalForecastInfo info = GetNationalForecastInfoNow(dt);
     return(info);
 }
Example #4
0
 //国庆专报部分
 public bool InsertNationalForcast(DateTime dt, Common.NationalForecastModel.NationalForecastInfo info, Common.NationalForecastModel.NationalForecastTBInfo TBinfo, string forecaster)
 {
     return(hfDAL.InsertNationalForecast(dt, info, TBinfo, forecaster));
 }