public static SingletonThisBudgetYear SetInstance() { // Uses lazy initialization. // Note: this is not thread safe. _instance = null; return(_instance); }
public static SingletonThisBudgetYear Instance() { // Uses lazy initialization. // Note: this is not thread safe. if (_instance == null) { using (SSLsEntities db = new SSLsEntities()) { _instance = new SingletonThisBudgetYear(); BudgetYear data = db.BudgetYear.FirstOrDefault(w => w.Enable == true && w.IsCurrent == true); _instance.ThisYear = data; } } return(_instance); }
public static SingletonAgeOfShare Instance() { // Uses lazy initialization. // Note: this is not thread safe. if (_instance == null) { using (SSLsEntities db = new SSLsEntities()) { int thisBudget = SingletonThisBudgetYear.Instance().ThisYear.Id; _instance = new SingletonAgeOfShare(); var data = db.AgeOfShare.Where(w => w.Enable == true) .OrderBy(w => w.TermStart).ToList(); _instance.AgeOfShare = data; } } return(_instance); }