///<summary> ///judtxtCDTextLeave ///code入力箇所からフォーカスが外れた時 ///作成者:大河内 ///作成日:2017/3/3 ///更新者:大河内 ///更新日:2017/3/23 ///カラム論理名 ///</summary> public void judDaibunruiLeave(object sender, EventArgs e) { if (txtDaibunrui.TextLength == 1) { txtDaibunrui.Text = txtDaibunrui.Text.ToString().PadLeft(2, '0'); } else if (txtDaibunrui.Text == "") { return; } DataTable dtSetcode; //処理部に移動 ChubunruiList_B chubunListB = new ChubunruiList_B(); //テキストボックス部分 dtSetcode = chubunListB.setName(txtDaibunrui.Text); if (dtSetcode.Rows.Count != 0) { lblText.Text = dtSetcode.Rows[0]["大分類名"].ToString(); dgvSeihin.Focus(); } else { MessageBox.Show("入力された文字列が正しくありません。", "入力項目", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } }
///<summary> ///setDatagridView ///データグリッドビュー表示 ///作成者:大河内 ///作成日:2017/3/3 ///更新者:大河内 ///更新日:2017/3/29 ///カラム論理名 ///</summary> private void setDatagridView() { DataTable dtGetTable; //処理部に移動 ChubunruiList_B chubunlistB = new ChubunruiList_B(); //データグリッドビュー部分 dgvSeihin.DataSource = chubunlistB.setDatagridView(txtDaibunrui.Text); //テキストボックス部分 dtGetTable = chubunlistB.setText(txtDaibunrui.Text); //幅の値を設定 //例 dgvSeihin.Columns["中分類コード"].Width = 150; dgvSeihin.Columns["中分類名"].Width = 200; //中央揃え dgvSeihin.Columns["中分類名"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; //大分類コードと名前を表示 txtDaibunrui.Text = dtGetTable.Rows[0]["大分類コード"].ToString(); lblText.Text = dtGetTable.Rows[0]["大分類名"].ToString(); lblRecords.Text = "該当件数( " + dgvSeihin.RowCount.ToString() + "件)"; //件数が0の場合 if (lblRecords.Text == "0") { //表示を変える MessageBox.Show("データが見つかりませんでした。"); return; } }
///<summary> ///setEndAction ///戻るボタンの処理 ///作成者:大河内 ///作成日:2017/3/6 ///更新者:大河内 ///更新日:2017/3/23 ///カラム論理名 ///</summary> private void setEndAction() { this.Close(); //処理部に移動 ChubunruiList_B chubunListB = new ChubunruiList_B(); chubunListB.setEndAction(intFrmKind); }
///<summary> ///setdgvSeihinDoubleClick ///データグリッドビュー内のデータ選択後の処理 ///作成者:大河内 ///作成日:2017/3/6 ///更新者:大河内 ///更新日:2017/3/23 ///カラム論理名 ///</summary> private void setSelectItem() { if (intFrmKind == 0) { return; } //選択行のcode取得 string strSelectid = (string)dgvSeihin.CurrentRow.Cells["中分類コード"].Value; //処理部に移動 ChubunruiList_B chubunListB = new ChubunruiList_B(); chubunListB.setSelectItem(intFrmKind, txtDaibunrui.Text, strSelectid); setEndAction(); }
///<summary> ///getDatagridView ///データグリッドビュー表示 ///</summary> private void setDatagridView() { //大分類テキストボックスに入れる用 DataTable dtGetTable; //データグリッドビュー部分 ChubunruiList_B chubunlistB = new ChubunruiList_B(); try { //データグリッドビュー部分 gridSeihin.DataSource = chubunlistB.getDatagridView(lblSetDaibunrui.CodeTxtText); //テキストボックス部分 dtGetTable = chubunlistB.getText(lblSetDaibunrui.CodeTxtText); //大分類コードと名前を表示 lblSetDaibunrui.CodeTxtText = dtGetTable.Rows[0]["大分類コード"].ToString(); lblSetDaibunrui.ValueLabelText = dtGetTable.Rows[0]["大分類名"].ToString(); lblRecords.Text = "該当件数( " + gridSeihin.RowCount.ToString() + "件)"; //予備の大分類コードに保持 strSubDaibunCd = lblSetDaibunrui.CodeTxtText; //件数が0の場合 if (gridSeihin.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> ///getSelectItem ///データグリッドビュー内のデータ選択後の処理 ///</summary> private void getSelectItem() { //データグリッドビューにデータが存在しなければ終了 if (gridSeihin.RowCount == 0) { return; } //データ渡し用 List <string> lstSelectData = new List <string>(); //選択行のcode取得 string strSelectId = (string)gridSeihin.CurrentRow.Cells["中分類コード"].Value.ToString(); string strSelectName = (string)gridSeihin.CurrentRow.Cells["中分類名"].Value.ToString(); string strSelectSubName = (string)gridSeihin.CurrentRow.Cells["補助名称"].Value.ToString(); //検索情報を入れる lstSelectData.Add(strSelectId); lstSelectData.Add(strSelectName); lstSelectData.Add(strSelectSubName); //ビジネス層のインスタンス生成 ChubunruiList_B chubunListB = new ChubunruiList_B(); try { //データグリッドビュー内のデータ選択後の処理 chubunListB.getSelectItem(intFrmKind, strSelectId, strSubDaibunCd); } 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; } EndAction(lstSelectData); }
///<summary> ///EndAction ///戻るボタンの処理 ///</summary> private void EndAction(List <string> lstSelectData) { //データグリッドビューからデータを選択且つセット系から来た場合 if (lblSetChubun != null && lstSelectData.Count != 0) { // 遷移前の大分類と選択した中分類のチェック ChubunruiList_B chubunlistB = new ChubunruiList_B(); DataTable dtChubunlist = chubunlistB.getSelectItemChk(lstSelectData[0], strBefDaibuncd); if (dtChubunlist.Rows.Count > 0) { //セットの中に検索結果データを入れる lblSetChubun.CodeTxtText = dtChubunlist.Rows[0]["中分類コード"].ToString(); lblSetChubun.ValueLabelText = dtChubunlist.Rows[0]["中分類名"].ToString(); //全てのフォームの中から(LIST系) foreach (System.Windows.Forms.Form frm in Application.OpenForms) { //商品LISTのフォームを探す if (frm.Name == "ShouhinList") { //データを連れてくるため、newをしないこと ShouhinList shouhinlist = (ShouhinList)frm; //中分類のセット shouhinlist.setChubun(); break; } } //全てのフォームの中から(FORM系) foreach (System.Windows.Forms.Form frm in Application.OpenForms) { //商品のフォームを探す if (frm.Name == "M1030_Shohin") { //データを連れてくるため、newをしないこと M1030_Shohin shohinHome = (M1030_Shohin)frm; //中分類のセット shohinHome.setChubun(); 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; } } } else { //メッセージボックスの処理、項目のデータがない場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, CommonTeisu.LABEL_NOTDATA, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); // セットの中にエラーの為、空白を入れる lblSetChubun.CodeTxtText = ""; lblSetChubun.ValueLabelText = ""; } } this.Close(); //ビジネス層のインスタンス生成 ChubunruiList_B chubunListB = new ChubunruiList_B(); try { //画面終了処理 chubunListB.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; } }