///<summary> /// テキストの文字チェック ///</summary> private Boolean chkText(string target) { //文字チェック用 Boolean bln = false; //禁止文字チェック bln = StringUtl.JudBanChr(target); if (bln == true) { //数字のみを許可する bln = StringUtl.JudBanSelect(target, CommonTeisu.NUMBER_ONLY); } return bln; }
/// <summary> /// txtGamenNoTextChanged /// 画面No入力項目に変更があった場合 /// </summary> private void txtGamenNoTextChanged(object sender, EventArgs e) { Boolean blnGood; //文字数が少ない場合 if (txtGamenNo.TextLength < 3) { return; } if (txtGamenNo.Text == "" || String.IsNullOrWhiteSpace(txtGamenNo.Text).Equals(true)) { lblGamenName.Text = ""; return; } // 禁止文字チェック blnGood = StringUtl.JudBanChr(txtGamenNo.Text); // 数字のみを許可する blnGood = StringUtl.JudBanSelect(txtGamenNo.Text, CommonTeisu.NUMBER_ONLY); if (blnGood == false) { lblGamenName.Text = ""; // メッセージボックスの処理、項目が該当する禁止文字を含む場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_MISS, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); return; } // 前後の空白を取り除く txtGamenNo.Text = txtGamenNo.Text.Trim(); // ビジネス層のインスタンス生成 G0920_HidukeSeigen_B hidukeB = new G0920_HidukeSeigen_B(); try { // 検索実行 DataTable dtGamenList = hidukeB.getGamenList(txtGamenNo.Text); // データの有無チェック if (dtGamenList.Rows.Count != 0) { txtGamenNo.Text = dtGamenList.Rows[0]["PG番号"].ToString(); lblGamenName.Text = dtGamenList.Rows[0]["PG名"].ToString(); } else { lblGamenName.Text = ""; // メッセージボックスの処理、項目のデータがない場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_VIEW, CommonTeisu.LABEL_NOTDATA, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); return; } 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> ///updTxtTokuisakiLeave ///code入力箇所からフォーカスが外れた時 ///</summary> public void updTxtTokuisakiLeave(object sender, EventArgs e) { //データ渡し用 List <string> lstStringSQL = new List <string>(); DataTable dtSetCd; string strSQLName = null; Boolean blnGood; if (this.CodeTxtText == "" || String.IsNullOrWhiteSpace(this.CodeTxtText).Equals(true)) { this.valueTextText = ""; this.AppendLabelText = ""; return; } //禁止文字チェック blnGood = StringUtl.JudBanChr(this.CodeTxtText); //数字のみを許可する blnGood = StringUtl.JudBanSelect(this.CodeTxtText, CommonTeisu.NUMBER_ONLY); if (blnGood == false) { this.valueTextText = ""; //グループボックスかパネル内にいる場合 if (this.Parent is GroupBox || this.Parent is Panel) { //メッセージボックスの処理、項目が該当する禁止文字を含む場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(Parent.Parent, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_MISS, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); SendKeys.Send("+{TAB}"); return; } else { //メッセージボックスの処理、項目が該当する禁止文字を含む場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(Parent, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_MISS, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); SendKeys.Send("+{TAB}"); return; } } //前後の空白を取り除く this.CodeTxtText = this.CodeTxtText.Trim(); if (this.CodeTxtText.Length < 4) { this.CodeTxtText = this.CodeTxtText.ToString().PadLeft(4, '0'); } // 存在チェックを行い if (SearchOn == false) { return; } strSQLName = "C_LIST_Torihikisaki_SELECT_LEAVE"; //データ渡し用 lstStringSQL.Add("Common"); lstStringSQL.Add(strSQLName); OpenSQL opensql = new OpenSQL(); try { string strSQLInput = opensql.setOpenSQL(lstStringSQL); if (strSQLInput == "") { return; } //配列設定 string[] aryStr = { this.CodeTxtText }; strSQLInput = string.Format(strSQLInput, aryStr); //SQLのインスタンス作成 DBConnective dbconnective = new DBConnective(); //SQL文を直書き(+戻り値を受け取る) dtSetCd = dbconnective.ReadSql(strSQLInput); if (dtSetCd.Rows.Count != 0) { string strZeikubun = ""; if (dtSetCd.Rows[0]["消費税計算区分"].ToString() == "0" || dtSetCd.Rows[0]["消費税計算区分"].ToString() == "2") { strZeikubun = "外税"; } else if (dtSetCd.Rows[0]["消費税計算区分"].ToString() == "1") { strZeikubun = "内税"; } this.CodeTxtText = dtSetCd.Rows[0]["取引先コード"].ToString(); this.valueTextText = dtSetCd.Rows[0]["取引先名称"].ToString(); this.AppendLabelText = strZeikubun; } else { this.valueTextText = ""; //グループボックスかパネル内にいる場合 if (this.Parent is GroupBox || this.Parent is Panel) { //メッセージボックスの処理、項目のデータがない場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this.Parent.Parent, CommonTeisu.TEXT_VIEW, CommonTeisu.LABEL_NOTDATA, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); return; } else { //メッセージボックスの処理、項目のデータがない場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this.Parent, CommonTeisu.TEXT_VIEW, CommonTeisu.LABEL_NOTDATA, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); return; } } return; } catch (Exception ex) { //データロギング new CommonException(ex); //グループボックスかパネル内にいる場合 if (this.Parent is GroupBox || this.Parent is Panel) { //例外発生メッセージ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this.Parent.Parent, CommonTeisu.TEXT_ERROR, CommonTeisu.LABEL_ERROR_MESSAGE, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); return; } else { //例外発生メッセージ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this.Parent, CommonTeisu.TEXT_ERROR, CommonTeisu.LABEL_ERROR_MESSAGE, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); return; } } }
///<summary> /// chkTxtGroupCd /// ファンクション機能のグループコードエラーチェック処理 /// 引数 :なし /// 戻り値:エラー発生【true】 ///</summary> public bool chkTxtGroupCd() { // データ渡し用 List <string> lstStringSQL = new List <string>(); DataTable dtSetCd; if (this.CodeTxtText == "" || String.IsNullOrWhiteSpace(this.CodeTxtText).Equals(true)) { this.ValueLabelText = ""; this.AppendLabelText = ""; return(false); } // 前後の空白を取り除く this.CodeTxtText = this.CodeTxtText.Trim(); // 禁止文字チェック if (StringUtl.JudBanChr(this.CodeTxtText) == false) { // メッセージボックスの処理、項目が該当する禁止文字を含む場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(Parent, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_MISS, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); // 空にする this.ValueLabelText = ""; this.CodeTxtText = ""; this.AppendLabelText = ""; return(true); } // 全角数字を半角数字に変換する。 this.CodeTxtText = StringUtl.JudZenToHanNum(this.CodeTxtText); //数値数が足りなかった場合0パティング if (StringUtl.JudBanSelect(this.CodeTxtText, CommonTeisu.NUMBER_ONLY) == true) { if (this.CodeTxtText.Length <= 3) { CodeTxtText = CodeTxtText.ToString().PadLeft(4, '0'); } } // 存在チェックを行い if (SearchOn == false) { return(false); } // データ渡し用 lstStringSQL.Add("Common"); lstStringSQL.Add("C_LIST_GroupCd_SELECT_LEAVE"); OpenSQL opensql = new OpenSQL(); try { string strSQLInput = opensql.setOpenSQL(lstStringSQL); if (strSQLInput == "") { return(false); } strSQLInput = string.Format(strSQLInput, this.CodeTxtText); // SQLのインスタンス作成 DBConnective dbconnective = new DBConnective(); // SQL文を直書き(+戻り値を受け取る) dtSetCd = dbconnective.ReadSql(strSQLInput); // データの有無チェック if (dtSetCd.Rows.Count != 0) { this.CodeTxtText = dtSetCd.Rows[0]["グループコード"].ToString(); this.ValueLabelText = dtSetCd.Rows[0]["グループ名"].ToString(); } else { // メッセージボックスの処理、項目のデータがない場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this.Parent, CommonTeisu.TEXT_VIEW, CommonTeisu.LABEL_NOTDATA, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); // 空にする this.ValueLabelText = ""; this.CodeTxtText = ""; this.AppendLabelText = ""; return(true); } return(false); } catch (Exception ex) { //データロギング new CommonException(ex); //例外発生メッセージ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this.Parent, CommonTeisu.TEXT_ERROR, CommonTeisu.LABEL_ERROR_MESSAGE, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); return(true); } }