///<summary> ///addGroup ///テキストボックス内のデータをDBに登録 ///</summary> private void addGroup() { //記入情報登録用 List <string> lstGroup = new List <string>(); //空文字判定(グループID) if (txtGroupId.blIsEmpty() == false) { //メッセージボックスの処理、項目が空の場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); txtGroupId.Focus(); return; } //空文字判定(グループ名) if (txtGroupName.blIsEmpty() == false) { //メッセージボックスの処理、項目が空の場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); txtGroupName.Focus(); return; } // グループIDの文字チェック if (chkGroupId() == true) { return; } //登録情報を入れる(グループID、グループ名、ユーザー名) lstGroup.Add(txtGroupId.Text); lstGroup.Add(txtGroupName.Text); lstGroup.Add(SystemInformation.UserName); //ビジネス層のインスタンス生成 M1200_Group_B groupB = new M1200_Group_B(); try { //登録 groupB.addGroup(lstGroup); //メッセージボックスの処理、登録完了のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_TOUROKU, CommonTeisu.LABEL_TOUROKU, CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION); basemessagebox.ShowDialog(); //テキストボックスを白紙にする delText(); } 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> ///printGroup ///印刷ダイアログ ///</summary> private void printGroup() { //SQL実行時に取り出したデータを入れる用 DataTable dtSetCd_B = new DataTable(); //PDF作成後の入れ物 string strFile = ""; //ビジネス層のインスタンス生成 M1200_Group_B groupB = new M1200_Group_B(); try { dtSetCd_B = groupB.getPrintData(); //取得したデータがない場合 if (dtSetCd_B.Rows.Count == 0 || dtSetCd_B == null) { //例外発生メッセージ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_ERROR, "対象のデータはありません", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); return; } //初期値 Common.Form.PrintForm pf = new Common.Form.PrintForm(this, "", CommonTeisu.SIZE_A4, TATE); pf.ShowDialog(this); //プレビューの場合 if (this.printFlg == CommonTeisu.ACTION_PREVIEW) { //結果セットをレコードセットに strFile = groupB.dbToPdf(dtSetCd_B); // プレビュー pf.execPreview(strFile); } // 一括印刷の場合 else if (this.printFlg == CommonTeisu.ACTION_PRINT) { // PDF作成 strFile = groupB.dbToPdf(dtSetCd_B); // 一括印刷 pf.execPrint(null, strFile, CommonTeisu.SIZE_A4, CommonTeisu.TATE, true); } } 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> ///txtGroupId_Leave ///code入力箇所からフォーカスが外れた時 ///</summary> private void txtGroupId_Leave(object sender, EventArgs e) { //検索時のデータ取り出し先 DataTable dtSetCd; //前後の空白を取り除く txtGroupId.Text = txtGroupId.Text.Trim(); // グループIDの空チェック if (txtGroupId.blIsEmpty() == false) { return; } // グループIDの文字チェック if (chkGroupId() == true) { return; } //ビジネス層のインスタンス生成 M1200_Group_B groupB = new M1200_Group_B(); try { //戻り値のDatatableを取り込む dtSetCd = groupB.updTxtGroupLeave(txtGroupId.Text); //Datatable内のデータが存在する場合 if (dtSetCd.Rows.Count != 0) { setGroup(dtSetCd); // ファンクションボタン制御 this.btnF01.Enabled = true; this.btnF03.Enabled = true; this.btnF04.Enabled = true; } else { txtGroupName.Text = ""; // ファンクションボタン制御 this.btnF01.Enabled = true; this.btnF03.Enabled = false; this.btnF04.Enabled = true; } } 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> ///delShohizeiritu ///テキストボックス内のデータをDBから削除 ///</summary> public void delGroup() { //記入情報削除用 List <string> lstGroup = new List <string>(); //検索時のデータ取り出し先 DataTable dtSetCd; //空文字判定(グループコード) if (txtGroupId.blIsEmpty() == false) { return; } // グループIDの文字チェック if (chkGroupId() == true) { return; } //ビジネス層のインスタンス生成 M1200_Group_B groupB = new M1200_Group_B(); try { //戻り値のDatatableを取り込む dtSetCd = groupB.updTxtGroupLeave(txtGroupId.Text); //検索結果にデータが存在しなければ終了 if (dtSetCd.Rows.Count == 0) { return; } //メッセージボックスの処理、削除するか否かのウィンドウ(YES,NO) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_DEL, CommonTeisu.LABEL_DEL_BEFORE, CommonTeisu.BTN_YESNO, CommonTeisu.DIAG_QUESTION); //NOが押された場合 if (basemessagebox.ShowDialog() == DialogResult.No) { return; } //削除情報を入れる(グループコード、グループ名、ユーザー名) lstGroup.Add(dtSetCd.Rows[0]["グループコード"].ToString()); lstGroup.Add(dtSetCd.Rows[0]["グループ名"].ToString()); lstGroup.Add(SystemInformation.UserName); //ビジネス層、削除ロジックに移動 groupB.delGroup(lstGroup); //メッセージボックスの処理、削除完了のウィンドウ(OK) basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_DEL, CommonTeisu.LABEL_DEL_AFTER, CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION); basemessagebox.ShowDialog(); //テキストボックスを白紙にする delText(); txtGroupId.Focus(); } 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; } }