Example #1
0
        /// <summary>
        /// 返却ボタン押下時のチェック
        /// </summary>
        private void ReturnCheckes()
        {
            // 未入力チェック
            if (string.IsNullOrEmpty(txtId.Text))
            {
                throw new InputException(GlobalDefine.ERROR_CODE[11].message, GlobalDefine.ERROR_CODE[11].code, txtId);
            }

            // 存在チェック
            IsExistBookId();

            // 書籍が貸出中か
            DBAdapter dba   = SingletonObject.GetDbAdapter();
            string    query = string.Format("SELECT * FROM BOOK_STATUS WHERE BOOK_ID = '{0}'", txtId.Text);

            if (dba.FindRecord(query))
            {
                query = string.Format("SELECT " +
                                      "* " +
                                      "FROM " +
                                      "(SELECT * FROM BOOK_STATUS WHERE BOOK_ID = '{0}') " +
                                      "WHERE " +
                                      "(LENDING_STATUS = 0)",
                                      txtId.Text);

                if (!dba.FindRecord(query))
                {
                    throw new InputException(GlobalDefine.ERROR_CODE[20].message, GlobalDefine.ERROR_CODE[20].code, txtId);
                }
            }
        }
Example #2
0
        /// <summary>
        /// 書籍ID LostFocusチェック
        /// </summary>
        private void CheckTxtId()
        {
            // シングルクォーテーションチェック
            InputCheck.IsSingleQuotation(this.txtId);

            // 書籍IDが存在するか
            IsExistBookId();

            // 書籍が貸出中か
            DBAdapter dba   = SingletonObject.GetDbAdapter();
            string    query = string.Format("SELECT * FROM BOOK_STATUS WHERE BOOK_ID = '{0}'", txtId.Text);

            if (dba.FindRecord(query))
            {
                query = string.Format("SELECT " +
                                      "* " +
                                      "FROM " +
                                      "(SELECT * FROM BOOK_STATUS WHERE BOOK_ID = '{0}') " +
                                      "WHERE " +
                                      "(LENDING_STATUS = 0)",
                                      txtId.Text);

                if (!dba.FindRecord(query))
                {
                    throw new InputException(GlobalDefine.ERROR_CODE[20].message, GlobalDefine.ERROR_CODE[20].code, txtId);
                }
            }
        }
Example #3
0
        /// <summary>
        /// 入力チェック用メソッド
        /// </summary>
        private void ErrorCheck()
        {
            // シングルクォーテーションが入っていたら(会社名)
            if (this.textName.Text.IndexOf('\'') >= 0)
            {
                throw new InputException(GlobalDefine.ERROR_CODE[0].message, GlobalDefine.ERROR_CODE[0].code, this.textName);
            }

            // 空文字チェック(会社名)
            if (string.IsNullOrEmpty(this.textName.Text))
            {
                throw new InputException(GlobalDefine.ERROR_CODE[1].message, GlobalDefine.ERROR_CODE[1].code, this.textName);
            }

            // 新規追加モードの場合、会社名が登録されているかどうか
            if (mode == MODE.ADD)
            {
                DBAdapter dba = SingletonObject.GetDbAdapter();
                string    str = string.Format("SELECT * FROM BOOK_GENRE_MASTER WHERE DIVISION_NAME = '{0}'", this.textName.Text);
                if (dba.FindRecord(str))
                {
                    throw new InputException(GlobalDefine.ERROR_CODE[3].message, GlobalDefine.ERROR_CODE[3].code, this.textName);
                }
            }
        }
Example #4
0
        // 削除チェック用のメソッド
        private void DeleteCheck()
        {
            DBAdapter dba = SingletonObject.GetDbAdapter();
            string    str = string.Format("SELECT * FROM USER_MASTER WHERE COMPANY_ID = '{0}' AND RETIREMENT_FLAG = 0", this.textId.Text);

            if (dba.FindRecord(str))
            {
                throw new InputException(GlobalDefine.ERROR_CODE[4].message, GlobalDefine.ERROR_CODE[4].code, this.textId);
            }
        }
Example #5
0
        /// <summary>
        /// 書籍IDの存在チェック
        /// </summary>
        private void IsExistBookId()
        {
            // 書籍IDが存在するか
            DBAdapter dba   = SingletonObject.GetDbAdapter();
            string    query = string.Format("SELECT * FROM BOOK_MASTER WHERE BOOK_ID = '{0}'", txtId.Text);

            if (!dba.FindRecord(query))
            {
                throw new InputException(GlobalDefine.ERROR_CODE[11].message, GlobalDefine.ERROR_CODE[11].code, txtId);
            }
        }
Example #6
0
        /// <summary>
        /// 検索ボタンを押下した際のチェック
        /// </summary>
        private void SearchInputChecks()
        {
             
            if (cmbCompany.SelectedIndex <= 0) // ←なぜ0「以下」
            {
                throw new InputException(GlobalDefine.ERROR_CODE[15].message, GlobalDefine.ERROR_CODE[15].code);
            }

            // シングルクォーテーションチェック
            InputCheck.IsSingleQuotation(this.textUser);

            // ユーザが居るか
            DBAdapter dba   = SingletonObject.GetDbAdapter();
            string    query = string.Format("SELECT * FROM USER_MASTER WHERE USER_NAME LIKE '%{0}%'", textUser.Text);

            if (!dba.FindRecord(query))
            {
                throw new InputException(GlobalDefine.ERROR_CODE[14].message, GlobalDefine.ERROR_CODE[14].code, textUser);
            }
        }