コード例 #1
0
 public static SingletonPriority1 SetInstance()
 {
     // Uses lazy initialization.
     // Note: this is not thread safe.
     _instance = null;
     return(_instance);
 }
コード例 #2
0
        //public List<Shelf> Shelfs { get; set; }

        public static SingletonPriority1 Instance()
        {
            // Uses lazy initialization.
            // Note: this is not thread safe.
            if (_instance == null)
            {
                using (SSLsEntities db = new SSLsEntities())
                {
                    _instance = new SingletonPriority1();
                    //var data = db.ProductDetails
                    //        .Include("Products")
                    //    .Include("Products.Supplier")
                    //        .Include("Products.ProductBrands")
                    //    .Include("Products.ProductVatType")
                    //    .Include("ProductUnit").ToList();

                    //_instance.Branchs = db.Branch.ToList();

                    _instance.BudgetYears = db.BudgetYear.ToList();
                    //_instance.ThisBudgetYear = budgetYears.FirstOrDefault(w => w.Enable == true && w.IsCurrent == true);

                    _instance.PaymentTypes = db.PaymentType.ToList();

                    _instance.ProductVatType = db.ProductVatType.Where(w => w.Enable == true).ToList();
                    _instance.CostType       = db.CostType.ToList();
                    //_instance.ProductCategory = db.ProductCategory.ToList();
                    //_instance.ProductGroups = db.ProductGroups.ToList();
                    _instance.Supplier = db.Supplier.ToList();
                    //_instance.Vendor = db.Vendor.Include("POCostType").ToList();
                    //_instance.ProductBrands = db.ProductBrands.ToList();
                    _instance.ProductSize   = db.ProductSize.ToList();
                    _instance.ProductColor  = db.ProductColor.ToList();
                    _instance.Zone          = db.Zone.ToList();
                    _instance.DeliveryTypes = db.DeliveryType.Where(w => w.Enable == true).ToList();
                    //_instance.ProductUnit = db.ProductUnit.ToList();
                    _instance.Users = db.Users.ToList();
                    //_instance.Shelfs = db.Shelf.ToList();
                }
            }
            return(_instance);
        }