Beispiel #1
0
 public IResult Validate(string input)
 {
     if (!string.IsNullOrEmpty(input))
     {
         return(ResultFactory.GetSuccessResultInstance());
     }
     else
     {
         return(ResultFactory.GetFailResultInstance("Delivery type can't be blank"));
     }
 }
 public IResult Validate(string input)
 {
     if (input.Length == 5 && Regex.Match(input, pattern).Success)
     {
         return(ResultFactory.GetSuccessResultInstance());
     }
     else
     {
         return(ResultFactory.GetFailResultInstance("Postcode must be 5 digit only."));
     }
 }
Beispiel #3
0
        public IResult Validate(AddressInfo input)
        {
            if (String.IsNullOrEmpty(input.Name) ||
                String.IsNullOrEmpty(input.Street) ||
                String.IsNullOrEmpty(input.City) ||
                String.IsNullOrEmpty(input.State) ||
                String.IsNullOrEmpty(input.PostalCode))
            {
                return(ResultFactory.GetFailResultInstance("One of the address field is not being fill up."));
            }

            return(ResultFactory.GetSuccessResultInstance());
        }
        public IResult Validate(PackageInfo input)
        {
            if (input.PackageType == PackageTypeEnum.Box && input.Weight > 0)
            {
                if ((input.BoxInfo.Height <= 0) &&
                    (input.BoxInfo.Width <= 0) &&
                    (input.BoxInfo.Depth <= 0))
                {
                    return(ResultFactory.GetFailResultInstance("All dimension of boxes must be greater than 0"));
                }
            }


            if (input.Weight <= 0)
            {
                return(ResultFactory.GetFailResultInstance("Please weight your package"));
            }

            return(ResultFactory.GetSuccessResultInstance());
        }