Ejemplo n.º 1
0
        public bool DeleteProductAttr(string attrid, string operateIP, string operateID)
        {
            var bl = ProductsDAL.BaseProvider.DeleteProductAttr(attrid);

            if (bl)
            {
                var model = GetAttrByID(attrid);
                CacheAttrs.Remove(model);
            }
            return(bl);
        }
Ejemplo n.º 2
0
        public string AddAttr(string attrname, string description, string categoryid, int type, string operateid)
        {
            var attrid = Guid.NewGuid().ToString().ToLower();

            if (ProductsDAL.BaseProvider.AddAttr(attrid, attrname, description, categoryid, type, operateid))
            {
                CacheAttrs.Add(new ProductAttr()
                {
                    AttrID      = attrid,
                    AttrName    = attrname,
                    Description = description,
                    AttrValues  = new List <AttrValue>()
                });
                return(attrid);
            }
            return(string.Empty);
        }
Ejemplo n.º 3
0
        public List <ProductAttr> GetAttrs()
        {
            if (CacheAttrs.Count > 0)
            {
                return(CacheAttrs);
            }
            DataSet ds = ProductsDAL.BaseProvider.GetAttrs();

            foreach (DataRow dr in ds.Tables["Attrs"].Rows)
            {
                ProductAttr model = new ProductAttr();
                model.FillData(dr);
                model.AttrValues = new List <AttrValue>();
                foreach (DataRow item in ds.Tables["Values"].Select(" AttrID='" + model.AttrID + "' "))
                {
                    AttrValue attrValue = new AttrValue();
                    attrValue.FillData(item);
                    model.AttrValues.Add(attrValue);
                }
                CacheAttrs.Add(model);
            }
            return(CacheAttrs);
        }