Example #1
0
 /// <summary>
 /// Validates the condition
 /// </summary>
 protected override void ValidateCondition()
 {
     if (
         (Value == null) ||
         !(Value is DateTime) ||
         (string.IsNullOrEmpty(ParameterName.Trim())) ||
         !(ParameterName.Contains("@"))
         )
     {
         throw new InvalidInputException();
     }
 }
Example #2
0
        /// <summary>
        /// Validates the condition
        /// </summary>
        protected override void ValidateCondition()
        {
            if (
                (Value == null) ||
                (string.IsNullOrEmpty(Value.ToString().Trim())) ||
                !(Sql.Contains("=")) ||
                (string.IsNullOrEmpty(ParameterName.Trim())) ||
                !(ParameterName.Contains("@"))
                )
            {
                throw new InvalidInputException();
            }

            if (Value.ToString() == "1")
            {
                Value = "true";
            }
            else if (Value.ToString() == "0")
            {
                Value = "false";
            }

            bool result  = false;
            bool success = bool.TryParse(Value.ToString(), out result);

            if (!success)
            {
                throw new InvalidInputException();
            }
            else
            {
                if (result)
                {
                    Value = 1;
                }
                else
                {
                    Value = 0;
                }
            }

            //Int16 result = -999;

            //bool success = Int16.TryParse(Value.ToString(), out result);

            //if (!success || !(result == 1 || result == 0 || result == -1))
            //{
            //    throw new InvalidInputException();
            //}
        }
        /// <summary>
        /// Validates the condition
        /// </summary>
        protected override void ValidateCondition()
        {
            if (
                (Value == null) ||
                (string.IsNullOrEmpty(Value.ToString().Trim())) ||
                !(Sql.Contains("=")) ||
                (string.IsNullOrEmpty(ParameterName.Trim())) ||
                !(ParameterName.Contains("@"))
                )
            {
                throw new InvalidInputException();
            }

            bool result  = false;
            bool success = bool.TryParse(Value.ToString(), out result);

            if (!success)
            {
                throw new InvalidInputException();
            }
        }