public static List <Product> GetData(int?count)
        {
            if (count == null)
            {
                count = 20;
            }

            string[] names =
            {
                "Intel CPU",         "AMD CPU",
                "Intel Motherboard", "AMD Motherboard","NVIDIA Motherboard",
                "NVIDIA GPU",        "GIGABYTE GPU",   "Asus GPU",           "AMD GPU",    "MSI GPU",
                "Corsair Memory",    "Patriot Memory", "Skill Memory",
                "Samsung HDD",       "WD HDD",         "Seagate HDD",        "Intel HDD",
                "Samsung SSD",       "WD SSD",         "Seagate SSD",        "Intel SSD",
                "Samsung Monitor",   "Asus Monitor",   "LG Monitor",         "HP Monitor"
            };
            string[] countries = { "USA", "UK", "France", "Canada", "Poland", "Japan", "Germany" };
            string[] status    = { "Packing", "Shipped", "Delivered" };

            var products = new List <Product>();

            for (int i = 0; i < count; i++)
            {
                var id           = DataGenerator.Pad((int)count - i, count.ToString().Length);
                var price        = Math.Round((DataGenerator.GetNumber(10000, 90000) / 100), 2);
                var orderCount   = (int)DataGenerator.GetNumber(4, 30);
                var orderValue   = Math.Round((price * orderCount), 2);
                var orderShipped = (int)DataGenerator.GetNumber(30, 100);
                var margin       = DataGenerator.GetNumber(5, 10);
                var profit       = Math.Round(orderValue * (margin / 100));
                var country      = DataGenerator.GetItem(countries);

                products.Add(new Product()
                {
                    CountryFlag  = DataGenerator.GetCountryFlag(country),
                    CountryName  = country,
                    Margin       = margin,
                    OrderCount   = orderCount,
                    OrderHistory = GetOrderHistory(26),
                    OrderShipped = orderShipped,
                    OrderValue   = orderValue,
                    OrderDate    = DataGenerator.GetDate(),
                    ProductID    = id,
                    ProductName  = DataGenerator.GetItem(names),
                    ProductPrice = price,
                    Profit       = profit,
                    //ReturnRate = GetReturnRates(26),
                    Status = DataGenerator.GetItem(status)
                });
            }

            return(products);
        }
Beispiel #2
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);
        }
        public static List <Sale> Create(int?count)
        {
            if (count == null)
            {
                count = 100;
            }

            string[] names =
            {
                "Intel CPU",         "AMD CPU",
                "Intel Motherboard", "AMD Motherboard","NVIDIA Motherboard",
                "NVIDIA GPU",        "GIGABYTE GPU",   "Asus GPU",           "AMD GPU",    "MSI GPU",
                "Corsair Memory",    "Patriot Memory", "Skill Memory",
                "Samsung HDD",       "WD HDD",         "Seagate HDD",        "Intel HDD",
                "Samsung SSD",       "WD SSD",         "Seagate SSD",        "Intel SSD",
                "Samsung Monitor",   "Asus Monitor",   "LG Monitor",         "HP Monitor"
            };
            string[] countries = { "USA", "UK", "France", "Canada", "Poland", "Japan", "Germany" };
            string[] status    = { "Packing", "Shipped", "Delivered" };

            var sales = new List <Sale>();

            for (var i = 0; i < count; i++)
            {
                var price   = DataGenerator.GetNumber(100, 900);
                var items   = DataGenerator.GetNumber(10, 80);
                var value   = price * items;
                var margin  = DataGenerator.GetNumber(3, 10);
                var profit  = Math.Round((price * margin / 100) * items);
                var country = DataGenerator.GetItem(countries);
                var city    = DataGenerator.GetCity(country);

                sales.Add(new Sale
                {
                    ID           = DataGenerator.Pad(1001 + i, 4),
                    BundlePrice  = price,
                    ProductPrice = price,
                    Margin       = margin,
                    OrderDate    = DataGenerator.GetDate(),
                    OrderItems   = items,
                    OrderValue   = value, //  Math.round(value / 1000) + "," + Math.round(value % 1000),
                    ProductName  = DataGenerator.GetItem(names),
                    Profit       = profit,
                    City         = city,
                    Country      = country,
                    CountryFlag  = DataGenerator.GetCountryFlag(country),
                    Status       = DataGenerator.GetItem(status)
                });
            }
            return(sales);
        }
Beispiel #4
0
        public static List <PersonInfo> Create(int?count)
        {
            if (count == null)
            {
                count = 100;
            }

            var locations = GetLocations();

            var managers = new List <PersonInfo>();

            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 email     = firstName.ToLower() + "@" + DataGenerator.GetEmail();
                var photoPath = DataGenerator.GetPhoto(gender);

                var manager = new PersonInfo
                {
                    Index      = i,
                    Age        = age,
                    Birthday   = DataGenerator.GetBirthday(),
                    Email      = email,
                    Gender     = gender,
                    ID         = DataGenerator.Pad(1001 + i, 4),
                    Name       = firstName + " " + lastName,
                    Photo      = photoPath,
                    Phone      = DataGenerator.GetPhone(),
                    Salary     = DataGenerator.GetNumber(40, 200) * 1000,
                    Sales      = DataGenerator.GetNumber(200, 980) * 1000,
                    Background = "Transparent",
                };

                var location = GetRandom(locations);
                manager.Address      = street + ", " + location.City;
                manager.City         = location.City;
                manager.Country      = location.Country;
                manager.Latitude     = location.Latitude;
                manager.Longitude    = location.Longitude;
                manager.Income       = DataGenerator.GetIncomeRange(manager.Salary);
                manager.Productivity = GetProductivity();

                managers.Add(manager);
            }

            return(managers);
        }
        public static List <RealEstate> Create(int?count)
        {
            if (count == null)
            {
                count = 100;
            }

            string[] property  = { "Townhouse", "Single", "Condo", "Villa" };
            string[] emails    = { "estates.com", "remax.com", "zillow.com", "realtor.com", "coldwell.com" };
            string[] countries = { "USA", "UK", "France", "Canada", "Poland", "Japan", "Germany" };
            var      houses    = new List <RealEstate>();

            for (var i = 0; i < count; i++)
            {
                var year = DataGenerator.GetNumber(1950, 2015);
                var age  = 2020 - year;

                var gender    = DataGenerator.GetGender();
                var firstName = DataGenerator.GetNameFirst(gender);
                var lastName  = DataGenerator.GetNameLast();
                var initials  = firstName.Substring(0, 1).ToLower();
                var email     = initials + firstName.ToLower() + "@" + DataGenerator.GetItem(emails);
                var street    = DataGenerator.GetStreet();
                var country   = DataGenerator.GetItem(countries);
                var city      = DataGenerator.GetCity(country);

                houses.Add(new RealEstate
                {
                    Address     = street,
                    Age         = age,
                    Agent       = firstName + " " + lastName,
                    Area        = DataGenerator.GetNumber(50, 300),
                    Baths       = DataGenerator.GetNumber(1, 3),
                    Built       = year,
                    City        = city,
                    Country     = country,
                    CountryFlag = DataGenerator.GetCountryFlag(country),
                    Email       = email,
                    ID          = DataGenerator.Pad(i + 1001, 4),
                    Phone       = DataGenerator.GetPhone(),
                    Price       = DataGenerator.GetNumber(210, 900) * 1000,
                    Property    = DataGenerator.GetItem(property),
                    Rooms       = DataGenerator.GetNumber(2, 5),
                    SaleDate    = DataGenerator.GetDate(),
                    Street      = street
                });
            }
            return(houses);
        }
        public static List <ReturnRateItem> GetReturnRates(int weekCount)
        {
            var items = new List <ReturnRateItem>();

            for (int i = 0; i < weekCount; i++)
            {
                double value = DataGenerator.GetNumber(-100, 100);
                items.Add(new ReturnRateItem()
                {
                    Balance = value, Week = i
                });
            }

            return(items);
        }
        public static List <OrderHistoryItem> GetOrderHistory(int weekCount)
        {
            var items = new List <OrderHistoryItem>();

            for (int i = 0; i < weekCount; i++)
            {
                double value = DataGenerator.GetNumber(0, 100);
                items.Add(new OrderHistoryItem()
                {
                    Sold = value, Week = i
                });
            }

            return(items);
        }
Beispiel #8
0
        public static List <Productivity> GetProductivity(int weekCount)
        {
            var productivity = new List <Productivity>();

            for (var w = 1; w <= weekCount; w++)
            {
                var value = DataGenerator.GetNumber(-50, 50);
                var prod  = new Productivity
                {
                    Value = value,
                    Week  = w
                };
                productivity.Add(prod);
            }
            ;

            return(productivity);
        }
Beispiel #9
0
        public static List <PersonProductivity> GetProductivity()
        {
            var productivity = new List <PersonProductivity>();
            var months       = new List <string> {
                "JAN", "FEB", "MAR", "APR", "MAY", "JUN",
                "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"
            };

            var value = 50.0;

            for (var i = 0; i < months.Count; i++)
            {
                value += DataGenerator.GetNumber(-5, 10);
                var prod = new PersonProductivity
                {
                    Value = value,
                    Month = months[i]
                };
                productivity.Add(prod);
            }
            ;

            return(productivity);
        }
Beispiel #10
0
        public static PersonLocation GetRandom(List <PersonLocation> array)
        {
            var index = (int)Math.Round(DataGenerator.GetNumber(0, array.Count - 1));

            return(array[index]);
        }