Example #1
0
        /// <summary>
        /// 通过IDataReader创建AttributeGroupInfo信息
        /// </summary>
        public static AttributeGroupInfo BuildAttributeGroupFromReader(IDataReader reader)
        {
            AttributeGroupInfo attributeGroupInfo = new AttributeGroupInfo();

            attributeGroupInfo.AttrGroupId = TypeHelper.ObjectToInt(reader["attrgroupid"]);
            attributeGroupInfo.CateId = TypeHelper.ObjectToInt(reader["cateid"]);
            attributeGroupInfo.Name = reader["name"].ToString();
            attributeGroupInfo.DisplayOrder = TypeHelper.ObjectToInt(reader["displayorder"]);

            return attributeGroupInfo;
        }
        public ActionResult AddAttributeGroup(AttributeGroupModel model, int cateId = -1)
        {
            CategoryInfo categoryInfo = AdminCategories.GetCategoryById(cateId);
            if (categoryInfo == null)
                return PromptView("分类不存在");

            if (AdminCategories.GetAttributeGroupIdByCateIdAndName(cateId, model.AttributeGroupName) > 0)
                ModelState.AddModelError("AttributeGroupName", "名称已经存在");

            if (ModelState.IsValid)
            {
                AttributeGroupInfo attributeGroupInfo = new AttributeGroupInfo()
                {
                    Name = model.AttributeGroupName,
                    CateId = categoryInfo.CateId,
                    DisplayOrder = model.DisplayOrder
                };

                AdminCategories.CreateAttributeGroup(attributeGroupInfo);
                AddAdminOperateLog("添加属性分组", "添加属性分组,属性分组为:" + model.AttributeGroupName);
                return PromptView("属性分组添加成功");
            }
            ViewData["cateId"] = categoryInfo.CateId;
            ViewData["categoryName"] = categoryInfo.Name;
            ViewData["referer"] = ShopUtils.GetAdminRefererCookie();
            return View(model);
        }
Example #3
0
 /// <summary>
 /// 创建属性分组
 /// </summary>
 public static void CreateAttributeGroup(AttributeGroupInfo attributeGroupInfo)
 {
     BrnShop.Data.Categories.CreateAttributeGroup(attributeGroupInfo);
 }
Example #4
0
 /// <summary>
 /// 创建属性
 /// </summary>
 /// <param name="attributeInfo">属性信息</param>
 /// <param name="attributeGroupInfo">属性组信息</param>
 public static void CreateAttribute(AttributeInfo attributeInfo, AttributeGroupInfo attributeGroupInfo)
 {
     BrnShop.Data.Categories.CreateAttribute(attributeInfo, attributeGroupInfo.AttrGroupId, attributeGroupInfo.Name, attributeGroupInfo.DisplayOrder);
     //BrnShop.Core.BSPCache.Remove(CacheKeys.SHOP_CATEGORY_FILTERAANDVLIST + attributeInfo.CateId);
     BrnShop.Core.BSPCache.Remove(CacheKeys.SHOP_CATEGORY_AANDVLISTJSONCACHE + attributeInfo.CateId);
 }
Example #5
0
 /// <summary>
 /// 更新属性分组
 /// </summary>
 /// <param name="newAttributeGroupInfo">新属性分组</param>
 /// <param name="oldAttributeGroupInfo">原属性分组</param>
 public static void UpdateAttributeGroup(AttributeGroupInfo attributeGroupInfo)
 {
     BrnShop.Core.BSPData.RDBS.UpdateAttributeGroup(attributeGroupInfo);
 }
Example #6
0
 /// <summary>
 /// 创建属性分组
 /// </summary>
 public void CreateAttributeGroup(AttributeGroupInfo attributeGroupInfo)
 {
     DbParameter[] parms = {
                                 GenerateInParam("@cateid", SqlDbType.SmallInt, 2, attributeGroupInfo.CateId),
                                 GenerateInParam("@name", SqlDbType.NChar, 20, attributeGroupInfo.Name),
                                 GenerateInParam("@displayorder", SqlDbType.Int,4,attributeGroupInfo.DisplayOrder)
                             };
     string commandText = string.Format("INSERT INTO [{0}attributegroups]([cateid],[name],[displayorder]) VALUES(@cateid,@name,@displayorder)",
                                         RDBSHelper.RDBSTablePre);
     RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
 }
Example #7
0
        /// <summary>
        /// 更新属性分组
        /// </summary>
        /// <param name="newAttributeGroupInfo">新属性分组</param>
        /// <param name="oldAttributeGroupInfo">原属性分组</param>
        public void UpdateAttributeGroup(AttributeGroupInfo attributeGroupInfo)
        {
            DbParameter[] parms = {
                                        GenerateInParam("@cateid", SqlDbType.SmallInt, 2, attributeGroupInfo.CateId),
                                        GenerateInParam("@name", SqlDbType.NChar, 20, attributeGroupInfo.Name),
                                        GenerateInParam("@displayorder", SqlDbType.Int,4,attributeGroupInfo.DisplayOrder),
                                        GenerateInParam("@attrgroupid", SqlDbType.SmallInt, 2, attributeGroupInfo.AttrGroupId)
                                    };

            string commandText = string.Format("UPDATE [{0}attributegroups] SET [cateid]=@cateid,[name]=@name,[displayorder]=@displayorder WHERE [attrgroupid]=@attrgroupid",
                                                RDBSHelper.RDBSTablePre);
            int effetRowCount = RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
            if (effetRowCount > 0)
            {
                commandText = string.Format("UPDATE [{0}attributevalues] SET [attrgroupname]='{1}',[attrgroupdisplayorder]={2} WHERE [attrgroupid]={3}",
                                             RDBSHelper.RDBSTablePre,
                                             attributeGroupInfo.Name,
                                             attributeGroupInfo.DisplayOrder,
                                             attributeGroupInfo.AttrGroupId);
                RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText);
            }
        }