public List <CorePlatformSettings.CustomDomain> GetCustomDomains()
        {
            var customDomains = new List <CorePlatformSettings.CustomDomain>();

            //Get all accounts
            var accounts = AccountManager.GetAllAccountsByFilter("Active", "1", 0, 5000, "AccountNameKey");

            //Get settings for each account
            foreach (var account in accounts)
            {
                if (account.Provisioned)
                {
                    try
                    {
                        var settings = AccountSettingsManager.GetAccountSettings(account);

                        if (settings.CustomDomain != null)
                        {
                            if (settings.CustomDomain != "")
                            {
                                customDomains.Add(new CorePlatformSettings.CustomDomain {
                                    AccountNameKey = account.AccountNameKey, Domain = settings.CustomDomain
                                });
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }

            return(customDomains);
        }
예제 #2
0
 public GroupService(INotices notice)
 {
     _notice = notice;
     _accountSettingsManager = new AccountSettingsManager();
     _seleniumManager        = new SeleniumManager();
     _settingsManager        = new SettingsManager();
     _accountManager         = new AccountManager();
 }
예제 #3
0
        /// <summary>
        /// Create a new label for managing sales leads. (limit 15)
        /// </summary>
        /// <param name="account"></param>
        /// <param name="labelName"></param>
        /// <returns></returns>
        public static DataAccessResponseType CreateLabel(Account account, string labelName)
        {
            #region Validate Sales Lead Label Requirements

            if (labelName.Length > 15)
            {
                //Table names cannot exceed 63 characters.
                //+ 3 for "acc"
                //+ 32 for [accountID]
                //+ 5 for "leads"
                //23 remaining (we do 15 for readability & safety)
                return(new DataAccessResponseType {
                    isSuccess = false, ErrorMessage = "Labels cannot be longer than 15 characters"
                });
            }
            if (labelName.Contains("  "))
            {
                return(new DataAccessResponseType {
                    isSuccess = false, ErrorMessage = "Labels cannot contain any double spaces"
                });
            }

            if (Regex.IsMatch(labelName.Replace("-", "").Replace(" ", ""), "^[a-zA-Z0-9]*$") == false)
            {
                return(new DataAccessResponseType {
                    isSuccess = false, ErrorMessage = "Labels cannot contain any special characters"
                });
            }

            #endregion

            var accountSettings = AccountSettingsManager.GetAccountSettings(account);

            if (accountSettings.SalesSettings.LeadLabels.Count >= 15)
            {
                return(new DataAccessResponseType {
                    isSuccess = false, ErrorMessage = "You cannot have more than 15 labels for sales leads"
                });
            }

            #region validate name does not already exist

            foreach (string existingLabel in accountSettings.SalesSettings.LeadLabels)
            {
                if (existingLabel.ToLower().Replace("-", "").Replace(" ", "") == labelName.ToLower().Replace("-", "").Replace(" ", ""))
                {
                    return(new DataAccessResponseType {
                        isSuccess = false, ErrorMessage = "This label already exists, or is a reserved label name"
                    });
                }
            }

            #endregion

            accountSettings.SalesSettings.LeadLabels.Add(labelName);

            return(AccountSettingsManager.UpdateAccountSettings(account, accountSettings));
        }
예제 #4
0
    // --------
    static AccountSettingsManager GetInstance()
    {
        if (s_Instance == null)
        {
            s_Instance = ScriptableObject.CreateInstance <AccountSettingsManager>();
            s_Instance.Init("_Settings/_AccountSettings");
            ScriptableObject.DontDestroyOnLoad(s_Instance);
        }

        return(s_Instance);
    }
        public async Task <bool> DeleteAccountAsync([FromBody] DeleteModel deleteModel)
        {
            IDataGateway                   dataGateway                   = new SQLServerGateway();
            IConnectionStringData          connectionString              = new ConnectionStringData();
            IUserAccountRepository         userAccountRepository         = new UserAccountRepository(dataGateway, connectionString);
            IUserAccountSettingsRepository userAccountSettingsRepository = new UserAccountSettingRepository(dataGateway, connectionString);
            ICryptographyService           cryptographyService           = new CryptographyService(userAccountRepository);
            IAuthenticationService         authenticationService         = new AuthenticationService(userAccountRepository);
            IAccountSettingsManager        userAccountSettingsManager    = new AccountSettingsManager(userAccountRepository, userAccountSettingsRepository, cryptographyService, authenticationService);

            bool result = await userAccountSettingsManager.DeleteAccountByUserIDAsync(deleteModel.id, deleteModel.password);

            Console.WriteLine("Account Deleted");
            return(result);
        }
        public async Task <bool> ChangeEmailAsync([FromBody] EmailModel email)
        {
            IDataGateway                   dataGateway                   = new SQLServerGateway();
            IConnectionStringData          connectionString              = new ConnectionStringData();
            IUserAccountRepository         userAccountRepository         = new UserAccountRepository(dataGateway, connectionString);
            IUserAccountSettingsRepository userAccountSettingsRepository = new UserAccountSettingRepository(dataGateway, connectionString);
            ICryptographyService           cryptographyService           = new CryptographyService(userAccountRepository);
            IAuthenticationService         authenticationService         = new AuthenticationService(userAccountRepository);
            IAccountSettingsManager        userAccountSettingsManager    = new AccountSettingsManager(userAccountRepository, userAccountSettingsRepository, cryptographyService, authenticationService);

            bool result = await userAccountSettingsManager.ChangeEmailAsync(email.password, email.email, email.id);

            Console.WriteLine("Email Changed");
            return(true);
        }
        public async Task <bool> ChangeFontSizeAsync([FromBody] FontSizeModel fontSize)
        {
            IDataGateway                   dataGateway                   = new SQLServerGateway();
            IConnectionStringData          connectionString              = new ConnectionStringData();
            IUserAccountRepository         userAccountRepository         = new UserAccountRepository(dataGateway, connectionString);
            IUserAccountSettingsRepository userAccountSettingsRepository = new UserAccountSettingRepository(dataGateway, connectionString);
            ICryptographyService           cryptographyService           = new CryptographyService(userAccountRepository);
            IAuthenticationService         authenticationService         = new AuthenticationService(userAccountRepository);
            IAccountSettingsManager        userAccountSettingsManager    = new AccountSettingsManager(userAccountRepository, userAccountSettingsRepository, cryptographyService, authenticationService);

            bool result = await userAccountSettingsManager.ChangeFontSizeAsync(fontSize.id, Int32.Parse(fontSize.fontSize));

            Console.WriteLine("Font Size Changed");
            return(true);
        }
        public async Task <bool> PasswordChangeAsync([FromBody] PasswordModel passwordModel)
        {
            IDataGateway                   dataGateway                   = new SQLServerGateway();
            IConnectionStringData          connectionString              = new ConnectionStringData();
            IUserAccountRepository         userAccountRepository         = new UserAccountRepository(dataGateway, connectionString);
            IUserAccountSettingsRepository userAccountSettingsRepository = new UserAccountSettingRepository(dataGateway, connectionString);
            ICryptographyService           cryptographyService           = new CryptographyService(userAccountRepository);
            IAuthenticationService         authenticationService         = new AuthenticationService(userAccountRepository);
            IAccountSettingsManager        userAccountSettingsManager    = new AccountSettingsManager(userAccountRepository, userAccountSettingsRepository, cryptographyService, authenticationService);

            bool result = await userAccountSettingsManager.ChangePasswordAsync(passwordModel.oldPassword, passwordModel.newPassword, passwordModel.id);

            Console.WriteLine("Password Changed");
            return(result);
        }
        public async Task <bool> ChangeThemeAsync([FromBody] ThemeModel theme)
        {
            Console.WriteLine("Font Style Changed");

            IDataGateway                   dataGateway                   = new SQLServerGateway();
            IConnectionStringData          connectionString              = new ConnectionStringData();
            IUserAccountRepository         userAccountRepository         = new UserAccountRepository(dataGateway, connectionString);
            IUserAccountSettingsRepository userAccountSettingsRepository = new UserAccountSettingRepository(dataGateway, connectionString);
            ICryptographyService           cryptographyService           = new CryptographyService(userAccountRepository);
            IAuthenticationService         authenticationService         = new AuthenticationService(userAccountRepository);
            IAccountSettingsManager        userAccountSettingsManager    = new AccountSettingsManager(userAccountRepository, userAccountSettingsRepository, cryptographyService, authenticationService);

            bool result = await userAccountSettingsManager.ChangeThemeColorAsync(theme.id, theme.theme);

            return(true);
        }
예제 #10
0
        public static DataAccessResponseType RemoveLabel(Account account, string labelName)
        {
            var accountSettings = AccountSettingsManager.GetAccountSettings(account);

            #region validate

            if (labelName.ToLower() == "new" || labelName.ToLower() == "deleted")
            {
                return(new DataAccessResponseType {
                    isSuccess = false, ErrorMessage = "Cannot delete a reserved label"
                });
            }

            #endregion

            bool labelFound = false;

            foreach (string existingLabel in accountSettings.SalesSettings.LeadLabels)
            {
                if (existingLabel.ToLower() == labelName.ToLower())
                {
                    labelFound = true;
                }
            }

            if (labelFound)
            {
                accountSettings.SalesSettings.LeadLabels.RemoveAt(accountSettings.SalesSettings.LeadLabels.IndexOf(labelName));
                return(AccountSettingsManager.UpdateAccountSettings(account, accountSettings));
            }
            else
            {
                return(new DataAccessResponseType {
                    isSuccess = false, ErrorMessage = "Could not find label to remove"
                });
            }
        }