...
If a person has more than one employment, there is often a need to determinate its main employment. This is can be used in many places such as mappings. For example a Core Identity can have two employments but you would like to provision its job title to a target system. In order to determinate the job title, the main employment is used.
...
Code Block | ||
---|---|---|
| ||
return employments .Where(a => a.EmploymentState.Id != (uint)CoreIdentityEmploymentStates.Deleted) .OrderByDescending(a => a.EmploymentState.Id) .ThenByDescending(a => a.MainEmployment) .ThenByDescending(a => a.ValidFrom <= DateTime.Now && (!a.ValidTo.HasValue || a.ValidTo.Value >= DateTime.Now.Date)) .ThenByDescending(a => a.Percentage) .ThenBy(a => a.ValidFrom) .ThenBy(a => a.ValidTo.HasValue) .ThenBy(a => a.ValidTo) .ThenBy(a => a.Id); |
For further information there are also how-tos related to this topic: