Beispiel #1
0
        public List <int> VerifyPoBox()
        {
            var errors = new List <int>();

            if (PoBox == null)
            {
                return(errors);
            }

            PoBox = PoBox.Trim().Replace(HidroConstants.DOUBLE_SPACE, HidroConstants.WHITE_SPACE);
            if (string.IsNullOrEmpty(PoBox) || string.IsNullOrWhiteSpace(PoBox))
            {
                PoBox = null;
                return(errors);
            }

            PoBox = PoBox.ToUpper();

            var lenTest = new Regex(@".{1,40}");

            if (!lenTest.IsMatch(PoBox))
            {
                errors.Add(7);
            }

            var rx = new Regex(@"^[\w\d\s-]*$");

            if (!rx.IsMatch(PoBox))
            {
                errors.Add(8);
            }

            return(errors);
        }
Beispiel #2
0
        public override bool Equals(object obj)
        {
            if (obj is OrganisationAddress)
            {
                obj = Create((OrganisationAddress)obj);
            }

            var address = obj as AddressModel;

            if (address == null)
            {
                return(false);
            }

            if (obj is OrganisationAddress)
            {
            }

            if ((!string.IsNullOrWhiteSpace(Address1) || !string.IsNullOrWhiteSpace(address.Address1)) &&
                Address1?.Trim() != address.Address1?.Trim())
            {
                return(false);
            }

            if ((!string.IsNullOrWhiteSpace(Address2) || !string.IsNullOrWhiteSpace(address.Address2)) &&
                Address2?.Trim() != address.Address2?.Trim())
            {
                return(false);
            }

            if ((!string.IsNullOrWhiteSpace(Address3) || !string.IsNullOrWhiteSpace(address.Address3)) &&
                Address3?.Trim() != address.Address3?.Trim())
            {
                return(false);
            }

            if ((!string.IsNullOrWhiteSpace(City) || !string.IsNullOrWhiteSpace(address.City)) &&
                City?.Trim() != address.City?.Trim())
            {
                return(false);
            }

            if ((!string.IsNullOrWhiteSpace(County) || !string.IsNullOrWhiteSpace(address.County)) &&
                County?.Trim() != address.County?.Trim())
            {
                return(false);
            }

            if ((!string.IsNullOrWhiteSpace(Country) || !string.IsNullOrWhiteSpace(address.Country)) &&
                Country?.Trim() != address.Country?.Trim())
            {
                return(false);
            }

            if ((!string.IsNullOrWhiteSpace(PostCode) || !string.IsNullOrWhiteSpace(address.PostCode)) &&
                PostCode?.Trim() != address.PostCode?.Trim())
            {
                return(false);
            }

            if ((!string.IsNullOrWhiteSpace(PoBox) || !string.IsNullOrWhiteSpace(address.PoBox)) &&
                PoBox?.Trim() != address.PoBox?.Trim())
            {
                return(false);
            }

            return(true);
        }