///<summary> /// chktxtGyoshuCd /// 業種コードチェック ///</summary> private bool chkGyoshuCd() { if (StringUtl.JudBanSQL(txtGyoshuCd.Text) == false) { //メッセージボックスの処理、項目が該当する禁止文字を含む場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_MISS, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); this.txtGyoshuCd.Text = ""; txtGyoshuCd.Focus(); return(true); } // 全角数字を半角数字に変換 this.txtGyoshuCd.Text = StringUtl.JudZenToHanNum(txtGyoshuCd.Text); //数値数が足りなかった場合0パティング if (StringUtl.JudBanSelect(txtGyoshuCd.Text, CommonTeisu.NUMBER_ONLY) == true) { if (txtGyoshuCd.TextLength < 4) { txtGyoshuCd.Text = txtGyoshuCd.Text.ToString().PadLeft(4, '0'); } } return(false); }
///<summary> /// chkChokusoCd /// 直送先コードチェック ///</summary> private bool chkChokusoCd() { // 禁止文字チェック if (StringUtl.JudBanSQL(txtChokusoCd.Text) == false) { // メッセージボックスの処理、項目が該当する禁止文字を含む場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_MISS, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); DipDelChokusoInfo(); return(true); } this.txtChokusoCd.Text = StringUtl.JudZenToHanNum(txtChokusoCd.Text); // 数値チェック if (StringUtl.JudBanSelect(txtChokusoCd.Text, CommonTeisu.NUMBER_ONLY) == true) { // 文字数が足りなかった場合0パティング if (txtChokusoCd.TextLength < 4) { txtChokusoCd.Text = txtChokusoCd.Text.ToString().PadLeft(4, '0'); } } return(false); }
///<summary> ///chkToriikisaki ///code入力箇所からフォーカスがついた時 ///</summary> private bool chkToriikisaki() { if (txtCdT.Text == "" || String.IsNullOrWhiteSpace(txtCdT.Text).Equals(true)) { return false; } // 前後の空白を取り除く txtCdT.Text = txtCdT.Text.Trim(); // 禁止文字チェック if (StringUtl.JudBanSQL(txtCdT.Text) == false) { // メッセージボックスの処理、項目が該当する禁止文字を含む場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(Parent, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_MISS, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); return true; } // 全角数字を半角数字に変換 txtCdT.Text = StringUtl.JudZenToHanNum(txtCdT.Text); // 数値チェック if (StringUtl.JudBanSelect(txtCdT.Text, CommonTeisu.NUMBER_ONLY) == true) { // 4文字以下の場合0パティング if (txtCdT.Text.Length < 4) { txtCdT.Text = txtCdT.Text.ToString().PadLeft(4, '0'); } } return false; }
///<summary> ///setTxtMakerLeave ///code入力箇所からフォーカスが外れた時の処理 ///</summary> public void setTxtMakerLeave() { //データ渡し用 List <string> lstStringSQL = new List <string>(); DataTable dtSetCd; if (this.CodeTxtText == "" || String.IsNullOrWhiteSpace(this.CodeTxtText).Equals(true)) { this.ValueLabelText = ""; this.AppendLabelText = ""; return; } //前後の空白を取り除く this.CodeTxtText = this.CodeTxtText.Trim(); //禁止文字チェック if (StringUtl.JudBanSQL(this.CodeTxtText) == false) { //グループボックスかパネル内にいる場合 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}"); } else { //メッセージボックスの処理、項目が該当する禁止文字を含む場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(Parent, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_MISS, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); SendKeys.Send("+{TAB}"); } this.ValueLabelText = ""; this.CodeTxtText = ""; this.AppendLabelText = ""; //エラーメッセージを表示された blMessageOn = true; return; } // 全角数字を半角数字に変換 this.CodeTxtText = StringUtl.JudZenToHanNum(this.CodeTxtText); // 数値チェック if (StringUtl.JudBanSelect(this.CodeTxtText, CommonTeisu.NUMBER_ONLY) == true) { if (this.CodeTxtText.Length <= 3) { this.CodeTxtText = this.CodeTxtText.ToString().PadLeft(4, '0'); } } //データ渡し用 lstStringSQL.Add("Common"); lstStringSQL.Add("C_LIST_Maker_SELECT_LEAVE"); OpenSQL opensql = new OpenSQL(); try { string strSQLInput = opensql.setOpenSQL(lstStringSQL); if (strSQLInput == "") { return; } 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(); blMessageOn = false; } else { //グループボックスかパネル内にいる場合 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(); SendKeys.Send("+{TAB}"); } else { //メッセージボックスの処理、項目のデータがない場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this.Parent, CommonTeisu.TEXT_VIEW, CommonTeisu.LABEL_NOTDATA, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); SendKeys.Send("+{TAB}"); } this.ValueLabelText = ""; this.CodeTxtText = ""; this.AppendLabelText = ""; blMessageOn = true; 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(); SendKeys.Send("+{TAB}"); return; } else { //例外発生メッセージ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this.Parent, CommonTeisu.TEXT_ERROR, CommonTeisu.LABEL_ERROR_MESSAGE, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); SendKeys.Send("+{TAB}"); return; } } }
///<summary> /// chkTxtShiresaki /// ファンクション機能の仕入先コードエラーチェック処理 /// 引数 :なし /// 戻り値:エラー発生【true】 ///</summary> public bool chkTxtShiresaki() { // データ渡し用 List <string> lstStringSQL = new List <string>(); DataTable dtSetCd; Boolean blnGood; if (this.CodeTxtText == "" || String.IsNullOrWhiteSpace(this.CodeTxtText).Equals(true)) { this.ValueLabelText = ""; this.AppendLabelText = ""; return(false); } // 前後の空白を取り除く this.CodeTxtText = this.CodeTxtText.Trim(); // 禁止文字チェック if (StringUtl.JudBanSQL(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.AppendLabelText = ""; this.CodeTxtText = ""; return(true); } // 全角数字を半角数字に変換 this.CodeTxtText = StringUtl.JudZenToHanNum(this.CodeTxtText); // 数値チェック if (StringUtl.JudBanSelect(this.CodeTxtText, CommonTeisu.NUMBER_ONLY) == true) { // 4文字以下の場合0パティング if (this.CodeTxtText.Length < 4) { this.CodeTxtText = this.CodeTxtText.ToString().PadLeft(4, '0'); } } // データ渡し用 lstStringSQL.Add("Common"); lstStringSQL.Add("C_LIST_ShiresakiAS400_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.AppendLabelText = ""; this.CodeTxtText = ""; 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); } }
///<summary> ///setTxtTokuisakiLeave ///code入力箇所からフォーカスが外れた時の処理 ///</summary> public void setTxtTokuisakiLeave() { //データ渡し用 List <string> lstStringSQL = new List <string>(); DataTable dtSetCd; if (this.CodeTxtText == "" || String.IsNullOrWhiteSpace(this.CodeTxtText).Equals(true)) { this.ValueLabelText = ""; this.AppendLabelText = ""; return; } //前後の空白を取り除く this.CodeTxtText = this.CodeTxtText.Trim(); //禁止文字チェック if (StringUtl.JudBanSQL(this.CodeTxtText) == false) { //Parent 内のすべてのコントロールを列挙する foreach (Control cControl in Parent.Controls) { //列挙したコントロールにコントロールが含まれている場合は再帰呼び出しする if (cControl is BaseButton) { if (cControl.Text == "F12:戻る") { //フォーカスがボタンを指している場合 Control ctrlParent = ParentForm.ActiveControl; if (ctrlParent.Name == "btnF12") { //全てのフォームの中から foreach (System.Windows.Forms.Form frm in Application.OpenForms) { //商品のフォームを探す if (frm.Name == Parent.Name) { //仕入リストの場合 if (frm.Name == "ShireList") { //データを連れてくるため、newをしないこと ShireList shirelist = (ShireList)frm; shirelist.btnEndClick(null, null); return; } } } } } } } //グループボックスかパネル内にいる場合 if (this.Parent is GroupBox || this.Parent is Panel) { //メッセージボックスの処理、項目が該当する禁止文字を含む場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this.Parent.Parent, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_MISS, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); SendKeys.Send("+{TAB}"); } else { //メッセージボックスの処理、項目が該当する禁止文字を含む場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this.Parent, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_MISS, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); SendKeys.Send("+{TAB}"); } this.ValueLabelText = ""; this.CodeTxtText = ""; this.AppendLabelText = ""; //エラーメッセージを表示された blMessageOn = true; return; } // 全角数字を半角数字に変換 this.CodeTxtText = StringUtl.JudZenToHanNum(this.CodeTxtText); // 数値チェック if (StringUtl.JudBanSelect(this.CodeTxtText, CommonTeisu.NUMBER_ONLY) == true) { if (this.CodeTxtText.Length < 4) { this.CodeTxtText = this.CodeTxtText.ToString().PadLeft(4, '0'); } } // 存在チェックを行い if (SearchOn == false) { return; } //データ渡し用 lstStringSQL.Add("Common"); lstStringSQL.Add("C_LIST_Tantousha_SELECT_LEAVE"); OpenSQL opensql = new OpenSQL(); try { string strSQLInput = opensql.setOpenSQL(lstStringSQL); if (strSQLInput == "") { return; } 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(); blMessageOn = false; } else { //グループボックスかパネル内にいる場合 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(); SendKeys.Send("+{TAB}"); } else { //メッセージボックスの処理、項目のデータがない場合のウィンドウ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this.Parent, CommonTeisu.TEXT_VIEW, CommonTeisu.LABEL_NOTDATA, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); SendKeys.Send("+{TAB}"); } this.ValueLabelText = ""; this.CodeTxtText = ""; this.AppendLabelText = ""; //エラーメッセージを表示された blMessageOn = true; 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(); SendKeys.Send("+{TAB}"); return; } else { //例外発生メッセージ(OK) BaseMessageBox basemessagebox = new BaseMessageBox(this.Parent, CommonTeisu.TEXT_ERROR, CommonTeisu.LABEL_ERROR_MESSAGE, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); SendKeys.Send("+{TAB}"); return; } } }