///<summary> ///setDatagridView ///データグリッドビュー表示 ///</summary> public void setDatagridView() { //ビジネス層のインスタンス生成 MakerList_B makerlistB = new MakerList_B(); try { //データグリッドビュー部分 gridMaker.DataSource = makerlistB.getDatagridView(); //検索件数を表示 lblRecords.Text = "該当件数( " + gridMaker.RowCount.ToString() + "件)"; //件数が0の場合 if (gridMaker.RowCount == 0) { //メッセージボックスの処理、項目のデータがない場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, CommonTeisu.LABEL_NOTDATA, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); return; } } catch (Exception ex) { //エラーロギング 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; } }
///<summary> ///setDatagridView ///データグリッドビュー表示 ///作成者:大河内 ///作成日:2017/3/6 ///更新者:大河内 ///更新日:2017/3/23 ///カラム論理名 ///</summary> public void setDatagridView() { //処理部に移動 MakerList_B makerlistB = new MakerList_B(); //データグリッドビュー部分 dgvSeihin.DataSource = makerlistB.setDatagridView(); //幅の値を設定 dgvSeihin.Columns["メーカーコード"].Width = 150; dgvSeihin.Columns["メーカー名"].Width = 200; //中央揃え dgvSeihin.Columns["メーカー名"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; //検索件数を表示 lblRecords.Text = "該当件数( " + dgvSeihin.RowCount.ToString() + "件)"; //件数が0の場合 if (lblRecords.Text.Equals("0")) { //表示を変える MessageBox.Show("データが見つかりませんでした。"); return; } }
///<summary> ///judtxtDaibunTextLeave ///code入力箇所からフォーカスが外れた時 ///作成者:大河内 ///作成日:2017/3/7 ///更新者:大河内 ///更新日:2017/3/29 ///カラム論理名 ///</summary> private void judtxtDaibunTextLeave(object sender, EventArgs e) { DataTable dtGetTable = new DataTable(); if (txtDaibunrui.Text == "") { lblDsp.Text = ""; return; } else if (txtDaibunrui.TextLength == 1) { MessageBox.Show("入力された文字列が正しくありません。", "入力項目", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); ////0パティングする場合(予備) //txtDaibunrui.Text = txtDaibunrui.Text.ToString().PadLeft(2, '0'); } else { MakerList_B makerlistB = new MakerList_B(); dtGetTable = makerlistB.judtxtDaibunTextLeave(txtDaibunrui.Text); if (dtGetTable.Rows.Count == 0) { MessageBox.Show("入力された文字列が正しくありません。", "入力項目", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { //名前を表示 lblDsp.Text = dtGetTable.Rows[0]["大分類名"].ToString(); dgvSeihin.Focus(); } } }
///<summary> ///btnKensakuClick ///検索ボタンを押したとき ///作成者:大河内 ///作成日:2017/3/7 ///更新者:大河内 ///更新日:2017/3/23 ///カラム論理名 ///</summary> private void btnKensakuClick(object sender, EventArgs e) { int RadioBtnJud = 0; //並び替え判定 if (radioButton1.Checked == true) { RadioBtnJud = 1; } else { RadioBtnJud = 0; } //処理部に移動 MakerList_B makerlistB = new MakerList_B(); //データグリッドビュー部分 dgvSeihin.DataSource = makerlistB.setKensaku(txtDaibunrui.Text, txtKensaku.Text, RadioBtnJud); lblRecords.Text = "該当件数( " + dgvSeihin.RowCount.ToString() + "件)"; //幅の値を設定 dgvSeihin.Columns["メーカーコード"].Width = 150; dgvSeihin.Columns["メーカー名"].Width = 200; dgvSeihin.Focus(); }
///<summary> ///setEndAction ///戻るボタンの処理 ///作成者:大河内 ///作成日:2017/3/8 ///更新者:大河内 ///更新日:2017/3/23 ///カラム論理名 ///</summary> private void setEndAction() { this.Close(); MakerList_B makerlistB = new MakerList_B(); makerlistB.setEndAction(intFrmKind); }
///<summary> ///setdgvSeihinDoubleClick ///データグリッドビュー内のデータ選択後の処理 ///作成者:大河内 ///作成日:2017/3/7 ///更新者:大河内 ///更新日:2017/3/14 ///カラム論理名 ///</summary> private void setSelectItem() { if (intFrmKind == 0) { return; } //選択行のcode取得 string strSelectid = (string)dgvSeihin.CurrentRow.Cells["メーカーコード"].Value; MakerList_B makerlistB = new MakerList_B(); makerlistB.setSelectItem(intFrmKind, strSelectid); setEndAction(); }
///<summary> ///setSelectItem ///データグリッドビュー内のデータ選択後の処理 ///</summary> private void setSelectItem() { //検索結果にデータが存在しなければ終了 if (gridMaker.RowCount == 0) { return; } //選択行のメーカー情報 List <string> lstSelectId = new List <string>(); //選択行のメーカー情報取得 string strSelectid = (string)gridMaker.CurrentRow.Cells["メーカーコード"].Value; string strSelectName = (string)gridMaker.CurrentRow.Cells["メーカー名"].Value; //検索情報を入れる lstSelectId.Add(strSelectid); lstSelectId.Add(strSelectName); //ビジネス層のインスタンス生成 MakerList_B makerlistB = new MakerList_B(); try { //ビジネス層、検索ロジックに移動 makerlistB.getSelectItem(intFrmKind, strSelectid); EndAction(lstSelectId); } catch (Exception ex) { //エラーロギング 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; } }
///<summary> ///setKensaku ///検索の処理 ///</summary> private void setKensaku() { logger.Info(LogUtil.getMessage(this._Title, "検索実行")); List <string> lstSearch = new List <string>(); DataTable dtKensaku = new DataTable(); //空白削除 lblSetDaibunrui.CodeTxtText = lblSetDaibunrui.CodeTxtText.Trim(); txtKensaku.Text = txtKensaku.Text.Trim(); //listに追加 lstSearch.Add(lblSetDaibunrui.CodeTxtText); lstSearch.Add(txtKensaku.Text); lstSearch.Add(txtKensakuKana.Text.Trim()); MakerList_B makerlistB = new MakerList_B(); try { dtKensaku = makerlistB.getKensaku(lstSearch); //一件以上ある場合 if (dtKensaku.Rows.Count != 0) { gridMaker.DataSource = dtKensaku; } else { gridMaker.DataSource = null; } //検索件数を表示 lblRecords.Text = "該当件数( " + gridMaker.RowCount.ToString() + "件)"; //件数が0の場合 if (gridMaker.RowCount == 0) { //メッセージボックスの処理、項目のデータがない場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, CommonTeisu.LABEL_NOTDATA, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); return; } } catch (Exception ex) { 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; } ////大分類ラベルセットが空でない場合 //if (lblSetDaibunrui.ValueLabelText != "") //{ // setDatagridView(); //} //else //{ // BaseForm baseform = new BaseForm(); // baseform.delFormClear(this, gridMaker); //} }
///<summary> ///EndAction ///戻るボタンの処理 ///</summary> public void EndAction(List <string> lstSelectId) { if (lblSetDaibunrui.blMessageOn == false) { //データグリッドビューからデータを選択且つセット系から来た場合 if (lblSetMaker != null && lstSelectId.Count != 0) { //セットの中に検索結果データを入れる lblSetMaker.CodeTxtText = lstSelectId[0]; lblSetMaker.ValueLabelText = lstSelectId[1]; //全てのフォームの中から foreach (System.Windows.Forms.Form frm in Application.OpenForms) { //商品のフォームを探す if (frm.Name == "M1030_Shohin") { //データを連れてくるため、newをしないこと M1030_Shohin shohinHome = (M1030_Shohin)frm; shohinHome.setMaker(); break; } //棚卸入力のフォームを探す if (frm.Name == "F0140_TanaorosiInput") { //データを連れてくるため、newをしないこと F0140_TanaorosiInput tanaHome = (F0140_TanaorosiInput)frm; tanaHome.setDaibun(strSubDaibunCd); break; } //商品元帳確認のフォームを探す if (frm.Name == "D0380_ShohinMotochoKakunin") { //データを連れてくるため、newをしないこと D0380_ShohinMotochoKakunin shohinmotoHome = (D0380_ShohinMotochoKakunin)frm; shohinmotoHome.setDaibun(strSubDaibunCd); break; } //発注入力のフォームを探す if (frm.Name == "A0100_HachuInput") { //データを連れてくるため、newをしないこと A0100_HachuInput hachuHome = (A0100_HachuInput)frm; hachuHome.setDaibun(strSubDaibunCd); break; } } } } this.Close(); //ビジネス層のインスタンス生成 MakerList_B makerlistB = new MakerList_B(); try { //画面終了処理 makerlistB.FormMove(intFrmKind); } catch (Exception ex) { //エラーロギング 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; } }