Example #1
0
        public static List <Employee> Create(int?count, bool?useProductivity)
        {
            if (count == null)
            {
                count = 100;
            }

            var employees = new List <Employee>();

            for (int i = 0; i < count; i++)
            {
                var age       = Math.Round(DataGenerator.GetNumber(20, 40));
                var gender    = DataGenerator.GetGender();
                var firstName = DataGenerator.GetNameFirst(gender);
                var lastName  = DataGenerator.GetNameLast();
                var street    = DataGenerator.GetStreet();
                var country   = DataGenerator.GetCountry();
                var city      = DataGenerator.GetCity(country);
                var email     = firstName.ToLower() + "@" + DataGenerator.GetEmail();
                var photoPath = DataGenerator.GetPhoto(gender);

                var employee = new Employee
                {
                    Index     = i,
                    Address   = street + ", " + city,
                    Age       = age,
                    Birthday  = DataGenerator.GetBirthday(),
                    City      = city,
                    Email     = email,
                    Gender    = gender,
                    ID        = DataGenerator.Pad(1001 + i, 4),
                    FirstName = firstName,
                    LastName  = lastName,
                    Name      = firstName + " " + lastName,
                    Photo     = photoPath,
                    Phone     = DataGenerator.GetPhone(),
                    Street    = DataGenerator.GetStreet(),
                    Salary    = DataGenerator.GetNumber(40, 200) * 1000,
                    Sales     = DataGenerator.GetNumber(200, 980) * 1000,
                };
                employee.Country = country;

                employee.Income = DataGenerator.GetIncomeRange(employee.Salary);

                if (useProductivity.HasValue && useProductivity.Value)
                {
                    employee.Productivity = GetProductivity(52);
                }
                employees.Add(employee);
            }

            return(employees);
        }