Beispiel #1
0
        internal bool IsValid(out string validationMessage)
        {
            //validate the url redirect for the ability to be used
            validationMessage = "Invalid Redirect Id [" + RedirectId.ToString() + "] ;";
            int noErrorLength = validationMessage.Length;

            if (string.IsNullOrEmpty(RedirectUrl))
            {
                validationMessage += "Redirect Url Field is null.  Supply a valid Url.  ;";
            }
            if (string.IsNullOrEmpty(MatchType))
            {
                validationMessage += "MatchType field is null.  Use either 'absolute' or 'relative' ;";
            }
            else
            {
                if (MatchType.ToLower() != "absolute" && MatchType.ToLower() != "relative")
                {
                    validationMessage += "MatchType field of '" + MatchType + "' is invalid.  Use either 'absolute' or 'relative' ;";
                }
            }
            if (string.IsNullOrEmpty(DestType))
            {
                validationMessage += "DestType field is null.  Use either 'tab' or 'url' ;";
            }
            else
            {
                if (DestType.ToLower() != "tab" && DestType.ToLower() != "url")
                {
                    validationMessage += "DestType field of '" + DestType + "' is invalid.  Use either 'tab' or 'url' ;";
                }

                if (DestType.ToLower() == "tab" && (DestTabId <= 0 && string.IsNullOrEmpty(DestTabPath)))
                {
                    validationMessage = "Specify either a valid DestTabId value, or a valid DestTabPath ;";
                }

                if (DestType.ToLower() == "url" && string.IsNullOrEmpty(DestUrl))
                {
                    validationMessage += "DestUrl must be specified for DestType of 'url' ;";
                }
            }
            if (validationMessage.Length > noErrorLength)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }