Beispiel #1
0
        /// <summary>
        /// D0380_ShohinMotochoKakunin_Load
        /// 読み込み時
        /// </summary>
        private void D0380_ShohinMotochoKakunin_Load(object sender, EventArgs e)
        {
            this.Show();
            this._Title = "商品元帳確認";

            // フォームでもキーイベントを受け取る
            this.KeyPreview = true;

            this.btnF01.Text = STR_FUNC_F1_HYOJII;
            this.btnF04.Text = STR_FUNC_F4;
            this.btnF09.Text = STR_FUNC_F9;
            this.btnF12.Text = STR_FUNC_F12;

            //初期表示(営業所コード取り出し)
            DataTable dtTantoshaCd = new DataTable();

            D0380_ShohinMotochoKakunin_B shohinmotochokakuninB = new D0380_ShohinMotochoKakunin_B();

            try
            {
                //ログインIDから担当者コードを取り出す
                dtTantoshaCd = shohinmotochokakuninB.getTantoshaCd(SystemInformation.UserName);

                //担当者データがある場合
                if (dtTantoshaCd.Rows.Count > 0)
                {
                    //一行目にデータがない場合
                    if (dtTantoshaCd.Rows[0][0].ToString() == "")
                    {
                        return;
                    }
                }

                labelSet_Eigyosho.CodeTxtText = dtTantoshaCd.Rows[0]["営業所コード"].ToString();
                labelSet_Eigyosho.chkTxtEigyousho();
            }
            catch (Exception ex)
            {
                // エラーロギング
                new CommonException(ex);

                // メッセージボックスの処理、削除失敗の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "失敗しました。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
            }

            labelSet_Daibunrui.Focus();

            //カレンダー関係の初期設定(当日)
            txtCalendarYMopen.setUp(0);
            txtCalendarYMclose.setUp(0);

            //DataGridViewの初期設定
            SetUpGrid();
        }
Beispiel #2
0
        /// <summary>
        /// setShohinMotoCho
        /// データグリッドビューにデータを表示
        /// </summary>
        private void setShohinMotoCho()
        {
            //データ検索用
            List <string> lstShohinLoad = new List <string>();
            //グリッドビュー表示用
            List <string> lstShohinGrid = new List <string>();

            //検索時のデータ取り出し先
            DataTable dtSetView;

            //年月日の日付フォーマット後を入れる用
            string strYMDformat = "";

            //空文字判定(商品名)
            if (lblGrayShohin.Text == "")
            {
                // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                txtKensaku.Focus();
                return;
            }

            //空文字判定(検索開始年月)
            if (txtCalendarYMopen.blIsEmpty() == false)
            {
                // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "項目が空です。\r\n条件を指定してください。 ", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                txtCalendarYMopen.Focus();

                return;
            }

            //空文字判定(検索終了年月)
            if (txtCalendarYMclose.blIsEmpty() == false)
            {
                // メッセージボックスの処理、項目が空の場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "項目が空です。\r\n条件を指定してください。 ", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                txtCalendarYMclose.Focus();

                return;
            }

            //大分類チェック
            if (labelSet_Daibunrui.chkTxtDaibunrui())
            {
                labelSet_Daibunrui.Focus();

                return;
            }

            //中分類チェック
            if (labelSet_Chubunrui.chkTxtChubunrui(labelSet_Daibunrui.CodeTxtText))
            {
                labelSet_Chubunrui.Focus();

                return;
            }

            //メーカーチェック
            if (labelSet_Maker.chkTxtMaker())
            {
                labelSet_Maker.Focus();

                return;
            }

            //営業所チェック
            if (labelSet_Eigyosho.chkTxtEigyousho())
            {
                labelSet_Eigyosho.Focus();

                return;
            }

            //待機カーソル
            this.Cursor = Cursors.WaitCursor;

            //日付フォーマット生成、およびチェック
            strYMDformat = txtCalendarYMopen.chkDateYMDataFormat(txtCalendarYMopen.Text);

            //開始年月日の日付チェック
            if (strYMDformat == "")
            {
                //デフォルトカーソル
                this.Cursor = Cursors.Default;

                // メッセージボックスの処理、項目が日付でない場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "入力された日付が正しくありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                txtCalendarYMopen.Focus();

                return;
            }
            else
            {
                txtCalendarYMopen.Text = strYMDformat;
            }

            //初期化
            strYMDformat = "";

            //日付フォーマット生成、およびチェック
            strYMDformat = txtCalendarYMclose.chkDateYMDataFormat(txtCalendarYMclose.Text);

            //終了年月日の日付チェック
            if (strYMDformat == "")
            {
                //デフォルトカーソル
                this.Cursor = Cursors.Default;

                // メッセージボックスの処理、項目が日付でない場合のウィンドウ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, "入力された日付が正しくありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();

                txtCalendarYMclose.Focus();

                return;
            }
            else
            {
                txtCalendarYMclose.Text = strYMDformat;
            }

            //ビジネス層のインスタンス生成
            D0380_ShohinMotochoKakunin_B shohinmotochokakuninB = new D0380_ShohinMotochoKakunin_B();

            try
            {
                //データの存在確認を検索する情報を入れる
                lstShohinLoad.Add(txtShohinCd.Text);
                lstShohinLoad.Add(labelSet_Eigyosho.CodeTxtText);
                lstShohinLoad.Add(txtCalendarYMopen.Text);
                lstShohinLoad.Add(txtCalendarYMclose.Text);

                //ビジネス層、テキストボックス表示用ロジックに移動
                lstShohinGrid = shohinmotochokakuninB.setTextBox(lstShohinLoad);

                //データ配置(textbox系)
                setZaiko(lstShohinGrid);

                //データグリッドビュー表示用の情報を入れる
                lstShohinLoad.Add(txtHonZenZaiko.Text);
                lstShohinLoad.Add(txtGihuZenZaiko.Text);

                //ビジネス層、データグリッドビュー表示用ロジックに移動
                dtSetView = shohinmotochokakuninB.setViewGrid(lstShohinLoad);

                //データ配置(datagridview)
                gridSeihin.DataSource = dtSetView;

                //デフォルトカーソル
                this.Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                //デフォルトカーソル
                this.Cursor = Cursors.Default;

                //エラーロギング
                new CommonException(ex);
                //例外発生メッセージ(OK)
                BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_ERROR, CommonTeisu.LABEL_ERROR_MESSAGE, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                basemessagebox.ShowDialog();
                return;
            }
            return;
        }