コード例 #1
0
        /// <summary>
        /// 删除角色和角色对应的中间表数据
        /// Esmart_Sys_Roles
        /// Esmart_Sys_RolesInDeparent
        /// Esmart_Sys_Role_App
        /// Esmart_Sys_Role_Navigations
        /// Esmart_Sys_Role_Navigation_Function
        /// Esmart_Sys_User_Roles
        /// </summary>
        /// <param name="request">角色Id</param>
        /// <returns></returns>
        public bool Del(RoleModel request)
        {
            RoleDbAction.Delete(request.Id);
            RoleNavigationsDbAction.Del(request.Id);
            RoleNavigationFunctionDbAction.Del(request.Id);
            UserRolesDbAction.Delete(request.Id);
            DepartmentRolesDbAction.DeleteByRoleId(request.Id);
            if (LogHelper <RoleModel> .LogAction("Esmart.Permission.Application.Data.DepartmentRolesDbAction") != null)
            {
                LogHelper <RoleModel> .LogAction("Esmart.Permission.Application.Data.DepartmentRolesDbAction")(new UserLiteDto {
                    UserID = request.CreatorId == null?1:request.CreatorId.Value
                }, request);

                LogHelper <RoleModel> .RemoveAction("Esmart.Permission.Application.Data.DepartmentRolesDbAction");
            }
            var remark = string.Format("用户:{0} 删除角色:{1}", request.CreatorId ?? 0, request.Id);

            LogManagerDb.Log(request.CreatorId ?? 0, DateTime.Now, remark, "RoleManager.DelByDepartmentId");

            return(true);
        }
コード例 #2
0
ファイル: MenuManager.cs プロジェクト: zszqwe/MvcBase
        public int Update(MeunModel model)
        {
            Esmart_Sys_Navigations dbModel = new Esmart_Sys_Navigations()
            {
                AppId = model.AppId, Iconurl = model.Iconurl, InClassName = model.InClassName, NavigationId = model.Id, OutClassName = model.OutClassName, ParentID = model.ParentID, SortNo = model.SortNo, Title = model.Title, Url = model.Url
            };

            var updateModel = Data.MenuManager.GetModel(model.Id);

            if (updateModel == null)
            {
                throw new TpoBaseException("this  data  is  not existes");
            }
            dbModel.CreateId   = updateModel.CreateId;
            dbModel.CreateTime = updateModel.CreateTime;

            int code = Data.MenuManager.Update(dbModel);

            LogManagerDb.Log(model.CreateId, model.CreateTime, "用户" + model.CreateId + "修改了菜单,菜单名字是:" + model.Title, "menuupdate");

            return(code);
        }