Ejemplo n.º 1
0
        /// <summary>
        /// Get an ordered list of employment for the last three years at random
        /// </summary>
        /// <param name="options"></param>
        /// <param name="personality"></param>
        /// <param name="eduLevel"></param>
        /// <param name="emplyRanges">
        /// Optional, allows calling assembly to set this directly, defaults to <see cref="GetEmploymentRanges"/>
        /// </param>
        /// <returns></returns>
        protected internal virtual List <ILaboris> GetRandomEmployment(AmericanDomusOpesOptions options, IPersonality personality = null,
                                                                       OccidentalEdu eduLevel = OccidentalEdu.None, List <Tuple <DateTime, DateTime?> > emplyRanges = null)
        {
            options = options ?? AmericanDomusOpesOptions.RandomOpesOptions();
            var empls = new HashSet <ILaboris>();

            emplyRanges = emplyRanges ?? GetEmploymentRanges(options, personality);

            //limit result to those which match the edu level
            Predicate <SocDetailedOccupation> filter = null;

            if (eduLevel < (OccidentalEdu.Bachelor | OccidentalEdu.Grad))
            {
                filter = s => !StandardOccupationalClassification.IsDegreeRequired(s);
            }

            var occ = StandardOccupationalClassification.RandomOccupation(filter);

            foreach (var range in emplyRanges)
            {
                var emply = new AmericanEmployment()
                {
                    Occupation = occ
                };
                var cloneOptions = options.GetClone();
                cloneOptions.Inception = range.Item1;
                cloneOptions.Terminus  = range.Item2;
                emply.RandomizeAllItems(options);
                empls.Add(emply);
            }

            var e = empls.ToList();

            e.Sort(Comparer);
            return(e);
        }