Example #1
0
        public static bool IsWebAliasAvailable(int customerID, string webalias)
        {
            try
            {
                // Get the current webalias to see if it matches what we passed. If so, it's still valid.
                var currentWebAlias = ExigoDAL.GetCustomerSite(customerID).WebAlias;
                if (webalias.Equals(currentWebAlias, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(true);
                }

                // Validate the web alias
                // cannot use SQL due to delay in update to replicated database
                var customerSite = ExigoDAL.WebService().GetCustomerSite(new GetCustomerSiteRequest()
                {
                    WebAlias = webalias
                });

                return(customerSite == null);
            }
            catch (Exception ex)
            {
                // the GetCustomerSite throws an exception if no matching web alias is found
                // return the web alias is available in this case so return true
                Log.Error(ex, "Error Getting Replicated Site: {Message}", ex.Message);
                return(true);
            }
        }