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 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); }