Example #1
0
        public static bool IsLoginNameAvailable(string loginname, int customerID = 0)
        {
            if (customerID > 0)
            {
                // Get the current login name to see if it matches what we passed. If so, it's still valid.
                var currentLoginName = ExigoDAL.GetCustomer(customerID).LoginName;
                if (loginname.Equals(currentLoginName, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(true);
                }
            }

            // Validate the login name
            // cannot use SQL due to delay in update to replicated database
            var apiCustomer = ExigoDAL.WebService().GetCustomers(new GetCustomersRequest()
            {
                LoginName = loginname
            }).Customers.FirstOrDefault();

            return(apiCustomer == null);
        }