private EmployeeDto GetEmployee(string loginname) { var sql = " SELECT[ID] Id " + " ,[LOGIN_NAME] loginName " + " ,[EMP_NO] employeeNo " + " ,[DISPLAY_NAME] fullName " + " ,[POSITION] position " + " ,[EMAIL] email " + " ,[TELEPHONE] ext " + " ,[MOBILE_PHONE] phone " + " ,[MANAGER] reportTo " + " ,[GROUP_NAME] groupName " + " ,[TEAM_ID] subDeptId " + " ,[TEAM_NAME] subDept " + " ,[DEPT_TYPE] devision " + " ,[HOD] hod " + " ,[EMP_TYPE] empType" + " FROM [HR].[VIEW_EMPLOYEE_LIST] WHERE LOGIN_NAME = @loginname"; var single = SqlQuery <EmployeeDto>(sql, new object[] { new SqlParameter("@loginname", SecurityLabel.GetNameWithoutLabel(loginname)) } ).FirstOrDefault(); return(single); }
private IList <UserRoleDto> GetIncludeOrExclude(Management.Role role, bool isInclude) { Management.RoleItemCollection <Management.Role, Management.RoleItem> roleitems = null; IList <UserRoleDto> users = new List <UserRoleDto>(); if (isInclude) { roleitems = role.Include; } else { roleitems = role.Exclude; } foreach (Management.RoleItem roleitem in roleitems) { UserRoleDto user = new UserRoleDto(); var single = GetEmployee(roleitem.Name); if (single != null) { user.fullName = single.fullName; user.Devision = single.devision; user.EmployeeNo = single.employeeNo; user.GroupName = single.groupName; user.Position = single.position; user.SubDept = single.subDept; } user.LoginName = SecurityLabel.GetNameWithoutLabel(roleitem.Name).ToUpper(); user.Include = isInclude; users.Add(user); } return(users); }