protected override bool ValidateInput()
        {
            PageCheckManager manager = new PageCheckManager();

            manager.Add(new LengthCheck(this.lblNGCodeEdit, this.txtErrorCodeEdit, 40, true));
            manager.Add(new DecimalCheck(this.lblSmartDateRange, this.txtSmartDateRange, 0, decimal.MaxValue, true));
            manager.Add(new DecimalCheck(this.lblShowItemCount, this.txtShowItemCount, 0, decimal.MaxValue, true));

            if (!manager.Check())
            {
                WebInfoPublish.Publish(this, manager.CheckMessage, this.languageComponent1);
                return(false);
            }

            if (_facade == null)
            {
                _facade = new TSModelFacadeFactory(base.DataProvider).CreateTSModelFacade();
            }
            if (_facade.GetErrorCode(this.txtErrorCodeEdit.Text.Trim().ToUpper()) == null)
            {
                throw new Exception("$ErrorCode_Not_Exist");
            }
            object[] objsTmp = _facade.QueryTSSmartConfig(this.txtErrorCodeEdit.Text.Trim().ToUpper(), 1, 2);
            bool     bExist  = false;

            if (objsTmp != null && objsTmp.Length >= 2)
            {
                bExist = true;
            }
            else if (objsTmp != null && objsTmp.Length == 1)
            {
                if (Convert.ToInt32(((TSSmartConfig)objsTmp[0]).Sequence) != Convert.ToInt32(this.txtSequence.Text))
                {
                    bExist = true;
                }
            }
            if (bExist == true)
            {
                throw new Exception("$ErrorCode_SmartTS_Already_Exist");
            }

            return(true);
        }
Example #2
0
        protected override object GetEditObject(GridRecord row)
        {
            if (_facade == null)
            {
                _facade = new TSModelFacadeFactory(base.DataProvider).CreateTSModelFacade();
            }
            string strCode = string.Empty;
            object objCode = row.Items.FindItemByKey("ErrorCodeA").Value;

            if (objCode != null)
            {
                strCode = objCode.ToString();
            }
            object obj = _facade.GetErrorCode(strCode);

            if (obj != null)
            {
                return((ErrorCodeA)obj);
            }
            return(null);
        }