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); 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); ConnectionString = settings.GetValue(ConnectionStringSettingName); ActiveEmployeeLibrary = settings.GetValue(ActiveEmployeeLibraryName); InactiveEmployeeLibrary = settings.GetValue(InactiveEmployeeLibraryName); 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); LastUpdated = settings.GetDateValue(Config.LastUpdatedName); LastUpdated = (LastUpdated == DateTime.MinValue) ? DateTime.Now.Subtract(TimeSpan.FromDays(1095)) : LastUpdated; SourceSystem = settings.GetExternalSystem(Config.SourceSystemName); 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 TaskProfile(Task task, string configPrefix = null) { Task = task; task.Profile = this; _serviceProfile = task.ServiceProfile; StopTaskTimeout = TimeSpan.FromSeconds(45); Schedule = new Scheduler(); ConfigPrefix = configPrefix ?? task.Name; var settings = new TaskSettings(task); var value = settings.GetValue(Config.Repeat); Schedule.Repeat = bool.Parse(value); value = settings.GetValue(Config.RepeatInterval); var interval = int.Parse(value); Schedule.RepeatInterval = TimeSpan.FromMinutes(interval); }
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); }
public override Result <Task.Config> Load() { var result = base.Load(); var settings = new TaskSettings(Task); EventCode = settings.GetIntValue(Config.EventCodeName); SysId = settings.GetIntValue(Config.SysIdName); DataSource = settings.GetValue(Config.DataSourceName); result.Entity = this; return(result); }
public EntityFilters <T> Load(TaskSettings settings) { var className = Mapper.TargetType.Name; foreach (var key in Mapper.PropertyGetters.Keys) { var name = FilterName(key, className); var filter = settings.GetValue(name); if (filter == null) { continue; } Filters.Add(key, filter); } return(this); }
public override Result <Task.Config> Load() { var result = base.Load(); var settings = new TaskSettings(Task); //Get field filters, if they exist var all = new string[] { }; EmployeeMapper = new ModelMapper <R1Employee>(all); EmployeeFilters = new EntityFilters <R1Employee>(EmployeeMapper).Load(settings); PersonMapper = new ModelMapper <Person>(all); PersonFilters = new EntityFilters <Person>(PersonMapper).Load(settings); ConnectionString = settings.GetValue(ConnectionStringSettingName); result.Entity = this; return(result); }