public void SetAccountSettings(GCAccountSettings accountSettings) { var settings = new UmbAccountSettings() { //AccountItemId = accountSettings.AccountItemId, ApiKey = accountSettings.ApiKey, //ApiUrl = Constants.ApiUrl, ApiUserName = accountSettings.Username, DateFormat = accountSettings.DateFormat, GatherContentUrl = accountSettings.GatherContentUrl }; var query = new Sql().Select("*").From <UmbAccountSettings>(); var accountSettingU = this.ContextDatabase.Database.Fetch <UmbAccountSettings>(query).FirstOrDefault(); if (accountSettingU != null) { settings.Id = accountSettingU.Id; ContextDatabase.Database.Update("gcAccountSettings", "Id", settings); } else { ContextDatabase.Database.Save("gcAccountSettings", "Id", settings); } }
/// <summary> /// /// </summary> /// <param name="itemsRepository"></param> /// <param name="mappingRepository"></param> /// <param name="itemsService"></param> /// <param name="mappingManager"></param> /// <param name="importManager"></param> /// <param name="accountsService"></param> /// <param name="projectsService"></param> /// <param name="templateService"></param> /// <param name="cacheManager"></param> /// <param name="gcAccountSettings"></param> public UpdateManager( IItemsRepository itemsRepository, IMappingRepository mappingRepository, IItemsService itemsService, IMappingManager mappingManager, IImportManager importManager, IAccountsService accountsService, IProjectsService projectsService, ITemplatesService templateService, ICacheManager cacheManager, GCAccountSettings gcAccountSettings) : base(accountsService, projectsService, templateService, cacheManager) { ItemsRepository = itemsRepository; MappingRepository = mappingRepository; ItemsService = itemsService; MappingManager = mappingManager; ImportManager = importManager; GcAccountSettings = gcAccountSettings; }
public GCAccountSettings GetAccountSettings() { var query = new Sql().Select("*").From <UmbAccountSettings>(); var accountSettingU = this.ContextDatabase.Database.Fetch <UmbAccountSettings>(query).FirstOrDefault(); var gcAccountSettings = new GCAccountSettings(); if (accountSettingU != null) { var tenantName = string.Empty; var tenantMatch = System.Text.RegularExpressions.Regex.Match(accountSettingU.GatherContentUrl, @"^(http(s)?:\/\/)?(?<tenant>.*)\.gathercontent\.com(\/)?$"); if (tenantMatch.Groups["tenant"] != null) { tenantName = tenantMatch.Groups["tenant"].Value.ToLower(); } gcAccountSettings.ApiKey = accountSettingU.ApiKey; gcAccountSettings.ApiUrl = Constants.ApiUrl; gcAccountSettings.DateFormat = accountSettingU.DateFormat; gcAccountSettings.ImportDateFormat = accountSettingU.ImportDateFormat; gcAccountSettings.GatherContentUrl = accountSettingU.GatherContentUrl; gcAccountSettings.Username = accountSettingU.ApiUserName; gcAccountSettings.TenantName = tenantName; } gcAccountSettings.CmsVersion = UmbracoVersion.Current.ToString(); return(gcAccountSettings); }
public TestConnectionManager( IAccountsService accountsService, IProjectsService projectsService, ITemplatesService templateService, ICacheManager cacheManager, GCAccountSettings gcAccountSettings) : base(accountsService, projectsService, templateService, cacheManager, gcAccountSettings) { }
protected BaseService(GCAccountSettings accountSettings) { _apiUrl = accountSettings.ApiUrl; _apiKey = accountSettings.ApiKey; _userName = accountSettings.Username; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; }
/// <summary> /// /// </summary> /// <param name="accountsService"></param> /// <param name="projectsService"></param> /// <param name="templateService"></param> /// <param name="cacheManager"></param> public BaseManager(IAccountsService accountsService, IProjectsService projectsService, ITemplatesService templateService, ICacheManager cacheManager, GCAccountSettings gcAccountSettings) { AccountsService = accountsService; ProjectsService = projectsService; TemplatesService = templateService; GcAccountSettings = gcAccountSettings; CacheManager = cacheManager; }
public MappingManager( IMappingRepository mappingRepository, IAccountsService accountsService, IProjectsService projectsService, ITemplatesService templateService, IItemsService itemService, ICacheManager cacheManager, GCAccountSettings accountSettings) : base(accountsService, projectsService, templateService, cacheManager) { AccountSettings = accountSettings; MappingRepository = mappingRepository; ItemService = itemService; TemplateService = templateService; }
public ImportManager( IItemsRepository itemsRepository, IMappingRepository mappingRepository, IItemsService itemsService, IAccountsService accountsService, IProjectsService projectsService, ITemplatesService templateService, ICacheManager cacheManager, GCAccountSettings gcAccountSettings) : base(accountsService, projectsService, templateService, cacheManager, gcAccountSettings) { ItemsRepository = itemsRepository; MappingRepository = mappingRepository; ItemsService = itemsService; }
public MappingManager( IMappingRepository mappingRepository, IAccountsService accountsService, IProjectsService projectsService, ITemplatesService templateService, IItemsService itemService, ICacheManager cacheManager, ILogger logger, GCAccountSettings accountSettings) : base(accountsService, projectsService, templateService, cacheManager, accountSettings) { MappingRepository = mappingRepository; ItemService = itemService; Log = logger ?? new NullLogger(); TemplateService = templateService; }
/// <summary> /// /// </summary> /// <param name="itemsRepository"></param> /// <param name="mappingRepository"></param> /// <param name="itemsService"></param> /// <param name="accountsService"></param> /// <param name="projectsService"></param> /// <param name="templateService"></param> /// <param name="cacheManager"></param> /// <param name="logger"></param> /// <param name="gcAccountSettings"></param> public UpdateManager( IItemsRepository itemsRepository, IMappingRepository mappingRepository, IItemsService itemsService, IAccountsService accountsService, IProjectsService projectsService, ITemplatesService templateService, ICacheManager cacheManager, ILogger logger, GCAccountSettings gcAccountSettings) : base(accountsService, projectsService, templateService, cacheManager, gcAccountSettings) { ItemsRepository = itemsRepository; MappingRepository = mappingRepository; ItemsService = itemsService; Log = logger ?? new NullLogger(); }
public void Post(GCAccountSettings model) { if (model == null) { throw new Exception("Gather Content settings is null"); } try { _accountSettingManager.SetSettings(model); } catch (WebException exception) { LogHelper.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, exception.Message, exception); throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, exception.Message + " Please check your credentials")); } catch (Exception exception) { LogHelper.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, exception.Message, exception); throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, exception.Message)); } }
public IHttpActionResult Post(GCAccountSettings model) { if (model == null) { BadRequest("Gather Content settings is null"); } try { FactoryService.Managers.AccountSettingManager.SetSettings(model); return(Ok()); } catch (WebException exception) { LogHelper.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, exception.Message, exception); return(BadRequest(exception.Message + " Please check your credentials")); } catch (Exception exception) { LogHelper.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, exception.Message, exception); return(BadRequest(exception.Message)); } }
/// <summary> /// /// </summary> /// <param name="accountSettings"></param> public ProjectsService(GCAccountSettings accountSettings) : base(accountSettings) { }
public void SetSettings(GCAccountSettings accountSettings) { FactoryRepository.Repositories.AccountRepository.SetAccountSettings(accountSettings); }
protected BaseService(GCAccountSettings accountSettings) { _apiUrl = accountSettings.ApiUrl; _apiKey = accountSettings.ApiKey; _userName = accountSettings.Username; }
public DropTreeManager(IDropTreeRepository dropTreeRepository, IAccountsRepository accountsRepository, GCAccountSettings gcAccountSettings) { AccountsRepository = accountsRepository; GcAccountSettings = gcAccountSettings; DropTreeRepository = dropTreeRepository; }
/// <summary> /// /// </summary> /// <param name="accountSettings"></param> public ItemsService(GCAccountSettings accountSettings) : base(accountSettings) { }
public TemplatesService(GCAccountSettings accountSettings) : base(accountSettings) { }
public void SetSettings(GCAccountSettings accountSettings) { _accountsRepository.SetAccountSettings(accountSettings); }