/// <summary> /// 增加 /// </summary> /// <param name="RoleRights">RoleRights实体对象</param> /// <returns>bool值,判断是否操作成功</returns> public bool add(RoleRights model) { SqlParameter[] param = new SqlParameter[] { new SqlParameter ("@Roles_ID",model.Roles_ID), new SqlParameter ("@Menu_Id",model.Menu_Id) }; return Helper.ExecuteNonQuery("RoleRights_Add",param); }
/// <summary> /// 增加 /// </summary> /// <param name="RoleRights">RoleRights实体对象</param> /// <returns>int值,返回自增ID</returns> public int addReturnId(RoleRights model) { SqlParameter[] param = new SqlParameter[] { new SqlParameter ("@Roles_ID",model.Roles_ID), new SqlParameter ("@Menu_Id",model.Menu_Id) }; return Convert.ToInt32(Helper.ExecuteScalar ("RoleRights_AddReturnId",param)); }
public void Delete(RoleRights entity) { try { entities.RoleRightss.Remove(entity); } catch (Exception ex) { throw ex; } }
public void Add(RoleRights entity) { try { entities.RoleRightss.Add(entity); } catch (Exception ex) { throw ex; } }
public void Attach(RoleRights entity) { try { entities.RoleRightss.Attach(entity); entities.Entry(entity).State = EntityState.Modified; } catch (Exception ex) { throw ex; } }
public async Task <ActionResult <RoleRights> > Put(Guid id, [FromBody] RoleRights roleRight) { try { var result = roleRightRepo.Retrieve().FirstOrDefault(x => x.Role_RightID == id); if (result == null) { return(NotFound()); } await roleRightRepo.UpdateAsync(id, roleRight); return(Ok(roleRight)); } catch (Exception) { return(BadRequest()); } }
public async Task <ActionResult <RoleRights> > Post([FromBody] RoleRights roleRight) { try { roleRight.Role_RightID = Guid.NewGuid(); await roleRightRepo.CreateAsync(roleRight); return(CreatedAtRoute("GetRoleRightByID", new { id = roleRight.Role_RightID }, roleRight)); } catch (Exception) { return(BadRequest()); } }
public void Save(RoleRights entity) { try { RoleRights roleRights = entities.RoleRightss .Where(x => x.RoleCode == entity.RoleCode && x.CompanyCode == entity.CompanyCode && x.SecurableItem == entity.SecurableItem).FirstOrDefault(); if (roleRights != null) { entities.Entry(roleRights).State = EntityState.Modified; } else { Add(entity); } } catch (Exception ex) { throw ex; } }
public void CheckAccess() { try { if (SessionManager.UserId != null) { if (SessionManager.RoleRights == null) { SessionManager.RoleRights = RoleRights.GetRoleRights(Convert.ToInt32(SessionManager.UserId), SessionManager.UserType); } if (SessionManager.RoleRights != null && SessionManager.RoleRights.Any()) { SetViewRights(); } } } catch (Exception ex) { throw ex; } }
/// <summary> /// 查看全部 /// </summary> /// <returns>list集合</returns> public List<RoleRights> selectAll() { List<RoleRights> list = new List<RoleRights>(); RoleRights model = null; using (SqlDataReader dr = Helper.ExecuteReader("RoleRights_SelectAll", null)) { while (dr.Read()) { model = new RoleRights(); model.RoleRight_ID = dr["RoleRight_ID"].ToString(); if (DBNull.Value!=dr["Roles_ID"]) model.Roles_ID = dr["Roles_ID"].ToString(); if (DBNull.Value!=dr["Menu_Id"]) model.Menu_Id = dr["Menu_Id"].ToString(); list.Add(model); } } return list; }
/// <summary> /// 通过条件查询 /// </summary> /// <param name="WhereString">查询条件</param> /// <returns>RoleRights实体类对象</returns> public List<RoleRights> selectByWhere(string WhereString) { SqlParameter[] param = new SqlParameter[] { new SqlParameter ("@where",WhereString) }; List<RoleRights> list = new List<RoleRights>(); RoleRights model = null; using (SqlDataReader dr = Helper.ExecuteReader("RoleRights_SelectByWhere", param)) { while (dr.Read()) { model = new RoleRights(); model.RoleRight_ID = dr["RoleRight_ID"].ToString(); if (DBNull.Value!=dr["Roles_ID"]) model.Roles_ID = dr["Roles_ID"].ToString(); if (DBNull.Value!=dr["Menu_Id"]) model.Menu_Id = dr["Menu_Id"].ToString(); list.Add(model); } } return list; }
/// <summary> /// 通过Id查询 /// </summary> /// <param name="Id">主键Id</param> /// <returns>RoleRights实体类对象</returns> public RoleRights selectById(int Id) { SqlParameter[] param = new SqlParameter[] { new SqlParameter ("@RoleRight_ID",Id) }; RoleRights model = new RoleRights(); using (SqlDataReader dr = Helper.ExecuteReader("RoleRights_SelectById", param)) { if (dr.Read()) { model.RoleRight_ID = dr["RoleRight_ID"].ToString(); if (DBNull.Value!=dr["Roles_ID"]) model.Roles_ID = dr["Roles_ID"].ToString(); if (DBNull.Value!=dr["Menu_Id"]) model.Menu_Id = dr["Menu_Id"].ToString(); } } return model; }
public RoleRights GetRoleRights(RoleRights item) { return((RoleRights)rolerightsDAL.GetItem <RoleRights>(item)); }
public bool DeleteRoleRights(RoleRights item) { return(rolerightsDAL.Delete(item)); }
public bool SaveRoleRights(RoleRights newItem) { return(rolerightsDAL.Save(newItem)); }
public static bool HasRights(UserRoles role, RoleRights right) { return(rights[role].Contains(right)); }