private void BindGroups(RadTreeNode node) { if (node.Level == 1) { int goodsType = int.Parse(node.Value); IList <AttributeGroupInfo> list = _goodsAttributeGroupSao.GetAttrGroupList(goodsType).ToList(); foreach (GridDataItem dataItem in GroupGrid.Items) { var cbIsChecked = (CheckBox)dataItem.FindControl("cbIsChecked"); var labGoodsQuantity = (Label)dataItem.FindControl("Lab_GoodsQuantity"); var info = list.FirstOrDefault(w => w.GroupId == Convert.ToInt32(dataItem.GetDataKeyValue("GroupId").ToString())); if (info != null) { cbIsChecked.Checked = info.IsSelect; labGoodsQuantity.Text = string.Format("{0}", info.GoodsQuantity); if (info.GoodsQuantity > 0) { cbIsChecked.InputAttributes.Add("onclick", "javascript:return confirm('该属性下有绑定商品,取消将删除所有商品对应属性!');"); } } else { cbIsChecked.Checked = false; labGoodsQuantity.Text = "-"; } } } else { GroupGrid.Rebind(); } }
private void EditGroupDialog1_ItemUpdated(object sender, PersistentItemEventArgs e) { _ManagableGroups = SecurityUtility.GetManagableGroups(); GroupGrid.EditIndex = -1; GroupGrid.DataBind(); AddPanel.Visible = true; EditPanel.Visible = false; AddEditAjax.Update(); GroupAjax.Update(); }
// 删除 protected void GroupGrid_DeleteCommand(object source, GridCommandEventArgs e) { var editedItem = e.Item as GridEditableItem; if (editedItem != null) { int groupId = Convert.ToInt32(editedItem.GetDataKeyValue("GroupId").ToString()); try { var attrWordsList = _goodsAttributeGroupSao.GetAttrWordsListByGroupId(groupId).Where(p => !string.IsNullOrEmpty(p.AttrWordImage)); if (attrWordsList.Any()) { RAM.Alert("该“属性组”已有“属性词”上传图片,不允许删除!"); return; } string errorMessage; var result = _goodsAttributeGroupSao.DeleteAttrGroup(groupId, out errorMessage); if (result) { ////记录工作日志 //var pinfo = CurrentSession.Personnel.Get(); //var type = HRS.Enum.OperationTypePoint.OperationLogTypeEnum.CommodityAttributeGrouping.GetBusinessInfo(); //var point = HRS.Enum.OperationTypePoint.CommodityAttributeGroupingState.Delete.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(groupId) //}; //OperationLogManager.InsertOperationLog(logInfo); } else { RAM.Alert("商品属性组删除无效!" + errorMessage); } } catch { RAM.Alert("商品属性组删除失败!"); } } GroupGrid.Rebind(); }
private void AddGroupDialog1_ItemAdded(object sender, PersistentItemEventArgs e) { _ManagableGroups = SecurityUtility.GetManagableGroups(); GroupGrid.DataBind(); GroupAjax.Update(); }
// 增加 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(); }