///<summary> ///setTxtMakerTextLeave ///code入力箇所からフォーカスが外れた時 ///</summary> public void setTxtMakerTextLeave(object sender, EventArgs e) { //フォーカス位置の確保 Control cActive = this.ActiveControl; //検索時のデータ取り出し先 DataTable dtSetCd = null; //前後の空白を取り除く txtMaker.Text = txtMaker.Text.Trim(); //空文字判定 if (txtMaker.blIsEmpty() == false) { return; } //メーカーコードチェック if (chkMakerCd() == true) { return; } //ビジネス層、検索ロジックに移動 M1020_Maker_B makerB = new M1020_Maker_B(); try { //戻り値のDatatableを取り込む dtSetCd = makerB.getTxtMakerTextLeave(txtMaker.Text); //Datatable内のデータが存在する場合 if (dtSetCd.Rows.Count != 0) { txtMaker.Text = dtSetCd.Rows[0]["メーカーコード"].ToString(); txtName.Text = dtSetCd.Rows[0]["メーカー名"].ToString(); txtNameKana.Text = dtSetCd.Rows[0]["カナ"].ToString(); txtName.Focus(); // ファンクションボタン制御 this.btnF01.Enabled = true; this.btnF03.Enabled = true; this.btnF04.Enabled = true; } else { txtName.Text = ""; // ファンクションボタン制御 this.btnF01.Enabled = true; this.btnF03.Enabled = false; this.btnF04.Enabled = true; } cActive.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> ///delMaker ///テキストボックス内のデータをDBから削除 ///</summary> public void delMaker() { //記入情報削除用 List <string> lstMakerData = new List <string>(); //検索時のデータ取り出し先 DataTable dtSetCd; //空文字判定(メーカーコード) if (txtMaker.blIsEmpty() == false) { return; } //メーカーコードチェック if (chkMakerCd() == true) { return; } //ビジネス層のインスタンス生成 M1020_Maker_B makerB = new M1020_Maker_B(); try { //検索 dtSetCd = makerB.getTxtMakerTextLeave(txtMaker.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; } //削除情報を入れる(メーカーCD、メーカー名、ユーザー名) lstMakerData.Add(dtSetCd.Rows[0]["メーカーコード"].ToString()); lstMakerData.Add(dtSetCd.Rows[0]["メーカー名"].ToString()); lstMakerData.Add(SystemInformation.UserName); lstMakerData.Add(dtSetCd.Rows[0]["カナ"].ToString()); //ビジネス層、削除ロジックに移動 makerB.delMaker(lstMakerData); //メッセージボックスの処理、削除完了のウィンドウ(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; } }