///<summary> ///EndAction ///戻るボタンの処理 ///</summary> private void EndAction(List <string> lstString) { //データグリッドビューからデータを選択且つセット系から来た場合 if (lblSetEigyou != null && lstString.Count != 0) { //セットの中に検索結果データを入れる lblSetEigyou.CodeTxtText = lstString[0]; lblSetEigyou.ValueLabelText = lstString[1]; } this.Close(); //ビジネス層のインスタンス生成 EigyoshoList_B eigyoulistB = new EigyoshoList_B(); try { //画面終了処理 eigyoulistB.EndAction(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> ///setSelectItem ///データグリッドビュー内のデータ選択後の処理 ///</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); //ビジネス層のインスタンス生成 EigyoshoList_B eigyoulistB = new EigyoshoList_B(); try { //データグリッドビュー内のデータ選択後の処理 eigyoulistB.setSelectItem(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; } }
///<summary> ///setDatagridView ///データグリッドビュー表示 ///</summary> private void setDatagridView() { //ビジネス層のインスタンス生成 EigyoshoList_B eigyoulistB = new EigyoshoList_B(); try { //データグリッドビュー部分 gridSeihin.DataSource = eigyoulistB.setDatagridView(); //幅の値を設定 gridSeihin.Columns["営業所コード"].Width = 150; gridSeihin.Columns["営業所名"].Width = 250; //中央揃え gridSeihin.Columns["営業所名"].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; } }