private static void SearchArticles(Company company, int searchCounter = 10000000)
 {
     for (int i = 0; i < searchCounter; i++)
     {
         int min = Rnd.Next(100);
         int max = Rnd.Next(5000, 10000);
         company.SearchInPriceRange(min, max);
     }
 }
        private Company.Company CreateTestCompany()
        {
            var company = new Company.Company();

            company.AddWorker(new Employee("Erna Solberg", "CEO", 100000));
            company.AddWorker(new Consultant("Bjarne Håkon Hanssen", "First House", 80000));
            company.AddWorker(new Employee("Siv Jensen", "CFO", 70000));
            return(company);
        }
 private static void AddProducts(Company store, int numOfProductsToAdd = 500000)
 {
     for (int i = 0; i < numOfProductsToAdd; i++)
     {
         string title = Rnd.Next(int.MaxValue).ToString();
         string vendor = title + i;
         decimal price = Rnd.Next(20000) / 100;
         decimal barcode = Rnd.Next(1000000, int.MaxValue) * 2;
         store.AddProduct(new Article(title, vendor, price, barcode));
     }
 }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            var emps = new List <Employee>();

            emps.Add(new FullTimeEmployee("Gerard", 15256.56));
            emps.Add(new PartTimeEmployee("Piotr", 150.5, 150));
            emps.Add(new PartTimeEmployee("Hovie", 202, 150));

            var managementAS = new Company.Company();

            emps.ForEach((emp) => managementAS.EmployNewEmployee(emp));

            Console.WriteLine(managementAS.GetMonthlySalaryTotal());
            Console.WriteLine(managementAS.GetMonthlySalaryTotalLinq());
        }
        public static void Main()
        {
            var store = new Company();

            Console.WriteLine("Adding 500 000 articles...");
            Sw.Start();
            AddProducts(store);
            Sw.Stop();

            Console.WriteLine("Elapsed time: {0}", Sw.Elapsed);
            Console.WriteLine("-------------------------------");

            Console.WriteLine("Searching 10 000 000 products in given range....");
            Sw.Restart();
            SearchArticles(store);
            Sw.Stop();

            Console.WriteLine("Elapsed time: {0}", Sw.Elapsed);
        }