public override Result <Task.Config> Load() { var result = base.Load(); var settings = new TaskSettings(Task); Link = settings.GetValue(Config.LinkName); Username = settings.GetValue(Config.UserName); Password = settings.GetValue(Config.PasswordName); SourceSystem = settings.GetExternalSystem(Config.SourceSystemName); ExportPerson = settings.GetBoolValue(Config.ExportPersonName); ExportAccessEvents = settings.GetBoolValue(Config.ExportAccessEventsName); ExportCompany = settings.GetBoolValue(Config.ExportCompanyName); var from = settings.GetValue(Config.LastEventName); if (from == null) { return(result.Fail(Task.LogError("last event setting {0} not found.", Config.LastEventName))); } DateTime date; LastEvent = ((from.Trim().Length == 0) || !DateTime.TryParse(from, out date)) ? DateTime.Now.Subtract(TimeSpan.FromDays(30)) : date; result.Entity = this; return(result); }
public override Result <Task.Config> Load() { var result = base.Load(); var settings = new TaskSettings(Task); Link = settings.GetValue(Config.LinkName); Username = settings.GetValue(Config.UserName); Password = settings.GetValue(Config.PasswordName); ImportPerson = settings.GetBoolValue(Config.ImportPersonName); var from = settings.GetValue(Config.LastEventName); if (from == null) { return(result.Fail(Task.LogError("{0} setting does not exist.", Config.LastEventName))); } DateTime date; LastEvent = ((from.Trim().Length == 0) || !DateTime.TryParse(from, out date)) ? DateTime.Now.Subtract(TimeSpan.FromDays(30)) : date; result.Entity = this; return(result); }
public override Result <Task.Config> Load() { var result = base.Load(); var settings = new TaskSettings(Task); Link = settings.GetValue(Config.LinkName); Username = settings.GetValue(Config.UserName); Password = settings.GetValue(Config.PasswordName); ImportImage = settings.GetBoolValue(Config.ImageImportName); LastUpdated = settings.GetDateValue(Config.LastUpdatedName); LastUpdated = (LastUpdated == DateTime.MinValue) ? DateTime.Now.Subtract(TimeSpan.FromDays(1095)) : LastUpdated; var fields = settings.GetValue(Config.FieldsToUpdateName); FieldsToUpdate = (fields != null) ? fields.Split(',') : new string[] { }; //Get field filters, if they exist PersonMapper = new ModelMapper <Person>(FieldsToUpdate); PersonFilters = new EntityFilters <Person>(PersonMapper).Load(settings); result.Entity = this; return(result); }
public override Result <Task.Config> Load() { var result = base.Load(); var settings = new TaskSettings(Task); Link = settings.GetValue(Config.LinkName); Username = settings.GetValue(Config.UserName); Password = settings.GetValue(Config.PasswordName); var systemId = settings.GetIntValue(Config.SourceSystemName); var criteria = new ExternalSystem { Id = systemId }; var system = criteria.Get(); if (system.Failed) { return(result.Fail(Task.LogError("source system id {0} not found.", systemId.ToString()))); } SourceSystem = system.Entity; ExportPerson = settings.GetBoolValue(Config.ExportPersonName); ExportAccessEvents = settings.GetBoolValue(Config.ExportAccessEventsName); ExportCompany = settings.GetBoolValue(Config.ExportCompanyName); var companies = settings.GetValue(Config.ExportCompaniesName); ExportCompanies = !string.IsNullOrWhiteSpace(companies) ? companies.Split(',') : new string[0]; var from = settings.GetValue(Config.LastEventName); if (from == null) { return(result.Fail(Task.LogError("last event setting {0} not found.", Config.LastEventName))); } DateTime date; LastEvent = ((from.Trim().Length == 0) || !DateTime.TryParse(from, out date)) ? DateTime.Now.Subtract(TimeSpan.FromDays(30)) : date; result.Entity = this; return(result); }
public override Result <Task.Config> Load() { var result = base.Load(); var settings = new TaskSettings(Task); Link = settings.GetValue(Config.LinkName); Username = settings.GetValue(Config.UserName); Password = settings.GetValue(Config.PasswordName); ImportPerson = settings.GetBoolValue(Config.ImportPersonName); IncludeContractors = settings.GetBoolValue(Config.ImportCompaniesChoiceName); if (IncludeContractors) { var companies = settings.GetValue(Config.ImportCompaniesName); ImportCompanies = !string.IsNullOrWhiteSpace(companies) ? companies.Split(',') : new string[0]; } else { ImportCompanies = new string[0]; } var from = settings.GetValue(Config.LastEventName); if (from == null) { return(result.Fail(Task.LogError("{0} setting does not exist.", Config.LastEventName))); } DateTime date; LastEvent = ((from.Trim().Length == 0) || !DateTime.TryParse(from, out date)) ? DateTime.Now.Subtract(TimeSpan.FromDays(30)) : date; result.Entity = this; return(result); }