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));
        }
        public ActionResult EditAttributeGroup(AttributeGroupModel model, int attrGroupId = -1)
        {
            AttributeGroupInfo attributeGroupInfo = AdminCategories.GetAttributeGroupById(attrGroupId);

            if (attributeGroupInfo == null)
            {
                return(PromptView("属性分组不存在"));
            }

            int attrGroupId2 = AdminCategories.GetAttributeGroupIdByCateIdAndName(attributeGroupInfo.CateId, model.AttributeGroupName);

            if (attrGroupId2 > 0 && attrGroupId2 != attrGroupId)
            {
                ModelState.AddModelError("AttributeGroupName", "名称已经存在");
            }

            if (ModelState.IsValid)
            {
                attributeGroupInfo.Name         = model.AttributeGroupName;
                attributeGroupInfo.DisplayOrder = model.DisplayOrder;

                AdminCategories.UpdateAttributeGroup(attributeGroupInfo);
                AddAdminOperateLog("修改属性分组", "修改属性分组,属性分组ID为:" + attrGroupId);
                return(PromptView("属性分组修改成功"));
            }

            CategoryInfo categoryInfo = AdminCategories.GetCategoryById(attributeGroupInfo.CateId);

            ViewData["cateId"]       = categoryInfo.CateId;
            ViewData["categoryName"] = categoryInfo.Name;
            ViewData["referer"]      = ShopUtils.GetAdminRefererCookie();
            return(View(model));
        }
Beispiel #3
0
        public ActionResult EditAttribute(int attrId = -1)
        {
            AttributeInfo attributeInfo = AdminCategories.GetAttributeById(attrId);

            if (attributeInfo == null)
            {
                return(PromptView("属性不存在"));
            }

            AttributeModel model = new AttributeModel();

            model.AttributName = attributeInfo.Name;
            model.AttrGroupId  = attributeInfo.AttrGroupId;
            model.ShowType     = attributeInfo.ShowType;
            //model.IsFilter = attributeInfo.IsFilter;
            model.DisplayOrder = attributeInfo.DisplayOrder;

            //CategoryInfo categoryInfo = AdminCategories.GetCategoryById(attributeInfo.CateId);
            //ViewData["cateId"] = categoryInfo.CateId;
            //ViewData["categoryName"] = categoryInfo.Name;
            //ViewData["attributeGroupList"] = GetAttributeGroupSelectList();
            AttributeGroupInfo attributeGroupInfo = AdminCategories.GetAttributeGroupById(attributeInfo.AttrGroupId);

            ViewData["attributeGroupName"] = attributeGroupInfo.Name;
            ViewData["referer"]            = MallUtils.GetMallAdminRefererCookie();

            return(View(model));
        }
Beispiel #4
0
        /// <summary>
        /// 创建属性
        /// </summary>
        /// <param name="attributeInfo">属性信息</param>
        /// <param name="attributeGroupInfo">属性组信息</param>
        public static void CreateAttribute(AttributeInfo attributeInfo, AttributeGroupInfo attributeGroupInfo)
        {
            //NStore.Data.Categories.CreateAttribute(attributeInfo, attributeGroupInfo.AttrGroupId, attributeGroupInfo.Name, attributeGroupInfo.DisplayOrder);
            NStore.Data.Categories.CreateAttribute(attributeInfo, 0, "", 0);

            //NStore.Core.BMACache.Remove(CacheKeys.MALL_CATEGORY_FILTERAANDVLIST + attributeInfo.CateId);
            NStore.Core.BMACache.Remove(CacheKeys.MALL_CATEGORY_AANDVLISTJSONCACHE);
        }
Beispiel #5
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);
        }
Beispiel #6
0
        /// <summary>
        /// 获得属性分组
        /// </summary>
        /// <param name="attrGroupId">属性分组id</param>
        public static AttributeGroupInfo GetAttributeGroupById(int attrGroupId)
        {
            AttributeGroupInfo attributeGroupInfo = null;
            IDataReader        reader             = NStore.Core.BMAData.RDBS.GetAttributeGroupById(attrGroupId);

            if (reader.Read())
            {
                attributeGroupInfo = BuildAttributeGroupFromReader(reader);
            }

            reader.Close();
            return(attributeGroupInfo);
        }
Beispiel #7
0
        /// <summary>
        /// 获得分类的属性分组列表
        /// </summary>
        /// <returns></returns>
        public static List <AttributeGroupInfo> GetAttributeGroupList()
        {
            List <AttributeGroupInfo> attributeGroupList = new List <AttributeGroupInfo>();
            IDataReader reader = NStore.Core.BMAData.RDBS.GetAttributeGroupList();

            while (reader.Read())
            {
                AttributeGroupInfo attributeGroupInfo = BuildAttributeGroupFromReader(reader);
                attributeGroupList.Add(attributeGroupInfo);
            }
            reader.Close();
            return(attributeGroupList);
        }
Beispiel #8
0
        /// <summary>
        /// 获得分类的属性分组列表
        /// </summary>
        /// <param name="cateId">分类id.</param>
        /// <returns></returns>
        public static List <AttributeGroupInfo> GetAttributeGroupListByCateId(int cateId)
        {
            List <AttributeGroupInfo> attributeGroupList = new List <AttributeGroupInfo>();
            IDataReader reader = BrnShop.Core.BSPData.RDBS.GetAttributeGroupListByCateId(cateId);

            while (reader.Read())
            {
                AttributeGroupInfo attributeGroupInfo = BuildAttributeGroupFromReader(reader);
                attributeGroupList.Add(attributeGroupInfo);
            }
            reader.Close();
            return(attributeGroupList);
        }
Beispiel #9
0
        protected void GroupGrid_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == "Edit")
            {
                var editedItem = e.Item as GridEditableItem;
                if (editedItem != null)
                {
                    int groupId = Convert.ToInt32(editedItem.GetDataKeyValue("GroupId").ToString());
                    AttributeGroupInfo groupInfo = AttrGroupList.FirstOrDefault(g => g.GroupId == groupId);

                    IsSelected = (groupInfo != null && groupInfo.MatchType == 1);
                }
            }
        }
Beispiel #10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 static ServiceAttrGroupInfo ConvertToGoodsSeviceFieldInfo(AttributeGroupInfo info)
 {
     return(new ServiceAttrGroupInfo
     {
         GroupID = info.GroupId,
         MatchType = info.MatchType,
         Name = info.GroupName,
         OrderIndex = info.OrderIndex,
         IsMChoice = info.IsMChoice,
         IsPriorityFilter = info.IsPriorityFilter,
         EnabledFilter = info.EnabledFilter,
         Unit = info.Unit,
         IsUploadImage = info.IsUploadImage
     });
 }
Beispiel #11
0
        /// <summary> 修改高级属性组
        /// </summary>
        /// <param name="attrGroupInfo"></param>
        /// <param name="errorMessage"></param>
        /// <returns></returns>
        public bool UpdateAttrGroup(AttributeGroupInfo attrGroupInfo, out string errorMessage)
        {
            var result = GoodsServerClient.UpdateAttrGroup(ConvertToGoodsSeviceFieldInfo(attrGroupInfo));

            errorMessage = string.Empty;
            if (result == null)
            {
                errorMessage = "GMS连接异常";
            }
            else if (!result.IsSuccess)
            {
                errorMessage = result.ErrorMsg;
            }
            return(result != null && result.IsSuccess);
        }
Beispiel #12
0
        public ActionResult EditAttribute(AttributeModel model, int attrId = -1)
        {
            AttributeInfo attributeInfo = AdminCategories.GetAttributeById(attrId);

            if (attributeInfo == null)
            {
                return(PromptView("属性不存在"));
            }

            int attrId2 = AdminCategories.GetAttrIdByCateIdAndName(attributeInfo.CateId, model.AttributName);

            if (attrId2 > 0 && attrId2 != attrId)
            {
                ModelState.AddModelError("AttributName", "名称已经存在");
            }

            AttributeGroupInfo attributeGroupInfo = AdminCategories.GetAttributeGroupById(model.AttrGroupId);

            if (attributeGroupInfo == null || attributeGroupInfo.CateId != attributeInfo.CateId)
            {
                ModelState.AddModelError("AttrGroupId", "属性组不存在");
            }

            if (ModelState.IsValid)
            {
                attributeInfo.Name         = model.AttributName;
                attributeInfo.AttrGroupId  = model.AttrGroupId;
                attributeInfo.IsFilter     = model.IsFilter;
                attributeInfo.ShowType     = model.ShowType;
                attributeInfo.DisplayOrder = model.DisplayOrder;

                AdminCategories.UpdateAttribute(attributeInfo);
                AddAdminOperateLog("编辑分类属性", "编辑分类属性,分类属性ID为:" + attrId);
                return(PromptView("分类属性修改成功"));
            }

            CategoryInfo categoryInfo = AdminCategories.GetCategoryById(attributeInfo.CateId);

            ViewData["cateId"]             = categoryInfo.CateId;
            ViewData["categoryName"]       = categoryInfo.Name;
            ViewData["attributeGroupList"] = GetAttributeGroupSelectList(categoryInfo.CateId);
            ViewData["referer"]            = ShopUtils.GetAdminRefererCookie();
            return(View(model));
        }
Beispiel #13
0
        public ActionResult AddAttributeValue(AttributeValueModel model, int attrId = -1)
        {
            AttributeInfo attributeInfo = AdminCategories.GetAttributeById(attrId);

            if (attributeInfo == null)
            {
                ModelState.AddModelError("AttributName", "属性不存在");
            }

            if (AdminCategories.GetAttributeValueIdByAttrIdAndValue(attrId, model.AttrValue) > 0)
            {
                ModelState.AddModelError("AttributName", "值已经存在");
            }


            if (ModelState.IsValid)
            {
                AttributeGroupInfo attributeGroupInfo = AdminCategories.GetAttributeGroupById(attributeInfo.AttrGroupId);
                AttributeValueInfo attributeValueInfo = new AttributeValueInfo();

                attributeValueInfo.AttrId           = attributeInfo.AttrId;
                attributeValueInfo.AttrName         = attributeInfo.Name;
                attributeValueInfo.AttrDisplayOrder = attributeInfo.DisplayOrder;
                attributeValueInfo.AttrShowType     = attributeInfo.ShowType;

                attributeValueInfo.AttrGroupId           = attributeGroupInfo.AttrGroupId;
                attributeValueInfo.AttrGroupName         = attributeGroupInfo.Name;
                attributeValueInfo.AttrGroupDisplayOrder = attributeGroupInfo.DisplayOrder;

                attributeValueInfo.AttrValue             = model.AttrValue;
                attributeValueInfo.IsInput               = 0;
                attributeValueInfo.AttrValueDisplayOrder = model.DisplayOrder;

                AdminCategories.CreateAttributeValue(attributeValueInfo);
                AddAdminOperateLog("添加属性值", "添加属性值,属性值为:" + model.AttrValue);
                return(PromptView("属性值添加成功"));
            }
            ViewData["attrId"]        = attributeInfo.AttrId;
            ViewData["attributeName"] = attributeInfo.Name;
            ViewData["referer"]       = ShopUtils.GetAdminRefererCookie();
            return(View(model));
        }
Beispiel #14
0
        public ActionResult EditAttributeGroup(int attrGroupId = -1)
        {
            AttributeGroupInfo attributeGroupInfo = AdminCategories.GetAttributeGroupById(attrGroupId);

            if (attributeGroupInfo == null)
            {
                return(PromptView("属性分组不存在"));
            }

            AttributeGroupModel model = new AttributeGroupModel();

            model.AttributeGroupName = attributeGroupInfo.Name;
            model.DisplayOrder       = attributeGroupInfo.DisplayOrder;
            //CategoryInfo categoryInfo = AdminCategories.GetCategoryById(attributeGroupInfo.CateId);
            //ViewData["cateId"] = categoryInfo.CateId;
            //ViewData["categoryName"] = categoryInfo.Name;
            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();

            return(View(model));
        }
Beispiel #15
0
        public ActionResult AddAttribute(AttributeModel model, int cateId = -1)
        {
            CategoryInfo categoryInfo = AdminCategories.GetCategoryById(cateId);

            if (categoryInfo == null)
            {
                return(PromptView("分类不存在"));
            }

            if (AdminCategories.GetAttrIdByCateIdAndName(cateId, model.AttributName) > 0)
            {
                ModelState.AddModelError("AttributName", "名称已经存在");
            }

            AttributeGroupInfo attributeGroupInfo = AdminCategories.GetAttributeGroupById(model.AttrGroupId);

            if (attributeGroupInfo == null || attributeGroupInfo.CateId != cateId)
            {
                ModelState.AddModelError("AttrGroupId", "属性组不存在");
            }

            if (ModelState.IsValid)
            {
                AttributeInfo attributeInfo = new AttributeInfo();
                attributeInfo.Name         = model.AttributName;
                attributeInfo.CateId       = cateId;
                attributeInfo.AttrGroupId  = model.AttrGroupId;
                attributeInfo.ShowType     = model.ShowType;
                attributeInfo.IsFilter     = model.IsFilter;
                attributeInfo.DisplayOrder = model.DisplayOrder;

                AdminCategories.CreateAttribute(attributeInfo, attributeGroupInfo);
                AddAdminOperateLog("添加分类属性", "添加分类属性,属性为:" + model.AttributName);
                return(PromptView("分类属性添加成功"));
            }
            ViewData["cateId"]             = categoryInfo.CateId;
            ViewData["categoryName"]       = categoryInfo.Name;
            ViewData["attributeGroupList"] = GetAttributeGroupSelectList(cateId);
            ViewData["referer"]            = ShopUtils.GetAdminRefererCookie();
            return(View(model));
        }
Beispiel #16
0
 /// <summary>
 /// 创建属性分组
 /// </summary>
 public static void CreateAttributeGroup(AttributeGroupInfo attributeGroupInfo)
 {
     NStore.Core.BMAData.RDBS.CreateAttributeGroup(attributeGroupInfo);
 }
Beispiel #17
0
 /// <summary>
 /// 更新属性分组
 /// </summary>
 /// <param name="newAttributeGroupInfo">新属性分组</param>
 /// <param name="oldAttributeGroupInfo">原属性分组</param>
 public static void UpdateAttributeGroup(AttributeGroupInfo attributeGroupInfo)
 {
     BrnMall.Core.BMAData.RDBS.UpdateAttributeGroup(attributeGroupInfo);
 }
Beispiel #18
0
        // 增加
        protected void GroupGrid_InsertCommand(object source, GridCommandEventArgs e)
        {
            var editedItem = e.Item as GridEditableItem;

            if (editedItem != null)
            {
                int    orderIndex       = int.Parse(((TextBox)editedItem.FindControl("Txt_OrderIndex")).Text);
                string strUnit          = ((TextBox)editedItem.FindControl("Txt_Unit")).Text.Trim();
                string groupName        = ((TextBox)editedItem.FindControl("TB_GroupName")).Text;
                string matchType        = ((DropDownList)editedItem.FindControl("DDL_MatchType")).SelectedValue;
                bool   enableFilter     = ((CheckBox)editedItem.FindControl("CK_EditFilter")).Checked;
                bool   isMChoice        = ((CheckBox)editedItem.FindControl("CK_EditIsMChoice")).Checked;
                bool   isPriorityFilter = ((CheckBox)editedItem.FindControl("CK_EditIsPriorityFilter")).Checked;
                bool   isUploadImage    = ((CheckBox)editedItem.FindControl("CK_EditIsUploadImage")).Checked;

                if (AttrGroupList.Any(g => g.GroupName == groupName))
                {
                    RAM.Alert("添加失败,商品属性组组名重复!");
                    return;
                }
                var groupInfo = new AttributeGroupInfo
                {
                    GroupName        = groupName,
                    MatchType        = Convert.ToInt32(matchType),
                    OrderIndex       = orderIndex,
                    EnabledFilter    = enableFilter,
                    IsMChoice        = isMChoice,
                    IsPriorityFilter = isPriorityFilter,
                    Unit             = strUnit,
                    IsUploadImage    = isUploadImage
                };
                try
                {
                    string errorMessage;
                    var    result = _goodsAttributeGroupSao.AddAttrGroup(groupInfo, out errorMessage);
                    if (result)
                    {
                        //记录工作日志
                        //var pinfo = CurrentSession.Personnel.Get();
                        //_operationLogManager.Add(pinfo.PersonnelId, pinfo.RealName, groupInfo.,
                        //                 OperationPoint.GoodsSeriesManager.Delete.GetBusinessInfo(), 1);

                        //var type = HRS.Enum.OperationTypePoint.OperationLogTypeEnum.CommodityAttributeGrouping.GetBusinessInfo();
                        //var point = HRS.Enum.OperationTypePoint.CommodityAttributeGroupingState.Add.GetBusinessInfo();
                        //var logInfo = new HRS.Model.OperationLogInfo
                        //{
                        //    LogId = Guid.NewGuid(),
                        //    PersonnelId = pinfo.PersonnelId,
                        //    RealName = pinfo.RealName,
                        //    TypeId = new Guid(type.Key),
                        //    PointId = new Guid(point.Key),
                        //    OperateTime = DateTime.Now,
                        //    Description = type.Value + "--" + point.Value,
                        //    IdentifyKey = Convert.ToString(groupInfo.GroupName)
                        //};
                        //OperationLogManager.InsertOperationLog(logInfo);
                    }
                    else
                    {
                        RAM.Alert("商品属性组添加无效!" + errorMessage);
                    }
                }
                catch
                {
                    RAM.Alert("商品属性组添加失败!");
                }
            }
            GroupGrid.Rebind();
        }
Beispiel #19
0
 /// <summary>
 /// 更新属性分组
 /// </summary>
 /// <param name="newAttributeGroupInfo">新属性分组</param>
 /// <param name="oldAttributeGroupInfo">原属性分组</param>
 public static void UpdateAttributeGroup(AttributeGroupInfo attributeGroupInfo)
 {
     BrnShop.Data.Categories.UpdateAttributeGroup(attributeGroupInfo);
 }
Beispiel #20
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);
 }
Beispiel #21
0
 /// <summary>
 /// 创建属性分组
 /// </summary>
 public static void CreateAttributeGroup(AttributeGroupInfo attributeGroupInfo)
 {
     BrnShop.Core.BSPData.RDBS.CreateAttributeGroup(attributeGroupInfo);
 }
Beispiel #22
0
 /// <summary>
 /// 创建属性分组
 /// </summary>
 public static void CreateAttributeGroup(AttributeGroupInfo attributeGroupInfo)
 {
     NStore.Data.Categories.CreateAttributeGroup(attributeGroupInfo);
 }
Beispiel #23
0
 private void Build(AttributeGroupInfo field, GeneratorUtil builderUtil)
 {
 }
Beispiel #24
0
 /// <summary>
 /// 创建属性分组
 /// </summary>
 public static void CreateAttributeGroup(AttributeGroupInfo attributeGroupInfo)
 {
     BrnMall.Data.Categories.CreateAttributeGroup(attributeGroupInfo);
 }