Example #1
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();
        }