///<summary> ///setDatagridView ///データグリッドビュー表示 ///</summary> private void setDatagridView(Boolean blnAll) { //ビジネス層のインスタンス生成 ShohizeiritsuList_B shohizeiritsulistB = new ShohizeiritsuList_B(); try { //データの変換を行うためのデータテーブル DataTable dtView; //検索結果を取り込む dtView = shohizeiritsulistB.getDatagridView(blnAll); //目標売上を整数型に for (int cnt = 0; cnt < dtView.Rows.Count; cnt++) { int intShisyagonyu = 1; dtView.Rows[cnt]["消費税率"] = updShishagonyu(dtView.Rows[cnt]["消費税率"].ToString(), intShisyagonyu); } //データグリッドビュー部分 gridSeihin.DataSource = dtView; //幅の値を設定 gridSeihin.Columns["適用開始年月日"].Width = 150; gridSeihin.Columns["消費税率"].Width = 120; //中央揃え gridSeihin.Columns["適用開始年月日"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; gridSeihin.Columns["消費税率"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; //検索件数を表示 lblRecords.Text = "該当件数( " + gridSeihin.RowCount.ToString() + "件)"; //件数が0の場合 if (lblRecords.Text == "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> ///setEndAction ///戻るボタンの処理 ///</summary> private void setEndAction(List <string> lstString) { this.Close(); //ビジネス層のインスタンス生成 ShohizeiritsuList_B shohizeilistB = new ShohizeiritsuList_B(); try { shohizeilistB.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> ///setGridSeihinDoubleClick ///データグリッドビュー内のデータ選択後の処理 ///</summary> private void setSelectItem() { //データグリッドビューにデータが存在しなければ終了 if (gridSeihin.RowCount == 0) { return; } //選択された月用 string strSelectMonth = ""; //選択された日付用 string strSelectDay = ""; //選択行の検索情報取得用 List <string> lstSelectData = new List <string>(); //検索データ用 DateTime dateSelect; //検索データを取り込む dateSelect = (DateTime)gridSeihin.CurrentRow.Cells[0].Value; //月データを入れる strSelectMonth = dateSelect.Month.ToString(); //文字数が1だった場合、0パディング if (strSelectMonth.Length == 1) { strSelectMonth = dateSelect.Month.ToString().PadLeft(2, '0'); } //日付データを入れる strSelectDay = dateSelect.Day.ToString(); //文字数が1だった場合、0パディング if (strSelectDay.Length == 1) { strSelectDay = dateSelect.Day.ToString().PadLeft(2, '0'); } //日付データを取得 string strSelectDate = (dateSelect.Year + "/" + strSelectMonth + "/" + strSelectDay).ToString(); //名前データを取得 string strSelectName = (string)gridSeihin.CurrentRow.Cells[1].Value.ToString(); //検索するデータの取得 lstSelectData.Add(strSelectDate); lstSelectData.Add(strSelectName); //ビジネス層のインスタンス生成 ShohizeiritsuList_B shohizeilistB = new ShohizeiritsuList_B(); try { //データグリッドビュー内のデータ選択後の処理 shohizeilistB.getSelectItem(intFrmKind, strSelectDate); setEndAction(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; } }