예제 #1
0
 public IUnitOfData FetchUnitofData(string name, bool isNew = false)
 {
     //string _regName = DBString.CreateRegName(fControlUnitID, products);
     if (isNew)
     {
         PageFlyweight.PageItems[name] = null;
     }
     if (PageFlyweight.PageItems[name] == null)
     {
         string connStr = DBString.GetAtawDatabaseValue(name);
         var    res     = new AtawDbContext(connStr);
         PageFlyweight.PageItems[name] = res;
         return(res);
     }
     else
     {
         return((IUnitOfData)PageFlyweight.PageItems[name]);
     }
 }
예제 #2
0
        public IUnitOfData FetchUnitofData(string fControlUnitID, string products, bool isNew = false)
        {
            string _regName = DBString.CreateRegName(fControlUnitID, products);

            if (isNew)
            {
                PageFlyweight.PageItems[_regName] = null;
            }
            if (PageFlyweight.PageItems[_regName] == null)
            {
                string connStr = DBString.GetAtawControlUnitsProductValue(fControlUnitID, products.Value <ProductsType>(), "DB");
                var    res     = new AtawDbContext(connStr);
                PageFlyweight.PageItems[_regName] = res;
                return(res);
            }
            else
            {
                return((IUnitOfData)PageFlyweight.PageItems[_regName]);
            }
        }