///<summary> ///setDatagridView ///データグリッドビュー表示 ///作成者:大河内 ///作成日:2017/3/2 ///更新者:大河内 ///更新日:2017/3/23 ///カラム論理名 ///</summary> private void setDatagridView() { //処理部に移動 DaibunruiList_B daibunlistB = new DaibunruiList_B(); //データグリッドビュー部分 dgvSeihin.DataSource = daibunlistB.setDatagridView(); //幅の値を設定 dgvSeihin.Columns["大分類コード"].Width = 150; dgvSeihin.Columns["大分類名"].Width = 150; //中央揃え dgvSeihin.Columns[1].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; lblRecords.Text = "該当件数( " + dgvSeihin.RowCount.ToString() + "件)"; //件数が0の場合 if (lblRecords.Text == "0") { //表示を変える MessageBox.Show("データが見つかりませんでした。"); return; } }
///<summary> ///EndAction ///戻るボタンの処理 ///</summary> private void EndAction(List <string> lstSelectData) { //データグリッドビューからデータを選択且つセット系から来た場合 if (lblSetDaibun != null && lstSelectData.Count != 0) { //セットの中に検索結果データを入れる lblSetDaibun.CodeTxtText = lstSelectData[0]; lblSetDaibun.ValueLabelText = lstSelectData[1]; } this.Close(); //ビジネス層のインスタンス生成 DaibunruiList_B daibunlistB = new DaibunruiList_B(); try { //画面終了処理 daibunlistB.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; } }
///<summary> ///setEndAction ///戻るボタンの処理 ///作成者:大河内 ///作成日:2017/3/6 ///更新者:大河内 ///更新日:2017/3/23 ///カラム論理名 ///</summary> private void setEndAction() { this.Close(); //処理部に移動 DaibunruiList_B daibunlistB = new DaibunruiList_B(); daibunlistB.setEndAction(intFrmKind); }
///<summary> ///setdgvSeihinDoubleClick ///データグリッドビュー内のデータ選択後の処理 ///作成者:大河内 ///作成日:2017/3/6 ///更新者:大河内 ///更新日:2017/3/23 ///カラム論理名 ///</summary> private void setSelectItem() { if (intFrmKind == 0) { return; } //選択行の大分類コード取得 string strSelectid = (string)dgvSeihin.CurrentRow.Cells[0].Value; //処理部に移動 DaibunruiList_B daibunListB = new DaibunruiList_B(); daibunListB.setSelectItem(intFrmKind, strSelectid); setEndAction(); }
///<summary> ///setDatagridView ///データグリッドビュー表示 ///</summary> private void setDatagridView() { //ビジネス層のインスタンス生成 DaibunruiList_B daibunlistB = new DaibunruiList_B(); try { //データグリッドビュー部分 gridSeihin.DataSource = daibunlistB.getDatagridView(); //幅の値を設定 gridSeihin.Columns["大分類コード"].Width = 130; gridSeihin.Columns["大分類名"].Width = 200; //中央揃え gridSeihin.Columns[1].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; lblRecords.Text = "該当件数( " + gridSeihin.RowCount.ToString() + "件)"; //件数が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 setSelectItem() { //データグリッドビューにデータが存在しなければ終了 if (gridSeihin.RowCount == 0) { return; } //データ渡し用 List <string> lstSelectData = new List <string>(); //選択行の大分類コード取得 string strSelectId = (string)gridSeihin.CurrentRow.Cells["大分類コード"].Value; string strSelectName = (string)gridSeihin.CurrentRow.Cells["大分類名"].Value; //検索情報を入れる lstSelectData.Add(strSelectId); lstSelectData.Add(strSelectName); //ビジネス層のインスタンス生成 DaibunruiList_B daibunListB = new DaibunruiList_B(); try { //データグリッドビュー内のデータ選択後の処理 daibunListB.getSelectItem(intFrmKind, strSelectId); EndAction(lstSelectData); } 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; } }