internal string AddEmployeeAuthority(string userId, string authorityCode) { //获取用户的信息 var dtEmployee = _dalEmployee.GetEmployeeList(new Hashtable { { "ID", userId } }); if (dtEmployee.Rows.Count == 0) { return("当前用户不存在!"); } var employee = dtEmployee.AsEnumerable().Select(dr => new EmployeeModel { //Authority = Convert.ToInt32(dr["Authority"]) | Convert.ToInt32(authorityId),//使用或运算添加权限 AuthorityCode = CommonUtil.AppendAuthorityCode(dr["AuthorityCode"].ToString(), authorityCode), Code = dr["Code"].ToString(), Description = dr["Description"].ToString(), Id = Convert.ToInt32(dr["Id"]), LoginName = dr["LoginName"].ToString(), Name = dr["Name"].ToString(), Password = dr["Password"].ToString() }).ToList().First(); return(_dalEmployee.ModifyEmployee(employee.ToHashTable())); }
internal string AddRoleAuthority(string roleId, string authorityCode) { //获取权限的信息 var dtRole = _dalRole.GetRoleList(new Hashtable { { "ID", roleId } }); if (dtRole.Rows.Count == 0) { return("当前角色不存在!"); } var role = dtRole.AsEnumerable().Select(dr => new RoleModel { //Authority = Convert.ToInt32(dr["Authority"]) | Convert.ToInt32(authorityId),//使用或运算添加权限 AuthorityCode = CommonUtil.AppendAuthorityCode(dr["AuthorityCode"].ToString(), authorityCode), Description = dr["Description"].ToString(), Id = Convert.ToInt32(dr["Id"]), Name = dr["Name"].ToString() }).ToList().First(); return(_dalRole.ModifyRole(role.ToHashTable())); }