public virtual string GetPropertyValue(Guid propertyId) { var value = PropertyValues.FirstOrDefault(s => s.PropertyId == propertyId); return(value == null ? string.Empty : value.Value); }
public Employee[] FindUser() { if (UserType != null) { string country = PropertyValues.FirstOrDefault(p => p.Type == 9)?.Value ?? Consts.GetApiCountry();//#TODO string deptcode = PropertyValues.FirstOrDefault(p => p.Type == 11)?.Value ?? "%"; string depttype = PropertyValues.FirstOrDefault(p => p.Type == 12)?.Value ?? "%"; if (UserType == (int)ApproverType.PredefinedRole) { if ((CountryType.HasValue && CountryType.Value == 0) || (DeptType.HasValue && DeptType.Value == 0) || (DeptTypeSource.HasValue && DeptTypeSource.Value == 0)) { UserStaffInfo result = _userManager.SearchStaff(Applicant); if (result != null && CountryType == 0) { country = result.Country; } if (result != null && DeptType == 0) { deptcode = result.Department; } if (result != null && DeptTypeSource == 0) { depttype = result.DepartmentType; } } if (CountryType.HasValue && CountryType.Value == 2) { country = FixedCountry; } if (DeptType.HasValue && DeptType.Value == 2) { deptcode = FixedDept; } if (DeptTypeSource.HasValue && DeptTypeSource.Value == 2) { depttype = FixedDeptType; } string brand = ""; switch (BrandType) { case 1: brand = PropertyValues.FirstOrDefault(p => p.Type == 14)?.Value; break; case 2: brand = FixedBrand; break; } return(GetUserByRole(country, deptcode, UserRole.ToString(), depttype, brand)); } if (UserType == (int)ApproverType.PredefinedReportingLine) { var employees = GetManager(); if (UserNameByNo != null) { foreach (var employee in employees) { employee.Name = UserNameByNo(employee.UserNo) ?? employee.UserNo; } } return(employees); } if (UserType == (int)ApproverType.RoleCriteria) { if ((CountryType.HasValue && CountryType.Value == 0) || (DeptType.HasValue && DeptType.Value == 0)) { UserStaffInfo result = _userManager.SearchStaff(Applicant); if (result != null && CountryType == 0) { country = result.Country; } if (result != null && DeptType == 0) { deptcode = result.Department; } } if (CountryType.HasValue && CountryType.Value == 2) { country = FixedCountry; } if (DeptType.HasValue && DeptType.Value == 2) { deptcode = FixedDept; } return(GetUserByGrade(country, deptcode, depttype)); } } return(new[] { new Employee(SelectedUser, SelectedUsername) }); }