/// <summary> /// Handels the initialization of the Field setups, creating a list of cruise methods and /// </summary> public void HandleFieldSetupLoad() { var allTreeFields = TreeFields; //check to see if Cruise method list has been initialized if (CruiseMethods == null) { try { var methods = Database.From <EditTemplateCruiseMethod>().Read().ToList(); foreach (var method in methods) { var treeFields = Database.From <TreeFieldSetupDefaultDO>() .Where("Method = @p1").OrderBy("FieldOrder").Read(method.Code).ToList(); method.TreeFields = new BindingList <TreeFieldSetupDefaultDO>(treeFields); var unselectedTreeFields = allTreeFields.Except(treeFields, TreeFieldDefaultComparer.Instance) .Select(tfs => new TreeFieldSetupDefaultDO(tfs) { Method = method.Code }) .ToList(); method.UnselectedTreeFields = new BindingList <TreeFieldSetupDefaultDO>(unselectedTreeFields); } CruiseMethods = new BindingList <EditTemplateCruiseMethod>(methods); } catch { } } if (SelectedLogFields == null) { try { var logFields = Database.From <LogFieldSetupDefaultDO>() .OrderBy("FieldOrder").Read().ToList(); SelectedLogFields = new BindingList <LogFieldSetupDefaultDO>(logFields); var unselectedLogFields = LogFields.Except(logFields, LogFieldDefaultComparer.Instance) .Select(lfs => new LogFieldSetupDefaultDO(lfs)).ToList(); UnselectedLogFields = new BindingList <LogFieldSetupDefaultDO>(unselectedLogFields); } catch { SelectedLogFields = null; } View.UpdateFieldSetup(); } }