Example #1
0
        /// <summary>
        /// テーブルデータを各変数に代入
        /// </summary>
        /// <param name="tbl"></param>
        private void SetTblData(DataTable tbl)
        {
            // コントロール状態を変更
            setFilterControlEnabled(true);

            // フィルタ項目絞込みを実施

            StringBuilder sb = new StringBuilder();

            sb.Append("論理削除 = false");
            if (!string.IsNullOrEmpty(this.HINGUN.Text1))
            {
                sb.AppendFormat(" AND 品群 = '{0}'", this.HINGUN.Text1);
            }

            if (!string.IsNullOrEmpty(this.ITEM_KBN.Text))
            {
                sb.AppendFormat(" AND 商品区分 = {0}", this.ITEM_KBN.Text);
            }

            if (!string.IsNullOrEmpty(this.GAITHU_NAME.Text))
            {
                sb.Append(" AND");
                sb.AppendFormat(" ( 外注先名1 LIKE '%{0}%'", this.GAITHU_NAME.Text);
                sb.AppendFormat(" OR 外注先名2 LIKE '%{0}%' )", this.GAITHU_NAME.Text);
            }

            if (!string.IsNullOrEmpty(this.ITEM_NAME.Text))
            {
                sb.AppendFormat(" AND 品番名称 LIKE '%{0}%'", this.ITEM_NAME.Text);
            }

            DataView dv = tbl.AsDataView();

            dv.RowFilter = sb.ToString();

            // 検索データ設定
            SearchResult = dv.ToTable();
            SearchResult.AcceptChanges();
        }