internal static string GetValue(int ModuleID, string Identifier, string Name) { Setting s = GetSetting(ModuleID, Identifier, Name); if (s != null) { return(s.Value); } //Check Default Value Engines.UIEngine.AngularBootstrap.AngularView View = AppFactory.GetViews().Where(t => t.Identifier == Identifier).FirstOrDefault(); KeyValuePair <string, string> Default = View.Defaults.Where(d => d.Key == Name).FirstOrDefault(); if (Default.Key != null) { return(Default.Value); } return(null); }
private static void ApplyDefaults(int ModuleID, string Identifier, List <Setting> Defaults, List <Setting> Settings) { if (Defaults == null) { Engines.UIEngine.AngularBootstrap.AngularView View = AppFactory.GetViews().Where(t => t.Identifier == Identifier).FirstOrDefault(); if (View != null && View.Defaults.Count > 0) { Defaults = new List <Setting>(); foreach (string key in View.Defaults.Keys) { Defaults.Add(new Setting(key, View.Defaults[key])); } } } if (Defaults != null && Settings != null) { foreach (Setting d in Defaults) { Setting s = Settings.Where(i => i.Name == d.Name).SingleOrDefault(); if (s == null) { //Do Not Track Changes if explictly asked to do so if (!d.DoNotTrackChanges) { d.IsNew = true; } Settings.Add(d); } } //Apply ModuleID & Identifier Settings.ForEach(s => { s.Identifier = Identifier; s.ModuleID = ModuleID; }); } }