예제 #1
0
        ///<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;
                }
            }
        }
예제 #2
0
        ///<summary>
        ///setData
        ///code入力箇所からフォーカスが外れた時の処理
        ///</summary>
        private void setData()
        {
            //データ渡し用
            List <string> lstStringSQL = new List <string>();

            DataTable dtSetCd;

            Boolean blnGood;

            //空白、文字数4以上の場合
            if (this.CodeTxtText == "" || String.IsNullOrWhiteSpace(this.CodeTxtText).Equals(true) || this.CodeTxtText.Length > 3)
            {
                this.ValueLabelText  = "";
                this.AppendLabelText = "";
                return;
            }

            //前後の空白を取り除く
            this.CodeTxtText = this.CodeTxtText.Trim();

            //禁止文字チェック
            if (StringUtl.JudBanSQL(this.CodeTxtText) == false ||
                StringUtl.JudBanSelect(this.CodeTxtText, CommonTeisu.NUMBER_ONLY) == false)
            {
                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();
                }
                else
                {
                    //メッセージボックスの処理、項目が該当する禁止文字を含む場合のウィンドウ(OK)
                    BaseMessageBox basemessagebox = new BaseMessageBox(Parent, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_MISS, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox.ShowDialog();
                }

                //エラーメッセージを表示された
                blMessageOn = true;

                CodeTxtText = "0";
                return;
            }

            //データ渡し用
            lstStringSQL.Add("Common");
            lstStringSQL.Add("C_LIST_Menu_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)
                {
                    //PG番号が0の場合
                    if (dtSetCd.Rows[0]["PG番号"].ToString() == "0")
                    {
                        this.CodeTxtText    = "0";
                        this.ValueLabelText = "";
                    }
                    else
                    {
                        this.CodeTxtText    = dtSetCd.Rows[0]["PG番号"].ToString();
                        this.ValueLabelText = dtSetCd.Rows[0]["PG名"].ToString();
                    }
                    blMessageOn = false;
                }
                else
                {
                    //初期化
                    this.CodeTxtText    = "0";
                    this.ValueLabelText = "0";

                    //グループボックスかパネル内にいる場合
                    if (this.Parent is TabPage)
                    {
                        //メッセージボックスの処理、項目のデータがない場合のウィンドウ(OK)
                        BaseMessageBox basemessagebox = new BaseMessageBox(this.Parent.Parent.Parent, "入力", "指定されたPgNo.は登録されていません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_EXCLAMATION);
                        basemessagebox.ShowDialog();
                    }
                    else if (this.Parent is GroupBox || this.Parent is Panel)
                    {
                        //メッセージボックスの処理、項目のデータがない場合のウィンドウ(OK)
                        BaseMessageBox basemessagebox = new BaseMessageBox(this.Parent.Parent, "入力", "指定されたPgNo.は登録されていません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_EXCLAMATION);
                        basemessagebox.ShowDialog();
                    }
                    else
                    {
                        //メッセージボックスの処理、項目のデータがない場合のウィンドウ(OK)
                        BaseMessageBox basemessagebox = new BaseMessageBox(this.Parent, "入力", "指定されたPgNo.は登録されていません。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_EXCLAMATION);
                        basemessagebox.ShowDialog();
                    }

                    //エラーメッセージを表示された
                    blMessageOn = true;
                }
                return;
            }
            catch (Exception ex)
            {
                //データロギング
                new CommonException(ex);

                //グループボックスかパネル内にいる場合
                if (this.Parent is GroupBox || this.Parent is Panel || this.Parent is TabPage)
                {
                    //例外発生メッセージ(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;
                }
            }
        }
예제 #3
0
        ///<summary>
        ///codeTxt_TextChanged
        ///入力項目に変更があった場合
        ///</summary>
        private void codeTxt_TextChanged(object sender, EventArgs e)
        {
            //データ渡し用
            List <string> lstStringSQL = new List <string>();

            DataTable dtSetCd;

            string strSQLName = null;

            if (this.CodeTxtText == "" || String.IsNullOrWhiteSpace(this.CodeTxtText).Equals(true))
            {
                this.ValueLabelText = "";
                return;
            }

            //前後の空白を取り除く
            this.CodeTxtText = this.CodeTxtText.Trim();

            strSQLName = "C_LIST_Maker_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)
                {
                    this.CodeTxtText    = dtSetCd.Rows[0]["メーカーコード"].ToString();
                    this.ValueLabelText = 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();
                    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;
                }
            }
        }
예제 #4
0
        ///<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;
                }
            }
        }
예제 #5
0
        ///<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);
            }
        }
예제 #6
0
        ///<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;
                }
            }
        }
예제 #7
0
        ///<summary>
        /// chkTxtDaibunrui
        /// ファンクション機能の大分類コードエラーチェック処理
        /// 引数 :なし
        /// 戻り値:エラー発生【true】
        ///</summary>
        public bool chkTxtDaibunrui()
        {
            // データ渡し用
            List <string> lstStringSQL = new List <string>();

            DataTable dtSetCd;

            // 空白、文字数3以上の場合
            if (this.CodeTxtText == "" || String.IsNullOrWhiteSpace(this.CodeTxtText).Equals(true) || this.CodeTxtText.Length > 2)
            {
                this.ValueLabelText  = "";
                this.AppendLabelText = "";
                return(false);
            }

            // 前後の空白を取り除く
            this.CodeTxtText = this.CodeTxtText.Trim();

            if (StringUtl.JudBanSQL(this.CodeTxtText) == false ||
                StringUtl.JudBanSelect(this.CodeTxtText, CommonTeisu.NUMBER_ONLY) == 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);
            }

            // ゼロ詰め処理
            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(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(Parent, CommonTeisu.TEXT_INPUT, 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);
            }
        }
예제 #8
0
        ///<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;
                }
            }
        }
예제 #9
0
        /// <summary>
        ///     途中入力の場合のチェックロジック
        /// </summary>
        /// <returns>
        ///    エラーの場合:true 正常な場合:false
        /// </returns>
        public bool chkMoneyText()
        {
            // 削除する文字
            char[] removeChars = new char[] { '-' };

            // テキストボックスの値を取得
            string strTextBoxValue = this.Text;

            // "-"があった場合
            if (strTextBoxValue.IndexOf('-') > -1)
            {
                // blInputMinusをtrueにする
                blInputMinus = true;
            }
            else
            {
                blInputMinus = false;
            }
            // "-" を取り除く
            foreach (char c in removeChars)
            {
                strTextBoxValue = strTextBoxValue.Replace(c.ToString(), "");
            }

            if (strTextBoxValue == "")
            {
                // "-" を取り除いた値が空の場合、テキストボックスに"0"を入れる
                if (blInputMinus == true)
                {
                    this.Text = "0";
                    return(false);
                }
                else
                {
                    return(false);
                }
            }

            // 数字チェック(数字ではない場合、空が返ってくる)
            strTextBoxValue = chkNumber(strTextBoxValue);

            if (strTextBoxValue.Equals(""))
            {
                if (this.Parent is BaseForm)
                {
                    //データ存在なしメッセージ(OK)
                    BaseMessageBox basemessagebox_Nodata = new BaseMessageBox(this.Parent, "", "数値を入力してください。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox_Nodata.ShowDialog();

                    this.Text = "";
                }
                else if (this.Parent.Parent is BaseForm)
                {
                    //データ存在なしメッセージ(OK)
                    BaseMessageBox basemessagebox_Nodata = new BaseMessageBox(this.Parent.Parent, "", "数値を入力してください。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox_Nodata.ShowDialog();

                    this.Text = "";
                }

                return(true);
            }

            // 入力された値にマイナスが付いていた場合
            if (blInputMinus == true)
            {
                // 値が"0"の場合、マイナスは付けない
                if (strTextBoxValue.Equals("0"))
                {
                    //四捨五入
                    strTextBoxValue = updShishagonyu(strTextBoxValue, intDeciSet);
                }
                else
                {
                    //四捨五入
                    strTextBoxValue = "-" + updShishagonyu(strTextBoxValue, intDeciSet);
                }
            }
            else
            {
                //四捨五入
                strTextBoxValue = updShishagonyu(strTextBoxValue, intDeciSet);
            }

            this.Text = strTextBoxValue;

            //カンマ付け、小数点以下付けに移動
            updPriceMethod();

            return(false);
        }
예제 #10
0
        //
        //別の場所にフォーカスされた時
        //
        private void updMoneyLeave(object sender, EventArgs e)
        {
            // 削除する文字
            char[] removeChars = new char[] { '-' };

            //背景色を白にする
            this.BackColor = Color.White;

            //フォーカスが外れたのでリセット
            blnFirstClick = true;

            // テキストボックスの値を取得
            string strTextBoxValue = this.Text;

            // "-"があった場合
            if (strTextBoxValue.IndexOf('-') > -1)
            {
                // blInputMinusをtrueにする
                blInputMinus = true;
            }
            else
            {
                blInputMinus = false;
            }
            // "-" を取り除く
            foreach (char c in removeChars)
            {
                strTextBoxValue = strTextBoxValue.Replace(c.ToString(), "");
            }

            if (strTextBoxValue == "")
            {
                // "-" を取り除いた値が空の場合、テキストボックスに"0"を入れる
                if (blInputMinus == true)
                {
                    this.Text = "0";
                }
                return;
            }

            // 数字チェック(数字ではない場合、空が返ってくる)
            strTextBoxValue = chkNumber(strTextBoxValue);

            if (strTextBoxValue.Equals(""))
            {
                if (this.Parent is BaseForm)
                {
                    //データ存在なしメッセージ(OK)
                    BaseMessageBox basemessagebox_Nodata = new BaseMessageBox(this.Parent, "", "数値を入力してください。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox_Nodata.ShowDialog();

                    this.Text = "";
                }
                else if (this.Parent.Parent is BaseForm)
                {
                    //データ存在なしメッセージ(OK)
                    BaseMessageBox basemessagebox_Nodata = new BaseMessageBox(this.Parent.Parent, "", "数値を入力してください。", CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR);
                    basemessagebox_Nodata.ShowDialog();

                    this.Text = "";
                }

                // ラベルセットのカーソル色が残るのを防ぐ
                // todo:しかしShift + Tabで移動した場合は二重になるため対応策が必要(加藤Prj_問題点課題管理表 No29)
                SendKeys.Send("+{TAB}");

                return;
            }

            // 入力された値にマイナスが付いていた場合
            if (blInputMinus == true)
            {
                // 値が"0"の場合、マイナスは付けない
                if (strTextBoxValue.Equals("0"))
                {
                    //四捨五入
                    strTextBoxValue = updShishagonyu(strTextBoxValue, intDeciSet);
                }
                else
                {
                    //四捨五入
                    strTextBoxValue = "-" + updShishagonyu(strTextBoxValue, intDeciSet);
                }
            }
            else
            {
                //四捨五入
                strTextBoxValue = updShishagonyu(strTextBoxValue, intDeciSet);
            }

            this.Text = strTextBoxValue;

            //カンマ付け、小数点以下付けに移動
            updPriceMethod();
        }