public ActionResult EditSave(R_User_ActionInfo act) { if (R_User_ActionInfoService.Update(act)) { R_User_ActionInfoService.SaveChanges(); return(Content("ok")); } return(Content("修改失败了!")); }
//去除特殊权限 public ActionResult RemoveUserAction(int UserInfoID, int ActionInfoID) { //R_User_ActionInfoService.Delete() var item = R_User_ActionInfoService.LoadEntities(r => r.UserInfoID == UserInfoID && r.ActionInfoID == ActionInfoID) .FirstOrDefault(); if (item != null) { item.DelFlag = (short)SS.Platform.OA.Model.Enum.DelFlagEnum.Deleted; R_User_ActionInfoService.SaveChanges(); } return(Content("ok")); }
public ActionResult Add(R_User_ActionInfo act) { if (act.UserInfoID == 0) { return(Content("请选择用户")); } if (act.ActionInfoID == 0) { return(Content("请选择权限")); } //查找已有权限 var userAction = R_User_ActionInfoService.LoadEntities(u => u.UserInfoID == act.UserInfoID && u.ActionInfoID == act.ActionInfoID).FirstOrDefault(); if (userAction != null) { if (userAction.DelFlag == (short)SS.Platform.OA.Model.Enum.DelFlagEnum.Deleted) { userAction.DelFlag = (short)SS.Platform.OA.Model.Enum.DelFlagEnum.Normal; if (R_User_ActionInfoService.Update(userAction)) { R_User_ActionInfoService.SaveChanges(); return(Content("ok")); } } else { return(Content("该用户权限已经存在,不允许重复添加!")); } } //查找用户编码 var user = UserInfoService.LoadEntities(u => u.ID == act.UserInfoID).FirstOrDefault(); //查找权限编码 var action = ActionInfoService.LoadEntities(u => u.ID == act.ActionInfoID).FirstOrDefault(); //#region 生成编码 act.Code = user.Code + "-" + action.Code; act.Name = user.Name + "-" + action.Name; act.DelFlag = (short)SS.Platform.OA.Model.Enum.DelFlagEnum.Normal; R_User_ActionInfoService.Add(act); if (R_User_ActionInfoService.SaveChanges() > 0) { return(Content("ok")); } return(Content("添加失败了")); }
//添加特殊权限 public ActionResult SetUserActionPasss(R_User_ActionInfo userAction) { var item = R_User_ActionInfoService.LoadEntities(r => r.UserInfoID == userAction.UserInfoID && r.ActionInfoID == userAction.ActionInfoID) .FirstOrDefault(); if (item == null)//如果没有那么直接添加 { R_User_ActionInfoService.Add(userAction); R_User_ActionInfoService.SaveChanges(); } else//如果有那么直接修改 { item.IsPass = userAction.IsPass; item.DelFlag = (short)SS.Platform.OA.Model.Enum.DelFlagEnum.Normal; R_User_ActionInfoService.SaveChanges(); } return(Content("ok")); }