示例#1
0
        //获取回溯显示数据——分区预报
        public static Dictionary <int, DataTable> GetZoneDatasToDB(string tableInfo)
        {
            try
            {
                //DateTime foretime = DateTime.Parse(DateTime.Now.ToString());
                //DateTime.TryParse(NewTime, out foretime);
                Dictionary <int, DataTable> datas   = new Dictionary <int, DataTable>();
                Dictionary <int, DataRow[]> dataRow = new Dictionary <int, DataRow[]>();
                StringBuilder strSql = new StringBuilder();
                OracleHelper  oh     = null;
                DataTable     dt     = null;
                strSql = new StringBuilder();
                strSql.Append("select DDATETIME,TRACECOUNT,TRACEFLAG,ISEDIT,TRACEIMAGE,TRACECHART,PUSH1,PUSH2,FORECASTER,RECID FROM  " + tableInfo + " order by recid desc");
                oh = new OracleHelper("HAIKOUConnect");
                dt = oh.ExecuteDataTable(strSql.ToString());

                if (dt == null || dt.Rows.Count == 0)
                {
                    return(null);
                }

                int i = 0;
                datas.Add(i, dt);

                return(datas);
            }
            catch (Exception ee)
            {
                CreateLogTxt.ErrWriter(ee);
            }
            return(null);
        }
示例#2
0
        //获取回溯显示数据——十天预报
        public static Dictionary <int, DataTable> GettenDayDatasToDB(string tableInfo)
        {
            try
            {
                //DateTime foretime = DateTime.Parse(DateTime.Now.ToString());
                //DateTime.TryParse(NewTime, out foretime);
                Dictionary <int, DataTable> datas   = new Dictionary <int, DataTable>();
                Dictionary <int, DataRow[]> dataRow = new Dictionary <int, DataRow[]>();
                StringBuilder strSql = new StringBuilder();
                OracleHelper  oh     = null;
                DataTable     dt     = null;
                strSql = new StringBuilder();
                strSql.Append("select DDATETIME,WEATHERTODAY,RAIN,WINDSPEED,WINDDIRECT,HUMIDITY,MAXTEMP,MINTEMP,FORECASTER,RECID FROM  " + tableInfo + " order by recid desc");
                oh = new OracleHelper("HAIKOUConnect");
                dt = oh.ExecuteDataTable(strSql.ToString());

                if (dt == null || dt.Rows.Count == 0)
                {
                    return(null);
                }

                int i = 0;
                datas.Add(i, dt);

                return(datas);
            }
            catch (Exception ee)
            {
                CreateLogTxt.ErrWriter(ee);
            }
            return(null);
        }
示例#3
0
        public List <WeatherForecastInfo> GetWeatherHis(DateTime dt)
        {
            List <WeatherForecastInfo> list = null;
            string strSQL = "SELECT forecastdate,to_char(forecastdate, 'DY') as week,weatherpic,weather, mintemp,maxtemp from LFS_WELFAREFORECASTDAYS WHERE DDATETIME = TO_DATE('" + dt.ToString("yyyy-MM-dd HH:mm") + "','yyyy-mm-dd hh24:mi')  ";

            try
            {
                OracleHelper th     = new OracleHelper("HAIKOUConnect");
                DataTable    dTable = th.ExecuteDataTable(strSQL);
                if (dTable != null && dTable.Rows.Count > 0)
                {
                    list = new List <WeatherForecastInfo>();
                    for (int i = 0; i < dTable.Rows.Count; i++)
                    {
                        WeatherForecastInfo info = new WeatherForecastInfo();
                        info.ForecastDate  = dTable.Rows[i]["forecastdate"].ToString();
                        info.Week          = dTable.Rows[i]["week"].ToString();
                        info.WeatherPic    = dTable.Rows[i]["weatherpic"].ToString();
                        info.WeatherStatus = dTable.Rows[i]["weather"].ToString();
                        info.MinTemp       = dTable.Rows[i]["mintemp"].ToString();
                        info.MaxTemp       = dTable.Rows[i]["maxtemp"].ToString();
                        list.Add(info);
                    }
                }
            }
            catch (Exception ex)
            {
                CreateLogTxt.ErrWriter(ex);
            }
            return(list);
        }
示例#4
0
        public static List <string[]> Getprogramme(int levels)
        {
            List <string[]> fws_user = new List <string[]>();

            try
            {
                string       connstr = ConfigurationManager.ConnectionStrings["EJETDB247ID"].ConnectionString;
                OracleHelper db      = new OracleHelper(connstr);
                string       sql     = "select AGGREGATE,PRIMARYNAME from flooding_programme where LEVELS=" + levels;

                DataSet ds = db.ExecuteDataSet(sql);

                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    string[] dvalue = new string[2];
                    dvalue[0] = item["AGGREGATE"].ToString();
                    dvalue[1] = item["PRIMARYNAME"].ToString();
                    fws_user.Add(dvalue);
                }
            }
            catch (Exception ee)
            {
                CreateLogTxt.ErrWriter(ee);
            }
            return(fws_user);
        }
示例#5
0
        public List <string> GetAllWelfareForeInfo(DateTime dt)
        {
            List <string> info   = null;
            string        strSQL = "SELECT distinct WeatherBack,Future FROM LFS_WELFAREFORECAST WHERE DDATETIME = TO_DATE('" + dt.ToString("yyyy-MM-dd HH:mm") + "','yyyy-mm-dd hh24:mi')  ";

            try
            {
                OracleHelper th     = new OracleHelper("HAIKOUConnect");
                DataTable    dTable = th.ExecuteDataTable(strSQL);
                if (dTable != null && dTable.Rows.Count > 0)
                {
                    for (int i = 0; i < dTable.Rows.Count; i++)
                    {
                        info = new List <string>();
                        info.Add(dTable.Rows[i]["WeatherBack"].ToString());
                        info.Add(dTable.Rows[i]["Future"].ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                CreateLogTxt.ErrWriter(ex);
            }
            return(info);
        }
示例#6
0
        //获取回溯显示数据——逐6小时、逐12小时预报(入库登记表)
        public static Dictionary <int, DataTable> GetOperatCatalogDatasToDBRecord(string tableInfoRecord)
        {
            try
            {
                Dictionary <int, DataTable> datas   = new Dictionary <int, DataTable>();
                Dictionary <int, DataRow[]> dataRow = new Dictionary <int, DataRow[]>();
                StringBuilder strSql = new StringBuilder();
                OracleHelper  oh     = null;
                DataTable     dt     = null;
                strSql = new StringBuilder();
                strSql.Append("select RECID,FORECASTER FROM " + tableInfoRecord + " order by RECID desc");
                oh = new OracleHelper("HAIKOUConnect");
                dt = oh.ExecuteDataTable(strSql.ToString());

                if (dt == null || dt.Rows.Count == 0)
                {
                    return(null);
                }

                for (int i = 0; i <= dt.Rows.Count; i++)
                {
                    datas.Add(i, dt);
                }
                return(datas);
            }
            catch (Exception ee)
            {
                CreateLogTxt.ErrWriter(ee);
            }
            return(null);
        }
示例#7
0
        // Change the paragraph alignement
        public void SetAlignment(string strType)
        {
            try
            {
                switch (strType)
                {
                case "Center":
                    oWordApplic.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
                    break;

                case "Left":
                    oWordApplic.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft;
                    break;

                case "Right":
                    oWordApplic.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight;
                    break;

                case "Justify":
                    oWordApplic.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphJustify;
                    break;
                }
            }
            catch (Exception ex)
            {
                CreateLogTxt.ErrWriter(ex);
            }
        }
示例#8
0
        public void ReplaceText(string oldstr, string newstr)
        {
            try
            {
                //if (newstr.Length > 255) {
                //   newstr= newstr.Substring(0, 250) + "...";
                //}
                if (newstr.Length > 255)
                {
                    int           count = newstr.Length / 255 + ((newstr.Length % 255) == 0 ? 0 : 1);
                    List <string> origianlStringList    = new List <string>();
                    List <string> destinationStringList = new List <string>();
                    for (int i = 0; i < count; i++)
                    {
                        origianlStringList.Add("$$$" + i.ToString() + "$");
                        int length;//每小段的长度
                        if (i != count - 1)
                        {
                            length = 255;
                        }
                        else
                        {
                            length = newstr.Length % 255;
                        }
                        destinationStringList.Add(newstr.Substring(i * 255, length));
                    }
                    string origianlStringListTotalString = string.Empty;
                    for (int i = 0; i < count; i++)
                    {
                        origianlStringListTotalString += origianlStringList[i];
                    }
                    this.ReplaceText(oldstr, origianlStringListTotalString);
                    for (int i = 0; i < count; i++)
                    {
                        this.ReplaceText(origianlStringList[i], destinationStringList[i]);
                    }
                    return;
                }

                object replaceAll = Word.WdReplace.wdReplaceAll;

                oWordApplic.Selection.Find.ClearFormatting();
                oWordApplic.Selection.Find.Text = oldstr;

                oWordApplic.Selection.Find.Replacement.ClearFormatting();
                oWordApplic.Selection.Find.Replacement.Text = newstr;
                object missing = Type.Missing;
                oWordApplic.Selection.Find.Execute(
                    ref missing, ref missing, ref missing, ref missing, ref missing,
                    ref missing, ref missing, ref missing, ref missing, ref missing,
                    ref replaceAll, ref missing, ref missing, ref missing, ref missing);
            }
            catch (Exception ex)
            {
                CreateLogTxt.ErrWriter(ex);
                Console.WriteLine(ex.ToString());
            }
        }
示例#9
0
 public void SetFontName(string strType)
 {
     try
     {
         oWordApplic.Selection.Font.Name = strType;
     }
     catch (Exception ex)
     {
         CreateLogTxt.ErrWriter(ex);
     }
 }
示例#10
0
 public void InsertLineBreak()
 {
     try
     {
         oWordApplic.Selection.TypeParagraph();
     }
     catch (Exception ex)
     {
         CreateLogTxt.ErrWriter(ex);
     }
 }
示例#11
0
 public void InsertText(string strText)
 {
     try
     {
         oWordApplic.Selection.TypeText(strText);
     }
     catch (Exception ex)
     {
         CreateLogTxt.ErrWriter(ex);
     }
 }
示例#12
0
 public void SetFontSize(int nSize)
 {
     try
     {
         oWordApplic.Selection.Font.Size = nSize;
     }
     catch (Exception ex)
     {
         CreateLogTxt.ErrWriter(ex);
     }
 }
示例#13
0
 public void Save()
 {
     try
     {
         oDoc.Save();
     }
     catch (Exception ex)
     {
         CreateLogTxt.ErrWriter(ex);
     }
 }
示例#14
0
        private Word.Document oDoc;                     // a reference to the document


        public CCWordApp()
        {
            try
            {
                oWordApplic = new Word.ApplicationClass();
            }
            catch (Exception ex)
            {
                CreateLogTxt.ErrWriter(ex);
            }
        }
示例#15
0
        private List <ZoneForecastInfo> GetForecastInfo(DateTime dt, string area, DateTime dtStart)
        {
            List <ZoneForecastInfo> listInfo = null;
            DataTable dtTable  = null;
            DataTable dtTable2 = null;

            try
            {
                string strSQL  = "SELECT distinct RECID,DDATETIME,YBSX,RAIN,T2M,RHSFC,WSPD10M,WDIR10M,FORECASTTIME";
                string strSQL1 = "SELECT max(T2M) as MAXTEMPERATURE,MIN(T2M) AS MINTEMPERATURE";
                strSQL  += string.Format(" FROM T_HK_NEW_GRID_FORECAST T WHERE DDATETIME = TO_DATE('{0}','YYYY-MM-DD HH24:MI:SS') AND VENUEID = {1} AND  FORECASTTIME>TO_DATE('{2}','YYYY-MM-DD HH24:MI:SS') AND ROWNUM<=24  ORDER BY YBSX,FORECASTTIME", dt, GetZoneNum(area).Split(';')[0], dtStart);
                strSQL1 += string.Format(" FROM T_HK_NEW_GRID_FORECAST T WHERE DDATETIME = TO_DATE('{0}','YYYY-MM-DD HH24:MI:SS') AND VENUEID = {1} AND  FORECASTTIME>TO_DATE('{2}','YYYY-MM-DD HH24:MI:SS') AND ROWNUM<=24  ORDER BY YBSX,FORECASTTIME", dt, GetZoneNum(area).Split(';')[0], dtStart);
                try
                {
                    OracleHelper th = new OracleHelper("HAIKOUConnect");
                    dtTable  = th.ExecuteDataTable(strSQL);
                    dtTable2 = th.ExecuteDataTable(strSQL1);
                    if (dtTable != null && dtTable.Rows.Count > 0 && dtTable2 != null && dtTable2.Rows.Count > 0)
                    {
                        listInfo = new List <ZoneForecastInfo>();
                        string name = GetZoneNum(area).Split(';')[1].Trim();
                        for (int i = 0; i < dtTable.Rows.Count; i++)
                        {
                            ZoneForecastInfo info = new ZoneForecastInfo();
                            info.AreaName       = name;
                            info.Recid          = dtTable.Rows[i]["RECID"].ToString();
                            info.Ddatetime      = dtTable.Rows[i]["DDATETIME"].ToString();
                            info.Ybsx           = dtTable.Rows[i]["YBSX"].ToString();
                            info.Rain           = Convert.ToDouble(dtTable.Rows[i]["RAIN"]).ToString("####0.#");
                            info.T2m            = Convert.ToDouble(dtTable.Rows[i]["T2M"]).ToString("####0.#");
                            info.Rhsfc          = Convert.ToDouble(dtTable.Rows[i]["RHSFC"]).ToString("####0.#");
                            info.Wspd10m        = Convert.ToDouble(dtTable.Rows[i]["WSPD10M"]).ToString("####0.#");
                            info.Wdir10m        = Convert.ToDouble(dtTable.Rows[i]["WDIR10M"]).ToString("####0.#");
                            info.Forecasttime   = dtTable.Rows[i]["FORECASTTIME"].ToString();
                            info.Rain2          = info.Rain;
                            info.T2m2           = info.T2m;
                            info.Maxtemperature = Convert.ToDouble(dtTable2.Rows[0]["MAXTEMPERATURE"]).ToString("####0.#");
                            info.Mintemperature = Convert.ToDouble(dtTable2.Rows[0]["MINTEMPERATURE"]).ToString("####0.#");
                            listInfo.Add(info);
                        }
                    }
                }
                catch (Exception ex)
                {
                    CreateLogTxt.ErrWriter(ex);
                }
            }
            catch (Exception ex)
            {
                CreateLogTxt.WriteLog(ex.ToString());
            }
            return(listInfo);
        }
示例#16
0
 public void InsertPagebreak()
 {
     try
     {
         object pBreak = (int)Word.WdBreakType.wdPageBreak;
         oWordApplic.Selection.InsertBreak(ref pBreak);
     }
     catch (Exception ex)
     {
         CreateLogTxt.ErrWriter(ex);
     }
 }
示例#17
0
 public void Quit()
 {
     try
     {
         object missing = System.Reflection.Missing.Value;
         oWordApplic.Application.Quit(ref missing, ref missing, ref missing);
         System.GC.Collect();
     }
     catch (Exception ex)
     {
         CreateLogTxt.ErrWriter(ex);
     }
 }
示例#18
0
 // disable all the style
 public void SetFont()
 {
     try
     {
         oWordApplic.Selection.Font.Bold      = 0;
         oWordApplic.Selection.Font.Italic    = 0;
         oWordApplic.Selection.Font.Subscript = 0;
     }
     catch (Exception ex)
     {
         CreateLogTxt.ErrWriter(ex);
     }
 }
示例#19
0
 public void InsertLineBreak(int nline)
 {
     try
     {
         for (int i = 0; i < nline; i++)
         {
             oWordApplic.Selection.TypeParagraph();
         }
     }
     catch (Exception ex)
     {
         CreateLogTxt.ErrWriter(ex);
     }
 }
示例#20
0
        //public void ReplacePic(string oldstr, string newstr, float newWidth, float newHeight)
        //{
        //    try
        //    {
        //        object bookmarks = oldstr;
        //        if (!oDoc.Bookmarks.Exists(oldstr))
        //            return;
        //        Word.Bookmark book = oDoc.Bookmarks.Item(ref bookmarks);
        //        if (book == null) return;
        //            book.Select();
        //        object missing = Type.Missing;
        //        Word.InlineShape shape = oWordApplic.Selection.InlineShapes.AddPicture(newstr, ref missing, ref missing, ref missing);
        //        shape.Width = newWidth;//图片宽度
        //        shape.Height = newHeight;//图片高度

        //    }
        //    catch (Exception ex)
        //    {
        //         CreateLogTxt.ErrWriter(ex);
        //         Console.WriteLine(ex.ToString());
        //    }

        //}
        //public void ReplaceTable(string oldstr, List<List<string>> alTable)
        //{
        //    try
        //    {
        //        object bookmarks = oldstr;
        //        oDoc.Bookmarks.Item(ref bookmarks).Select();
        //        object missing = Type.Missing;
        //        if (alTable != null && alTable.Count > 0)
        //        {
        //            int rows = alTable.Count-1;
        //            int columns = alTable[0].Count;
        //            Word.Table table1 = oWordApplic.Selection.Tables.Add(oWordApplic.Selection.Range, rows, columns, ref missing, ref missing);
        //            table1.Borders.Item(Word.WdBorderType.wdBorderTop).LineStyle = Word.WdLineStyle.wdLineStyleSingle;
        //            table1.Borders.Item(Word.WdBorderType.wdBorderLeft).LineStyle = Word.WdLineStyle.wdLineStyleSingle;
        //            table1.Borders.Item(Word.WdBorderType.wdBorderBottom).LineStyle = Word.WdLineStyle.wdLineStyleSingle;
        //            table1.Borders.Item(Word.WdBorderType.wdBorderRight).LineStyle = Word.WdLineStyle.wdLineStyleSingle;
        //            table1.Borders.Item(Word.WdBorderType.wdBorderHorizontal).LineStyle = Word.WdLineStyle.wdLineStyleSingle;
        //            table1.Borders.Item(Word.WdBorderType.wdBorderVertical).LineStyle = Word.WdLineStyle.wdLineStyleSingle;



        //            int iWidth = 0;

        //            for (int i = 0; i < columns; i++) {
        //                iWidth = 0;
        //                int.TryParse(alTable[0][i], out iWidth);
        //                if (iWidth > 0)
        //                {
        //                    table1.Columns.Item(i + 1).PreferredWidthType = Word.WdPreferredWidthType.wdPreferredWidthPoints;
        //                    table1.Columns.Item(i + 1).PreferredWidth= iWidth;
        //                }
        //            }
        //            for (int i = 1; i <= rows; i++)
        //            {
        //                for (int j = 1; j <= columns; j++)
        //                {
        //                    table1.Cell(i, j).Range.Text = alTable[i][j-1];
        //                    table1.Cell(i, j).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;

        //                }
        //            }
        //            table1.Rows.Item(1).Range.Font.Bold = 1;

        //        }

        //    }
        //    catch (Exception ex)
        //    {
        //         CreateLogTxt.ErrWriter(ex);
        //    }

        //}
        // Open a new document
        public void Open()
        {
            try
            {
                object missing = System.Reflection.Missing.Value;
                oDoc = oWordApplic.Documents.Add(ref missing, ref missing, ref missing, ref missing);

                oDoc.Activate();
            }
            catch (Exception ex)
            {
                CreateLogTxt.ErrWriter(ex);
            }
        }
示例#21
0
 public void GoToUpCell()
 {
     try
     {
         object missing = System.Reflection.Missing.Value;
         object direction;
         direction = Word.WdUnits.wdLine;
         oWordApplic.Selection.MoveUp(ref direction, ref missing, ref missing);
     }
     catch (Exception ex)
     {
         CreateLogTxt.ErrWriter(ex);
     }
 }
示例#22
0
 public void GoToTheBeginning()
 {
     try
     {
         object missing = System.Reflection.Missing.Value;
         object unit;
         unit = Word.WdUnits.wdStory;
         oWordApplic.Selection.HomeKey(ref unit, ref missing);
     }
     catch (Exception ex)
     {
         CreateLogTxt.ErrWriter(ex);
     }
 }
示例#23
0
        /// <summary>
        /// 获取格点数据(新)
        /// </summary>
        /// <param name="IsFirstLoad">判断是否是第一次加载</param>
        /// <param name="model"></param>
        /// <param name="ybsx">预报时效</param>
        /// <returns></returns>
        public static Dictionary <int, DataTable> GetScwcasDatasToDB(string NewTime)
        {
            try
            {
                DateTime foretime = DateTime.Parse(DateTime.Now.ToString());
                DateTime.TryParse(NewTime, out foretime);
                int timelength = 48;//设置时效,数据的时效为0,,6,12...48
                Dictionary <int, DataTable> datas   = new Dictionary <int, DataTable>();
                Dictionary <int, DataRow[]> dataRow = new Dictionary <int, DataRow[]>();
                StringBuilder strSql = new StringBuilder();
                OracleHelper  oh     = null;
                DataTable     dt     = null;
                strSql = new StringBuilder();
                strSql.Append("select DDATETIME,LEADTIME,KI,CAPE,QFLUX850,QFLUX925,T850_T500,WINDSHEAR,PW,T700_T500,RSH FROM T_SCWCAS_ECMWF_DATA");
                strSql.Append(" where ddatetime = to_date('" + NewTime + "', 'yyyy-mm-dd hh24:mi:ss')");

                oh = new OracleHelper("EJETDB247ID");
                dt = oh.ExecuteDataTable(strSql.ToString());

                if (dt == null || dt.Rows.Count == 0)
                {
                    return(null);
                }
                for (int i = 0; i <= timelength; i++)
                {
                    if (i % 6 != 0)//取余得到i的值,此处的i为ybsx预报时效
                    {
                        continue;
                    }
                    DataRow[] drArr = dt.Select("LEADTIME='" + i + "'");
                    DataTable table = new DataTable();
                    table = dt.Clone();
                    foreach (var item in drArr)
                    {
                        table.Rows.Add(item.ItemArray);
                    }
                    if (!datas.ContainsKey(i))
                    {
                        datas.Add(i, table);
                    }
                }
                return(datas);
            }
            catch (Exception ee)
            {
                CreateLogTxt.ErrWriter(ee);
            }
            return(null);
        }
示例#24
0
        public void SaveAs(string strFileName)
        {
            try
            {
                object missing  = System.Reflection.Missing.Value;
                object fileName = strFileName;

                oDoc.SaveAs(ref fileName, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
                            ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
            }
            catch (Exception ex)
            {
                CreateLogTxt.ErrWriter(ex);
            }
        }
示例#25
0
 // Save the document in HTML format
 public void SaveAsHtml(string strFileName)
 {
     try
     {
         object missing  = System.Reflection.Missing.Value;
         object fileName = strFileName;
         object Format   = (int)Word.WdSaveFormat.wdFormatHTML;
         oDoc.SaveAs(ref fileName, ref Format, ref missing, ref missing, ref missing, ref missing, ref missing,
                     ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
     }
     catch (Exception ex)
     {
         CreateLogTxt.ErrWriter(ex);
     }
 }
示例#26
0
        // Go to a predefined bookmark, if the bookmark doesn't exists the application will raise an error

        public void GotoBookMark(string strBookMarkName)
        {
            try
            {
                object missing = System.Reflection.Missing.Value;

                object Bookmark     = (int)Word.WdGoToItem.wdGoToBookmark;
                object NameBookMark = strBookMarkName;
                oWordApplic.Selection.GoTo(ref Bookmark, ref missing, ref missing, ref NameBookMark);
            }
            catch (Exception ex)
            {
                CreateLogTxt.ErrWriter(ex);
            }
        }
示例#27
0
        // Open a file (the file must exists) and activate it
        public void Open(string strFileName)
        {
            try
            {
                object fileName  = strFileName;
                object readOnly  = false;
                object isVisible = true;
                object missing   = System.Reflection.Missing.Value;

                oDoc = oWordApplic.Documents.Open(ref fileName, ref missing, ref readOnly,
                                                  ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
                                                  ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing);

                oDoc.Activate();
            }
            catch (Exception ex)
            {
                CreateLogTxt.ErrWriter(ex);
            }
        }
示例#28
0
        public void GoToTheTable(int ntable)
        {
            try
            {
                object missing = System.Reflection.Missing.Value;
                object what;
                what = Word.WdUnits.wdTable;
                object which;
                which = Word.WdGoToDirection.wdGoToFirst;
                object count;
                count = 1;
                oWordApplic.Selection.GoTo(ref what, ref which, ref count, ref missing);
                oWordApplic.Selection.Find.ClearFormatting();

                oWordApplic.Selection.Text = "";
            }
            catch (Exception ex)
            {
                CreateLogTxt.ErrWriter(ex);
            }
        }
        //获取决策预报数据
        public static Dictionary <int, DataTable> DecisionForecastToDB(string table)
        {
            try
            {
                Dictionary <int, DataTable> datas   = new Dictionary <int, DataTable>();
                Dictionary <int, DataRow[]> dataRow = new Dictionary <int, DataRow[]>();
                StringBuilder strSql = new StringBuilder();
                OracleHelper  oh     = null;
                DataTable     dt     = null;
                strSql = new StringBuilder();
                if (table == "T_HK_NEW_GRID_FORECAST")
                {
                    strSql.Append("SELECT * FROM (SELECT * FROM " + table + " ORDER BY recid DESC) WHERE ROWNUM <= 100");
                }
                else
                {
                    strSql.Append("select * FROM  " + table + " order by recid desc");
                }

                oh = new OracleHelper("HAIKOUConnect");
                dt = oh.ExecuteDataTable(strSql.ToString());

                if (dt == null || dt.Rows.Count == 0)
                {
                    return(null);
                }

                int i = 0;
                datas.Add(i, dt);

                return(datas);
            }
            catch (Exception ee)
            {
                CreateLogTxt.ErrWriter(ee);
            }
            return(null);
        }
示例#30
0
        public List <WeatherForecastInfo> GetAllWearthInfo(DateTime dt)
        {
            List <WeatherForecastInfo> list = null;
            string strSQL = "SELECT distinct DDATETIME,AREANAME,MINRAIN,RAIN,MINTEMPERATURE,MAXTEMPERATURE,HUMIDITY,MAXHUMIDITY,WINDSPEED,WINDDIRECT,WEATHERPIC,WEATHERSTATUS,QPFCORRECTWEATHERPIC FROM LFS_AREAWEATHER WHERE DDATETIME = TO_DATE('" + dt.ToString("yyyy-MM-dd HH:mm") + "','yyyy-mm-dd hh24:mi') and maxtemperature!=0 ";

            try
            {
                OracleHelper th     = new OracleHelper("HAIKOUConnect");
                DataTable    dTable = th.ExecuteDataTable(strSQL);
                if (dTable != null && dTable.Rows.Count > 0)
                {
                    list = new List <WeatherForecastInfo>();
                    for (int i = 0; i < dTable.Rows.Count; i++)
                    {
                        WeatherForecastInfo info = new WeatherForecastInfo();
                        info.DDatetime            = Convert.ToDateTime(dTable.Rows[i]["DDATETIME"]);
                        info.AreaName             = dTable.Rows[i]["AREANAME"].ToString();
                        info.MinRain              = dTable.Rows[i]["MINRAIN"].ToString();
                        info.Rain                 = dTable.Rows[i]["RAIN"].ToString();
                        info.MinTemp              = dTable.Rows[i]["MINTEMPERATURE"].ToString();
                        info.MaxTemp              = dTable.Rows[i]["MAXTEMPERATURE"].ToString();
                        info.Humidity             = dTable.Rows[i]["HUMIDITY"].ToString();
                        info.MaxHumidity          = dTable.Rows[i]["MAXHUMIDITY"].ToString();
                        info.WindSpeed            = dTable.Rows[i]["WINDSPEED"].ToString();
                        info.WindDirectName       = dTable.Rows[i]["WINDDIRECT"].ToString();
                        info.WeatherPic           = dTable.Rows[i]["WEATHERPIC"].ToString();
                        info.WeatherStatus        = dTable.Rows[i]["WEATHERSTATUS"].ToString();
                        info.QpfCorrectWeatherpic = dTable.Rows[i]["QPFCORRECTWEATHERPIC"].ToString();
                        list.Add(info);
                    }
                }
            }
            catch (Exception ex)
            {
                CreateLogTxt.ErrWriter(ex);
            }
            return(list);
        }