public Dictionary <String, List <String> > getAttributeDetails(int subCategoryID) { using (var db = new JooleAppEntities()) { var filterAttributes = db.tblAttributes.Join( db.tblTechSpecFilters, att => att.attributeID, tspc => tspc.attributeID, (att, tspc) => new{ att.attributeID, tspc.subCategoryID, att.attributeName, tspc.maxVal, tspc.minVal, }).Where( ele => ele.subCategoryID == subCategoryID ).ToList(); Dictionary <String, List <String> > attVal = new Dictionary <String, List <String> >(); foreach (var att in filterAttributes) { attVal.Add(att.attributeName, new List <String>() { att.minVal, att.maxVal }); } return(attVal); } }
public Dictionary <string, List <string> > getTechSpecWithRange(int productID) { using (var db = new JooleAppEntities()) { var des = (from p in dbb.tblProducts join pa in dbb.tblProductAttributes on p.productID equals pa.productID join a in dbb.tblAttributes on pa.attributeID equals a.attributeID join t in dbb.tblTechSpecFilters on pa.attributeID equals t.attributeID where (p.productID == productID && a.isTechSpec == true && t.minVal != t.maxVal) select new { p.productID, a.attributeName, t.minVal, t.maxVal } ).Distinct(); Dictionary <string, List <string> > newD = new Dictionary <string, List <string> >(); foreach (var d in des) { List <string> rangeList = new List <string>(); rangeList.Add(d.minVal); rangeList.Add(d.maxVal); if (!newD.ContainsKey(d.attributeName)) { newD.Add(d.attributeName, rangeList); } } return(newD); } }
public static JooleAppEntities getContext() { if (context == null) { context = new JooleAppEntities(); } return(context); }
/*public IEnumerable<tblCategory> GetAll() * { * return entities.AsEnumerable(); * } * * public tblCategory GetById(int Id) * { * return GetAll().Where(model => model.categoryID == Id).SingleOrDefault(); * } * * public void Insert(tblCategory entity) * { * if (entity == null) * { * throw new ArgumentNullException("entity"); * } * entities.Add(entity); * _context.SaveChanges(); * } * * public void Update(tblCategory entity) * { * //entities.AddOrUpdate(entity); * * if (entity == null) * { * throw new ArgumentNullException("entity"); * } * entities.Attach(entity); * _context.Entry(entity).State = EntityState.Modified; * _context.SaveChanges(); * * } * * public void Delete(tblCategory entity) * { * if (entity == null) * { * throw new ArgumentNullException("entity"); * } * entities.Remove(entity); * _context.SaveChanges(); * } * * public void Remove(tblCategory entity) * { * if (entity == null) * { * throw new ArgumentNullException("entity"); * } * entities.Remove(entity); * } * * * public void Save() * { * _context.SaveChanges(); * } */ public IEnumerable <tblSubCategory> GetSubCategories(int CatID) { List <tblSubCategory> subCategories = new List <tblSubCategory>(); using (var context = new JooleAppEntities()) { subCategories = new List <tblSubCategory>().Where(u => u.categoryID == CatID).ToList <tblSubCategory>(); } return(subCategories); }
public IEnumerable <tblUser> GetUsers(int UserID) { List <tblUser> users = new List <tblUser>(); using (var context = new JooleAppEntities()) { users = new List <tblUser>().Where(u => u.userID == UserID).ToList <tblUser>(); } return(users); }
public List <tblProduct> GetAll() { List <tblProduct> prodDet = null; using (var db = new JooleAppEntities()) { prodDet = (from pd in dbb.tblProducts select pd).ToList <tblProduct>(); } return(prodDet); }
public List <tblProduct> getProductDescription(int productID) { List <tblProduct> prodDet = null; using (var db = new JooleAppEntities()) { var productDescription = db.tblProducts.Where(p => p.productID == productID); prodDet = (from pd in dbb.tblProducts where pd.productID == productID select pd).ToList <tblProduct>(); } return(prodDet); }
public Dictionary <int, List <Dictionary <String, String> > > getProductDetails(int subCategoryID) { using (var db = new JooleAppEntities()) { var productDetails = db.tblProducts.Join( db.tblProductAttributes, prod => prod.productID, patt => patt.productID, (prod, patt) => new { prod, patt } ).Join( db.tblAttributes, pattC => pattC.patt.attributeID, att => att.attributeID, (pattC, att) => new { att.attributeName, att.isTechSpec, pattC } ).Where( p => p.pattC.prod.subCategoryID == subCategoryID ); /*Dictionary<int, Dictionary<String, String>> prodAtts = new Dictionary<int, Dictionary<string, string>>();*/ Dictionary <int, List <Dictionary <String, String> > > prodAtts = new Dictionary <int, List <Dictionary <string, string> > >(); /*System.Diagnostics.Debug.WriteLine(productDetails.ToString());*/ foreach (var prod in productDetails.ToList()) { if (prodAtts.ContainsKey(prod.pattC.prod.productID)) { prodAtts[prod.pattC.prod.productID][1].Add(prod.attributeName, prod.pattC.patt.attributeValue); } else { prodAtts[prod.pattC.prod.productID] = new List <Dictionary <string, string> >(); prodAtts[prod.pattC.prod.productID].Add(new Dictionary <string, string>()); prodAtts[prod.pattC.prod.productID].Add(new Dictionary <string, string>()); prodAtts[prod.pattC.prod.productID].Add(new Dictionary <string, string>()); prodAtts[prod.pattC.prod.productID][1].Add(prod.attributeName, prod.pattC.patt.attributeValue); prodAtts[prod.pattC.prod.productID][0].Add("ImagePath", prod.pattC.prod.imagePath); prodAtts[prod.pattC.prod.productID][0].Add("ModelName", prod.pattC.prod.modelName); prodAtts[prod.pattC.prod.productID][0].Add("ModelYear", prod.pattC.prod.modelYear); prodAtts[prod.pattC.prod.productID][0].Add("ProductName", prod.pattC.prod.productName); prodAtts[prod.pattC.prod.productID][2].Add("SubCategoryID", prod.pattC.prod.subCategoryID.ToString()); } } return(prodAtts); } }
public Dictionary <string, string> getAllTechnicalSpec(int productID) { using (var db = new JooleAppEntities()) { var des = (from p in dbb.tblProducts join pa in dbb.tblProductAttributes on p.productID equals pa.productID join a in dbb.tblAttributes on pa.attributeID equals a.attributeID where (p.productID == productID && a.isTechSpec == true) select new { p, pa, a } ); Dictionary <string, string> newD = new Dictionary <string, string>(); foreach (var d in des) { newD.Add(d.a.attributeName, d.pa.attributeValue); } return(newD); } }
public Dictionary <string, string> getTechnicalSpec(int productID) { using (var db = new JooleAppEntities()) { var des = (from p in dbb.tblProducts join pa in dbb.tblProductAttributes on p.productID equals pa.productID join a in dbb.tblAttributes on pa.attributeID equals a.attributeID join t in dbb.tblTechSpecFilters on pa.attributeID equals t.attributeID where (p.productID == productID && a.isTechSpec == true && t.minVal == t.maxVal) select new { p.productID, a.attributeName, pa.attributeValue } ).Distinct(); Dictionary <string, string> newD = new Dictionary <string, string>(); foreach (var d in des) { newD.Add(d.attributeName, d.attributeValue); } return(newD); } }
public ProductSubCategoryRepo() { this._context = new JooleAppEntities(); entities = _context.Set <tblSubCategory>(); }
public ProductDetailRepo(JooleAppEntities context) { dbb = context; }
public Repository() { this._context = new JooleAppEntities(); entities = _context.Set <T>(); }
public ProductDetailRepo() { dbb = StaticUnitOfWork.getContext(); }
private StaticUnitOfWork() { context = new JooleAppEntities(); }
public UnitOfWork() { this.Context = new JooleAppEntities(); productSubCategoryRepo = new ProductSubCategoryRepo(Context); }
public Repository(JooleAppEntities context) { _context = context; entities = _context.Set <T>(); }
public UserRepo(JooleAppEntities context) { _context = context; entities = _context.Set <tblUser>(); }
public ProductSubCategoryRepo(JooleAppEntities context) { _context = context; entities = _context.Set <tblSubCategory>(); }
public UserRepo() { this._context = new JooleAppEntities(); entities = _context.Set <tblUser>(); }