コード例 #1
0
 public void Merge(DataValidateResult result)
 {
     foreach (ValidationItem item in result.Items)
     {
         Items.Add(item);
     }
 }
コード例 #2
0
        public DataValidateResult Validate(string value)
        {
            DataValidateResult result = new DataValidateResult();

            if (value == null || value.Trim().Length == 0)
            {
                result.AddItem(Message);
            }

            return(result);
        }
コード例 #3
0
        public DataValidateResult Validate(string value)
        {
            DataValidateResult result = new DataValidateResult();

            if (value != null && value.Trim().Length > 0)
            {
                try
                {
                    decimal v = Convert.ToDecimal(value);
                }
                catch
                {
                    result.AddItem(Message);
                }
            }

            return(result);
        }
コード例 #4
0
        public DataValidateResult Validate(string value)
        {
            DataValidateResult result = new DataValidateResult();

            string message = string.Empty;

            if (value == null || value.Trim().Length < Length)
            {
                message = string.Format("Length < {0}", Length);
            }
            else if (value.Trim().Length > Length)
            {
                message = string.Format("Length > {0}", Length);
            }

            if (message.Length > 0)
            {
                result.AddItem(message);
            }

            return(result);
        }
コード例 #5
0
        public DataValidateResult Validate(string value)
        {
            DataValidateResult result = new DataValidateResult();

            if (value != null && value.ToString().Trim().Length > 0)
            {
                try
                {
                    Char c = Convert.ToChar(value);
                    if (!CharSet.Contains(c))
                    {
                        result.AddItem(Message);
                    }
                }
                catch
                {
                    result.AddItem(Message);
                }
            }

            return(result);
        }