Exemple #1
0
        public bool ValidateField(string inSearchStr, string inOrderBy, bool inForcePopUp)
        {
            bool bllIsVField = true;

            this.mbllPopUpResult = false;

            inOrderBy = inOrderBy.ToUpper();
            if (inOrderBy.ToUpper() == QCoorInfo.Field.Code)
            {
                inSearchStr = inSearchStr.PadRight(this.txtCode.Properties.MaxLength);
            }
            else
            {
                inSearchStr = inSearchStr.PadRight(this.txtName.Properties.MaxLength);
            }

            if (this.mstrSortKey != inOrderBy)
            {
                this.mstrSortKey = inOrderBy;
                this.pmSetSortKey(this.mstrSortKey, true);
            }

            if (this.mstrSearchStr != inSearchStr || this.mbllIsFormQuery == false)
            {
                string strSearch = inSearchStr.TrimEnd();
                if (strSearch == SysDef.gc_DEFAULT_VALDATEKEY_PREFIX_STAR ||
                    strSearch == SysDef.gc_DEFAULT_VALDATEKEY_PREFIX_2SLASH)
                {
                    strSearch = "";
                }

                this.mstrSearchStr = "%" + strSearch + "%";
                this.pmRefreshBrowView();
            }

            int intSeekVal = this.gridView1.LocateByValue(0, this.gridView1.Columns[this.mstrSortKey], inSearchStr);

            bllIsVField = (intSeekVal < 0);

            this.mbllIsShowDialog = false;
            if (inForcePopUp || bllIsVField)
            {
                this.gridView1.FocusedColumn = this.gridView1.Columns[this.mstrSortKey];

                this.gridView1.MoveLast();
                this.gridView1.StartIncrementalSearch(inSearchStr.TrimEnd());
                if (this.gridView1.FocusedRowHandle >= this.gridView1.RowCount - 1)
                {
                    string strSeekNear = BizRule.GetNearString(this.dtsDataEnv.Tables[this.mstrBrowViewAlias], inSearchStr.Trim(), inOrderBy);
                    strSeekNear = strSeekNear.PadRight(inOrderBy.ToUpper() == QCoorInfo.Field.Code ? this.txtCode.Properties.MaxLength : this.txtName.Properties.MaxLength);
                    this.gridView1.StartIncrementalSearch(strSeekNear);
                }

                this.ShowDialog();
                this.mbllIsShowDialog = true;
            }
            else
            {
                this.gridView1.FocusedRowHandle = intSeekVal;
                this.mbllPopUpResult            = true;
            }

            return(this.mbllPopUpResult);
        }
Exemple #2
0
        public bool ValidateField(string inPdType, string inSearchStr, string inOrderBy, bool inForcePopUp)
        {
            bool bllIsVField = true;

            this.mbllPopUpResult = false;

            this.gridView1.OptionsView.ShowAutoFilterRow = true;
            this.gridView1.OptionsView.ShowAutoFilterRow = false;
            this.gridView1.OptionsView.ShowAutoFilterRow = true;

            inOrderBy = inOrderBy.ToUpper();
            if (inOrderBy.ToUpper() == "FCCODE")
            {
                inSearchStr = inSearchStr.PadRight(MAXLENGTH_CODE);
            }
            else
            {
                inSearchStr = inSearchStr.PadRight(MAXLENGTH_NAME);
            }

            //if (inOrderBy.ToUpper() == "FCCODE")
            //    inSearchStr = inSearchStr.TrimEnd();
            //else
            //    inSearchStr = inSearchStr.TrimEnd();

            if (this.mstrSortKey != inOrderBy)
            {
                this.mstrSortKey = inOrderBy;
                this.pmSetSortKey(this.mstrSortKey, true);
            }

            if (this.mstrSearchStr != inSearchStr ||
                inPdType != this.mstrPdType ||
                this.mbllIsFormQuery == false)
            {
                string strSearch = inSearchStr.TrimEnd();
                if (strSearch == SysDef.gc_DEFAULT_VALDATEKEY_PREFIX_STAR ||
                    strSearch == SysDef.gc_DEFAULT_VALDATEKEY_PREFIX_2SLASH)
                {
                    strSearch = "";
                }

                //this.mstrSearchStr = "%" + strSearch + "%";
                this.mstrSearchStr = strSearch;
                this.mstrPdType    = inPdType;
                this.pmRefreshBrowView();
            }

            int intSeekVal = this.gridView1.LocateByValue(0, this.gridView1.Columns[this.mstrSortKey], inSearchStr);

            bllIsVField = (intSeekVal < 0);

            this.mbllIsShowDialog = false;
            if (inForcePopUp || bllIsVField)
            {
                //this.gridView1.StartIncrementalSearch(inSearchStr.TrimEnd());
                //this.ShowDialog();
                //this.mbllIsShowDialog = true;

                this.gridView1.FocusedColumn = this.gridView1.Columns[this.mstrSortKey];

                this.gridView1.MoveLast();
                this.gridView1.StartIncrementalSearch(inSearchStr.TrimEnd());
                if (this.gridView1.FocusedRowHandle >= this.gridView1.RowCount - 1)
                {
                    string strSeekNear = BizRule.GetNearString(this.dtsDataEnv.Tables[this.mstrBrowViewAlias], inSearchStr.Trim(), inOrderBy);
                    strSeekNear = strSeekNear.PadRight(inOrderBy.ToUpper() == QEMJobInfo.Field.Code ? MAXLENGTH_CODE : MAXLENGTH_NAME);
                    this.gridView1.StartIncrementalSearch(strSeekNear);
                }

                this.mintFocusRow = this.gridView1.FocusedRowHandle;

                this.ShowDialog();
                this.mbllIsShowDialog = true;
            }
            else
            {
                this.gridView1.FocusedRowHandle = intSeekVal;
                this.mbllPopUpResult            = true;
            }
            return(this.mbllPopUpResult);
        }