Exemple #1
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);
                }
            }

            if (this._from.Trim() != string.Empty && this._to.Trim() != string.Empty)
            {
                if (string.Compare(this._from, this._to, true) > 0)
                {
                    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);
        }
Exemple #2
0
        public bool Check()
        {
            if (this._checkNull)
            {
                if (!NullCheck.Instance().Check(this._label, this._date))
                {
                    this._checkMessage = string.Format("{0} $Error_Date_Empty", WebControlTextDistil.Instance().Distil(this._label));
                    return(false);
                }
            }

            try
            {
                if (this._date.Trim().Length > 0)
                {
                    DateTime temp = DateTime.Parse(this._date);
                }
            }
            catch
            {
                this._checkMessage = string.Format("{0} $Error_Format", WebControlTextDistil.Instance().Distil(this._label));
                return(false);
            }

            return(true);
        }
Exemple #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);
                }
            }
            if (WebControlTextDistil.Instance().Distil(this._ctrl).Length != this._maxLength)
            {
                if (!WebInfoPublish.isUseDiv)
                {
                    this._checkMessage += string.Format("{0} $Error_Text_NotRight", 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_NotRight", WebControlTextDistil.Instance().Distil(this._label), this._ctrl.ID);
                }
                return(false);
            }
            return(true);
        }
Exemple #4
0
 public static WebControlTextDistil Instance()
 {
     if (WebControlTextDistil.s_distil == null)
     {
         WebControlTextDistil.s_distil = new WebControlTextDistil();
     }
     return(WebControlTextDistil.s_distil);
 }
Exemple #5
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);
                }
            }

            if (this._from.Trim() != string.Empty && this._to.Trim() != string.Empty)
            {
                double range = System.DateTime.Parse(this._to).Subtract(System.DateTime.Parse(this._from)).TotalDays;

                if (range < this._minDateRange)
                {
                    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);
                }
                if (range > this._maxDateRange)
                {
                    if (this._fromlabel == this._tolabel)
                    {
                        this._checkMessage = string.Format("{0} $Error_From_Greater_Than_To {1}", WebControlTextDistil.Instance().Distil(this._fromlabel), this._maxDateRange.ToString());
                    }
                    else
                    {
                        this._checkMessage = string.Format("$Error_Greater_Than_Today1 {0} $Error_Greater_Than_Today2", this._maxDateRange.ToString());
                    }
                    return(false);
                }
            }

            return(true);
        }
Exemple #6
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);
        }
Exemple #7
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);
        }
Exemple #8
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);
        }
Exemple #9
0
 public bool Check(WebControl label, WebControl ctrl)
 {
     return(Check(label, WebControlTextDistil.Instance().Distil(ctrl)));
 }