Exemplo n.º 1
0
        public string AddCategory(string categoryCode, string categoryName, string pid, int type, int status, List <string> attrlist, List <string> saleattr, string description, string operateid)
        {
            var    dal  = new ProductsDAL();
            string guid = dal.AddCategory(categoryCode, categoryName, pid, type, status, string.Join(",", attrlist), string.Join(",", saleattr), description, operateid);

            if (!string.IsNullOrEmpty(guid))
            {
                if (string.IsNullOrEmpty(pid))
                {
                    CacheCategory.Add(new Category()
                    {
                        CategoryID    = guid.ToLower(),
                        CategoryCode  = categoryCode,
                        CategoryName  = categoryName,
                        CategoryType  = type,
                        Layers        = 1,
                        PID           = pid,
                        Status        = status,
                        Description   = description,
                        ChildCategory = new List <Category>(),
                        AttrLists     = new List <ProductAttr>(),
                        SaleAttrs     = new List <ProductAttr>()
                    });
                }
                else
                {
                    var PModel = GetCategoryByID(pid);
                    var model  = new Category()
                    {
                        CategoryID    = guid.ToLower(),
                        CategoryCode  = categoryCode,
                        CategoryName  = categoryName,
                        CategoryType  = type,
                        Layers        = PModel.Layers + 1,
                        PID           = pid,
                        Status        = status,
                        Description   = description,
                        ChildCategory = new List <Category>(),
                        AttrLists     = new List <ProductAttr>(),
                        SaleAttrs     = new List <ProductAttr>()
                    };
                    CacheCategory.Add(model);
                    PModel.ChildCategory.Add(model);
                }
            }
            return(guid);
        }
Exemplo n.º 2
0
        public string AddCategory(string categoryCode, string categoryName, string pid, int status, List <string> attrlist, List <string> saleattr, string description, string operateid, string clientid)
        {
            var dal = new ProductsDAL();

            return(dal.AddCategory(categoryCode, categoryName, pid, status, string.Join(",", attrlist), string.Join(",", saleattr), description, operateid, clientid));
        }