Example #1
0
        private bool DoEdit(int _id)
        {
            try
            {
                BLL.navigation   bll   = new BLL.navigation();
                Model.navigation model = bll.GetModel(_id);

                model.name      = txtName.Text.Trim();
                model.title     = txtTitle.Text.Trim();
                model.sub_title = txtSubTitle.Text.Trim();
                model.icon_url  = txtIconUrl.Text.Trim();
                model.link_url  = txtLinkUrl.Text.Trim();
                model.sort_id   = int.Parse(txtSortId.Text.Trim());
                model.is_lock   = 0;
                if (cbIsLock.Checked == true)
                {
                    model.is_lock = 1;
                }
                model.remark = txtRemark.Text.Trim();
                if (model.is_sys == 0)
                {
                    int parentId = int.Parse(ddlParentId.SelectedValue);
                    //如果选择的父ID不是自己,则更改
                    if (parentId != model.id)
                    {
                        model.parent_id = parentId;
                    }
                }

                //添加操作权限类型
                string action_type_str = string.Empty;
                for (int i = 0; i < cblActionType.Items.Count; i++)
                {
                    if (cblActionType.Items[i].Selected && EnumInfo.IsContains <Tools.Const.Enums.ManagementOperate>(cblActionType.Items[i].Value))
                    {
                        action_type_str += cblActionType.Items[i].Value + ",";
                    }
                }
                model.action_type = Utils.DelLastComma(action_type_str);

                if (bll.Update(model))
                {
                    AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "修改导航菜单:" + model.title); //记录日志
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }
Example #2
0
 //绑定导航权限资源
 protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         string[]     actionTypeArr = ((HiddenField)e.Item.FindControl("hidActionType")).Value.Split(',');
         CheckBoxList cblActionType = (CheckBoxList)e.Item.FindControl("cblActionType");
         cblActionType.Items.Clear();
         for (int i = 0; i < actionTypeArr.Length; i++)
         {
             if (EnumInfo.IsContains <Tools.Const.Enums.ManagementOperate>(actionTypeArr[i]))
             {
                 cblActionType.Items.Add(new ListItem(" " + EnumInfo.ToDictionary <Tools.Const.Enums.ManagementOperate>()[actionTypeArr[i]].Explain + " ", actionTypeArr[i]));
             }
         }
     }
 }