///<summary> ///setTxtEigyoTxtLeave ///code入力箇所からフォーカスが外れた時 ///</summary> public void setTxtEigyoTxtLeave(object sender, EventArgs e) { //検索時のデータ取り出し先 DataTable dtSetCd; //前後の空白を取り除く txtEigyoshoCd.Text = txtEigyoshoCd.Text.Trim(); //文字判定 if (txtEigyoshoCd.blIsEmpty() == false) { return; } //営業所コードチェック if (chkEigyoshoCd() == true) { return; } //ビジネス層のインスタンス生成 M1090_Eigyosho_B eigyoshoB = new M1090_Eigyosho_B(); try { //戻り値のDatatableを取り込む dtSetCd = eigyoshoB.getTxtEigyoCdLeave(txtEigyoshoCd.Text); //Datatable内のデータが存在する場合 if (dtSetCd.Rows.Count != 0) { setEigyoshoCode(dtSetCd); this.btnF01.Enabled = true; this.btnF03.Enabled = true; this.btnF04.Enabled = true; txtEigyoshoName.Focus(); } else { txtEigyoshoName.Text = ""; this.btnF01.Enabled = true; this.btnF03.Enabled = false; this.btnF04.Enabled = true; txtEigyoshoName.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; } }
///<summary> ///printEigyosho ///印刷ダイアログ ///</summary> private void printEigyosho() { //SQL実行時に取り出したデータを入れる用 DataTable dtSetCd_B = new DataTable(); //PDF作成後の入れ物 string strFile = ""; //ビジネス層のインスタンス生成 M1090_Eigyosho_B eigyoB = new M1090_Eigyosho_B(); try { dtSetCd_B = eigyoB.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 = eigyoB.dbToPdf(dtSetCd_B); // プレビュー pf.execPreview(strFile); } // 一括印刷の場合 else if (this.printFlg == CommonTeisu.ACTION_PRINT) { // PDF作成 strFile = eigyoB.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> ///addEigyosho ///テキストボックス内のデータをDBに登録 ///</summary> private void addEigyosho() { //データ渡し用 List <string> lstEigyosho = new List <string>(); //文字判定 if (txtEigyoshoCd.blIsEmpty() == false) { //メッセージボックスの処理、項目が空の場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); txtEigyoshoCd.Focus(); return; } if (txtEigyoshoName.blIsEmpty() == false) { //メッセージボックスの処理、項目が空の場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_NULL, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); txtEigyoshoName.Focus(); return; } //営業所コードチェック if (chkEigyoshoCd() == true) { return; } //登録情報を入れる(営業所コード、営業所名、ユーザー名) lstEigyosho.Add(txtEigyoshoCd.Text); lstEigyosho.Add(txtEigyoshoName.Text); lstEigyosho.Add(SystemInformation.UserName); //ビジネス層のインスタンス生成 M1090_Eigyosho_B eigyoshoB = new M1090_Eigyosho_B(); try { //登録 eigyoshoB.addEigyosho(lstEigyosho); //メッセージボックスの処理、登録完了のウィンドウ(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> ///delMaker ///テキストボックス内のデータをDBから削除 ///</summary> public void delEigyosho() { //記入情報削除用 List <string> lstEigyosho = new List <string>(); //検索時のデータ取り出し先 DataTable dtSetCd; //文字判定(営業所コード) if (txtEigyoshoCd.blIsEmpty() == false) { return; } //営業所コードチェック if (chkEigyoshoCd() == true) { return; } //ビジネス層のインスタンス生成 M1090_Eigyosho_B eigyoshoB = new M1090_Eigyosho_B(); try { //戻り値のDatatableを取り込む dtSetCd = eigyoshoB.getTxtEigyoCdLeave(txtEigyoshoCd.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; } //削除情報を入れる(営業所コード、営業所名、ユーザー名) lstEigyosho.Add(dtSetCd.Rows[0]["営業所コード"].ToString()); lstEigyosho.Add(dtSetCd.Rows[0]["営業所名"].ToString()); lstEigyosho.Add(SystemInformation.UserName); //ビジネス層、削除ロジックに移動 eigyoshoB.delEighosho(lstEigyosho); //メッセージボックスの処理、削除完了のウィンドウ(OK) basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_DEL, CommonTeisu.LABEL_DEL_AFTER, 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; } }