/// <summary> /// setSoukoIdou /// データをグリッドビューに追加 /// </summary> private void setSoukoIdou() { // データチェック if (!blnDataCheck()) { return; } // 検索条件格納用 List <string> lstSearchItem = new List <string>(); List <Array> lstSearchItem2 = new List <Array>(); // ビジネス層のインスタンス生成 D0280_SoukoIdouKakunin_B soukoIdouB = new D0280_SoukoIdouKakunin_B(); try { // 検索条件をリストに格納 lstSearchItem = setSearchList(); // テキストボックスの値 lstSearchItem2 = getRadioBtn(); // ラジオボタン・チェックボックスの値 // 検索実行 DataTable dtSoukoIdouList = soukoIdouB.getSoukoIdouList(lstSearchItem, lstSearchItem2, 1); // データテーブルからデータグリッドへセット gridSoukoIdou.DataSource = dtSoukoIdouList; // DataTableのレコード数取得 int dtCnt = dtSoukoIdouList.Rows.Count; if (dtCnt > 0) { // ステータスバーに検索結果表示 this.lblStatusMessage.Text = "検索終了(該当件数" + dtCnt + "件)"; } else { // ステータスバーに検索結果表示 this.lblStatusMessage.Text = "検索終了(該当なし)"; } // gridにフォーカス gridSoukoIdou.Focus(); // カーソルの状態を元に戻す this.Cursor = Cursors.Default; } catch (Exception ex) { // カーソルの状態を元に戻す this.Cursor = Cursors.Default; // エラーロギング 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> /// printReport /// PDFを出力する /// </summary> private void printReport() { // 検索条件格納用 List <string> lstSearchItem = new List <string>(); List <Array> lstSearchItem2 = new List <Array>(); DataTable dtSoukoIdou = new DataTable(); // ビジネス層のインスタンス生成 D0280_SoukoIdouKakunin_B soukoIdouB = new D0280_SoukoIdouKakunin_B(); try { // 検索データをリストに格納 lstSearchItem = setSearchList(); lstSearchItem2 = getRadioBtn(); // 検索実行 dtSoukoIdou = soukoIdouB.getSoukoIdouList(lstSearchItem, lstSearchItem2, 2); if (dtSoukoIdou != null && dtSoukoIdou.Rows.Count > 0) { // 印刷ダイアログ Common.Form.PrintForm pf = new Common.Form.PrintForm(this, "", CommonTeisu.SIZE_A3, CommonTeisu.YOKO); pf.ShowDialog(this); // PDF出力用List(各テキストボックスの値をコードではなく名称で取得) List <string> lstoutItem = new List <string>(); lstoutItem.Add(labelSet_Eigyosho.ValueLabelText); // 営業所 lstoutItem.Add(txtIdouYMDStart.Text); // 移動年月日Start lstoutItem.Add(txtIdouYMDEnd.Text); // 移動年月日End lstoutItem.Add(labelSet_Daibunrui.ValueLabelText); // 大分類名称 lstoutItem.Add(txtKataban.Text); // 型番 lstoutItem.Add(txtBikou.Text); // 備考 // プレビューの場合 if (this.printFlg == CommonTeisu.ACTION_PREVIEW) { // カーソルを待機状態にする this.Cursor = Cursors.WaitCursor; // PDF作成 String strFile = soukoIdouB.dbToPdf(dtSoukoIdou, lstoutItem); // プレビュー pf.execPreview(strFile); pf.ShowDialog(this); } // 一括印刷の場合 else if (this.printFlg == CommonTeisu.ACTION_PRINT) { // カーソルを待機状態にする this.Cursor = Cursors.WaitCursor; // PDF作成 String strFile = soukoIdouB.dbToPdf(dtSoukoIdou, lstoutItem); // 一括印刷 pf.execPrint(null, strFile, CommonTeisu.SIZE_A3, CommonTeisu.YOKO, true); } pf.Dispose(); // カーソルの状態を元に戻す this.Cursor = Cursors.Default; } else { // カーソルの状態を元に戻す this.Cursor = Cursors.Default; // メッセージボックスの処理、対象データがない場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "対象のデータはありません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_INFOMATION); basemessagebox.ShowDialog(); } } catch (Exception ex) { // カーソルの状態を元に戻す this.Cursor = Cursors.Default; // エラーロギング new CommonException(ex); // メッセージボックスの処理、PDF作成失敗の場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, "印刷が失敗しました。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); return; } }