///<summary> ///showChubunList ///コード入力項目でのキー入力判定 ///</summary> private void showChubunList() { //大分類コードが存在する場合 if (lblSetDaibun.CodeTxtText != "") { //ラベルセットである情報を渡すためにインスタンス生成 LabelSet_Chubunrui lblSetChubunSelect = new LabelSet_Chubunrui(); //中分類リストのインスタンス生成 ChubunruiList chubunruilist = new ChubunruiList(this, lblSetChubunSelect, lblSetDaibun.CodeTxtText); try { //中分類リストの表示、画面IDを渡す chubunruilist.StartPosition = FormStartPosition.Manual; chubunruilist.intFrmKind = KATO.Common.Util.CommonTeisu.FRM_CHUBUNRUI; chubunruilist.ShowDialog(); } 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> ///judChubunruiKeyDown ///コード入力項目でのキー入力判定(中分類) ///</summary> private void judChubunruiKeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F9) { //大分類の値がない場合 if (this.strdaibunCd == null) { return; } //グループボックスかパネル内にいる場合 if (this.Parent is GroupBox || this.Parent is Panel) { ChubunruiList chubunruiList = new ChubunruiList(this.Parent.Parent, this, strdaibunCd); chubunruiList.Show(); } //親画面がBaseFormの場合 else { ChubunruiList chubunruiList = new ChubunruiList(this.Parent, this, strdaibunCd); chubunruiList.Show(); } } else if (e.KeyCode == Keys.Enter) { //TABボタンと同じ効果 SendKeys.Send("{TAB}"); } }
///<summary> ///judtxtCyokuCDKeyDown ///コード入力項目でのキー入力判定 ///作成者:大河内 ///作成日:2017/3/3 ///更新者:大河内 ///更新日:2017/3/2 ///カラム論理名 ///</summary> private void judtxtCyokuCDKeyDown(object sender, KeyEventArgs e) { //F9を押して且つ大分類コードが記載されている状態 if (e.KeyCode == Keys.F9 && txtDaibunrui.Text != "") { ChubunruiList cyokusousakilist = new ChubunruiList(); cyokusousakilist.Left = 100; cyokusousakilist.StartPosition = FormStartPosition.Manual; cyokusousakilist.intFrmKind = KATO.Common.Util.CommonTeisu.FRM_CYUBUNRUI; cyokusousakilist.strDaibunruiCode = txtDaibunrui.Text; cyokusousakilist.Show(); } }
///<summary> ///judChubunEditKeyDown ///コード入力項目でのキー入力判定(編集中分類) ///作成者:大河内 ///作成日:2017/3/16 ///更新者:大河内 ///更新日:2017/3/16 ///カラム論理名 ///</summary> private void judChubunEditKeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F9) { if (String.IsNullOrWhiteSpace(txtDaibunrui.Text).Equals(true)) { return; } ChubunruiList chubunruilist = new ChubunruiList(); chubunruilist.Left = 100; chubunruilist.StartPosition = FormStartPosition.Manual; chubunruilist.intFrmKind = CommonTeisu.FRM_TANAOROSHI_EDIT; chubunruilist.strDaibunruiCode = txtDaibunrui.Text; chubunruilist.Show(); } else { setMoveOrder(sender, e); } }
///<summary> ///updTxtDaibunruiLeave ///code入力箇所からフォーカスが外れた時の処理 ///</summary> public void setTxtDaibunruiLeave() { //データ渡し用 List <string> lstStringSQL = new List <string>(); DataTable dtSetCd; //情報を投げる必須項目になるため空の情報を作成 object sender = null; EventArgs e = null; //空白、文字数3以上の場合 if (this.CodeTxtText == "" || String.IsNullOrWhiteSpace(this.CodeTxtText).Equals(true) || this.CodeTxtText.Length > 2) { this.ValueLabelText = ""; this.AppendLabelText = ""; return; } //前後の空白を取り除く this.CodeTxtText = this.CodeTxtText.Trim(); // 禁止文字チェックと数値チェック if (StringUtl.JudBanSQL(this.CodeTxtText) == false || StringUtl.JudBanSelect(this.CodeTxtText, CommonTeisu.NUMBER_ONLY) == 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 == "ChubunruiList") { //データを連れてくるため、newをしないこと ChubunruiList chubunlist = (ChubunruiList)frm; chubunlist.btnEndClick(sender, e); return; } //メーカーリストの場合 else if (frm.Name == "MakerList") { //データを連れてくるため、newをしないこと MakerList makerlist = (MakerList)frm; makerlist.btnEndClick(sender, e); return; } } } } } } } //グループボックスかパネル内にいる場合 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.AppendLabelText = ""; this.CodeTxtText = ""; //エラーメッセージを表示された blMessageOn = true; return; } if (this.CodeTxtText.Length == 1) { CodeTxtText = CodeTxtText.ToString().PadLeft(2, '0'); } //データ渡し用 lstStringSQL.Add("Common"); lstStringSQL.Add("C_LIST_Daibun_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 { this.ValueLabelText = ""; //グループボックスかパネル内にいる場合 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.AppendLabelText = ""; this.CodeTxtText = ""; //エラーメッセージを表示された blMessageOn = true; return; } //中分類のプロパティが空でない場合 if (lschubundata != null) { lschubundata.strDaibunCd = dtSetCd.Rows[0]["大分類コード"].ToString(); } if (lsSubchubundata != null) { lsSubchubundata.strDaibunCd = dtSetCd.Rows[0]["大分類コード"].ToString(); } //メーカーのプロパティが空でない場合 if (lsmakerdata != null) { lsmakerdata.strDaibunCd = dtSetCd.Rows[0]["大分類コード"].ToString(); } if (lsSubmakerdata != null) { lsSubmakerdata.strDaibunCd = dtSetCd.Rows[0]["大分類コード"].ToString(); } 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; } } }