Пример #1
0
        /// <summary>
        /// 検索結果取得
        /// </summary>
        /// <remarks>
        /// 作成者    :  nakao
        /// 作成日    :  2019/11/08
        /// </remarks>
        public void GetSearchResults()
        {
            // 検索条件が正しければ検索実施
            if (Condition.ValidateSearch() == false)
            {
                return;
            }

            DataSet  dtSet    = null;
            DataBase dataBase = null;

            try
            {
                long unfinishedCount = 0;
                SearchResults = new List <SearchResult>();
                List <object> paraList = new List <object>();
                string        queryStr = QueryBuild.GetSeihanMgmtList(Condition, ref paraList);

                dataBase = new DataBase();
                dataBase.ConnectDB();

                dtSet = dataBase.GetDataSet(queryStr, paraList.ToArray());  // クエリ実行

                foreach (DataRow row in dtSet.Tables[0].Rows)
                {
                    SearchResult sr = new SearchResult(row);
                    SearchResults.Add(sr);

                    if (sr.IsUnfinished())
                    {
                        unfinishedCount++;                      // 未完了集計
                    }
                }

                ResultCount = unfinishedCount.ToString() + "/" + SearchResults.Count.ToString();

                dataBase.DisconnectDB();
            }
            catch (Exception ex)
            {
                SearchErrorMessage = Resources.TextResource.ErrorGetSearchResult;
            }
            finally
            {
                if (dataBase != null)
                {
                    dataBase.DisconnectDB();
                }
                if (dtSet != null)
                {
                    dtSet.Dispose();
                }
            }
        }