Exemplo n.º 1
0
        public bool Check()
        {
            if (this._checkNull)
            {
                if (!NullCheck.Instance().Check(this._label, this._ctrl))
                {
                    if (!WebInfoPublish.isUseDiv)
                    {
                        this._checkMessage = string.Format("{0} $Error_Input_Empty", WebControlTextDistil.Instance().Distil(this._label));
                    }
                    else
                    {
                        //使用DIV弹出,拼写标签,added by Gawain@20130905
                        this._checkMessage = string.Format("<a href=\\'\\' onclick=\"return SetFocus(\\'#{1}\\');\"> {0}</a>   $Error_Input_Empty", WebControlTextDistil.Instance().Distil(this._label), this._ctrl.ID);
                    }
                    return(false);
                }
            }

            //Encoding encoder5 = Encoding.GetEncoding("GB2312");UTF-8
            Encoding encoder5 = Encoding.GetEncoding("UTF-8");//modify by jinger 20160128
            int      length   = encoder5.GetByteCount(WebControlTextDistil.Instance().Distil(this._ctrl));

            if (length > this._maxLength)
            {
                if (!WebInfoPublish.isUseDiv)
                {
                    this._checkMessage += string.Format("{0} $Error_Text_Too_Long", WebControlTextDistil.Instance().Distil(this._label));
                }
                else
                {
                    //使用DIV弹出,拼写标签,added by Gawain@20130905
                    this._checkMessage += string.Format("<a href=\\'\\' onclick=\"return SetFocus(\\'#{1}\\');\" > {0}</a> $Error_Text_Too_Long", WebControlTextDistil.Instance().Distil(this._label), this._ctrl.ID);
                }
                return(false);
            }
            return(true);
        }
Exemplo n.º 2
0
        public bool Check()
        {
            if (this._checkNull)
            {
                if (!NullCheck.Instance().Check(this._fromlabel, this._from))
                {
                    this._checkMessage = string.Format("{0} $Error_Input_Empty", WebControlTextDistil.Instance().Distil(this._fromlabel));
                    return(false);
                }
                if (!NullCheck.Instance().Check(this._tolabel, this._to))
                {
                    this._checkMessage = string.Format("{0} $Error_Input_Empty", WebControlTextDistil.Instance().Distil(this._tolabel));
                    return(false);
                }
            }

            decimal from = 0;
            decimal to   = 0;

            try
            {
                from = System.Decimal.Parse(_from);
            }
            catch (FormatException)
            {
                this._checkMessage = string.Format("{0} $Error_Number_Format_Error", WebControlTextDistil.Instance().Distil(this._fromlabel));
                return(false);
            }
            catch (OverflowException)
            {
                this._checkMessage = string.Format("{0} $Error_Number_Overflow", WebControlTextDistil.Instance().Distil(this._fromlabel));
                return(false);
            }

            try
            {
                to = System.Decimal.Parse(_to);
            }
            catch (FormatException)
            {
                this._checkMessage = string.Format("{0} $Error_Number_Format_Error", WebControlTextDistil.Instance().Distil(this._tolabel));
                return(false);
            }
            catch (OverflowException)
            {
                this._checkMessage = string.Format("{0} $Error_Number_Overflow", WebControlTextDistil.Instance().Distil(this._tolabel));
                return(false);
            }

            if (from > to)
            {
                if (this._fromlabel == this._tolabel)
                {
                    this._checkMessage = string.Format("{0} $Error_From_Greater_Than_To", WebControlTextDistil.Instance().Distil(this._fromlabel));
                }
                else
                {
                    this._checkMessage = string.Format("{0} $Error_Greater_Than {1}", WebControlTextDistil.Instance().Distil(this._fromlabel), WebControlTextDistil.Instance().Distil(this._tolabel));
                }
                return(false);
            }

            return(true);
        }
Exemplo n.º 3
0
        public bool Check()
        {
            if (this._checkNull)
            {
                if (!NullCheck.Instance().Check(this._label, this._ctrl))
                {
                    if (!WebInfoPublish.isUseDiv)
                    {
                        this._checkMessage = string.Format("{0} $Error_Input_Empty", WebControlTextDistil.Instance().Distil(this._label));
                    }
                    else
                    {
                        //使用DIV弹出,拼写标签,added by Gawain@20130905
                        this._checkMessage += string.Format("<a href=\\'\\' onclick=\"return SetFocus(\\'#{1}\\');\" > {0}</a> $Error_Input_Empty", WebControlTextDistil.Instance().Distil(this._label), this._ctrl.ID);
                    }
                    return(false);
                }
            }

            try
            {
                decimal num = System.Decimal.Parse(WebControlTextDistil.Instance().Distil(this._ctrl));
                if (num > this._maxValue)
                {
                    //this._checkMessage = "$Error_Number_TooGreat";
                    if (!WebInfoPublish.isUseDiv)
                    {
                        this._checkMessage = string.Format("{0} $Error_Number_TooGreat", WebControlTextDistil.Instance().Distil(this._label));
                    }
                    else
                    {
                        //使用DIV弹出,拼写标签,added by Gawain@20130905
                        this._checkMessage += string.Format("<a href=\\'\\' onclick=\"return SetFocus(\\'#{1}\\');\" > {0}</a> $Error_Number_TooGreat", WebControlTextDistil.Instance().Distil(this._label), this._ctrl.ID);
                    }
                    return(false);
                }
                if (num < this._minValue)
                {
                    //this._checkMessage = "$Error_Number_TooLittle";
                    if (!WebInfoPublish.isUseDiv)
                    {
                        this._checkMessage = string.Format("{0} $Error_Number_TooLittle", WebControlTextDistil.Instance().Distil(this._label));
                    }
                    else
                    {
                        //使用DIV弹出,拼写标签,added by Gawain@20130905
                        this._checkMessage += string.Format("<a href=\\'\\' onclick=\"return SetFocus(\\'#{1}\\');\" > {0}</a> $Error_Number_TooLittle", WebControlTextDistil.Instance().Distil(this._label), this._ctrl.ID);
                    }
                    return(false);
                }
            }
            catch (FormatException)
            {
                if (!WebInfoPublish.isUseDiv)
                {
                    this._checkMessage = string.Format("{0} $Error_Number_Format_Error", WebControlTextDistil.Instance().Distil(this._label));
                }
                else
                {
                    //使用DIV弹出,拼写标签,added by Gawain@20130905
                    this._checkMessage += string.Format("<a href=\\'\\' onclick=\"return SetFocus(\\'#{1}\\');\" > {0}</a> $Error_Number_Format_Error", WebControlTextDistil.Instance().Distil(this._label), this._ctrl.ID);
                }
                return(false);
            }
            catch (OverflowException)
            {
                if (!WebInfoPublish.isUseDiv)
                {
                    this._checkMessage = string.Format("{0} $Error_Number_Overflow", WebControlTextDistil.Instance().Distil(this._label));
                }
                else
                {
                    //使用DIV弹出,拼写标签,added by Gawain@20130905
                    this._checkMessage += string.Format("<a href=\\'\\' onclick=\"return SetFocus(\\'#{1}\\');\" > {0}</a> $Error_Number_Overflow", WebControlTextDistil.Instance().Distil(this._label), this._label.ID);
                }
                return(false);
            }
            return(true);
        }