예제 #1
0
        static void Main()
        {
            Sale phone = new Sale("XTC Galaxy One X mini Z X Y 2", new DateTime(2014, 12, 02), 850);
            Sale laptop = new Sale("Toshicer", new DateTime(2013, 03, 04), 1250);
            Sale graphicsCard = new Sale("nAti", new DateTime(2014, 11, 11), 450);
            Sale bike = new Sale("BMCross", new DateTime(2014, 12, 12), 650);
            Sale dumbbells = new Sale("Smart bells", new DateTime(2011, 05, 27), 50);

            List<Sale> electronics = new List<Sale>();
            electronics.Add(phone);
            electronics.Add(laptop);
            electronics.Add(graphicsCard);

            List<Sale> sports = new List<Sale>();
            sports.Add(bike);
            sports.Add(dumbbells);

            SalesEmployee maria = new SalesEmployee("012", "Maria", "Crow", 3400, Department.Accounting, electronics);
            SalesEmployee david = new SalesEmployee("013", "David", "Stevens", 3900, Department.Sales, sports);

            List<Employee> salesExperts = new List<Employee>();
            salesExperts.Add(maria);
            salesExperts.Add(david);

            Manager george = new Manager("005", "George", "Simmons", 5000, Department.Marketing, salesExperts);

            Project companyMobileApp = new Project("Company Mobile App", new DateTime(2014, 04, 03), State.Closed);
            Project antiHackingTool = new Project("Anti Hacking Tool", new DateTime(2014, 12, 03), State.Open);

            List<Project> importantProjects = new List<Project>();
            importantProjects.Add(antiHackingTool);
            importantProjects.Add(companyMobileApp);

            Developer mikey = new Developer("004", "Mikey", "Peters", 7000, Department.Production, importantProjects);

            List<Employee> employees = new List<Employee>();
            employees.Add(maria);
            employees.Add(david);
            employees.Add(george);
            employees.Add(mikey);

            foreach (var employee in employees)
            {
                Console.WriteLine(employee);
            }
        }
예제 #2
0
 static void Main()
 {
     Sale saleOne = new Sale("Karburator", new DateTime(1998, 05, 15), 212.00m);
     Sale saleTwo = new Sale("Telefon", new DateTime(2012, 11, 02), 999.99m);
     List<Sale> salesOne = new List<Sale>();
     salesOne.Add(saleOne);
     salesOne.Add(saleTwo);
     Sale saleThree = new Sale("Klimatik", new DateTime(2007, 05, 20), 1999.99m);
     Sale saleFour = new Sale("Futbolna topka", new DateTime(2014, 06, 15), 22.00m);
     List<Sale> salesTwo = new List<Sale>();
     salesTwo.Add(saleThree);
     salesTwo.Add(saleFour);
     RegularEmployee regularEmployeeOne = new SalesEmployee(1, "Kiro", "Blagoev", 500.35m, "Accounting", salesOne);
     RegularEmployee regularEmployeeTwo = new SalesEmployee(2, "Dechko", "Bagdatiev", 573.22m, "Marketing", salesTwo);
     List<Employee> employeesOne = new List<Employee>();
     employeesOne.Add(regularEmployeeOne);
     employeesOne.Add(regularEmployeeTwo);
     Manager managerOne = new Manager(1, "Vilislava", "Karamartinova", 650.50m, "Marketing", employeesOne);
     Project projectOne = new Project("FIFA", new DateTime(1995, 05, 21), "Footbal Game", State.Open);
     Project projectTwo = new Project("League Of Legends", new DateTime(2008, 09, 13), "Multiplayer Game", State.Closed);
     List<Project> projectsOne = new List<Project>();
     projectsOne.Add(projectOne);
     projectsOne.Add(projectTwo);
     Project projectThree = new Project("Chess", new DateTime(222, 12, 14), "Board Game", State.Closed);
     Project projectFour = new Project("Belot", new DateTime(1312, 09, 04), "Card Game", State.Open);
     List<Project> projectsTwo = new List<Project>();
     projectsTwo.Add(projectThree);
     projectsTwo.Add(projectFour);
     RegularEmployee regularEmployeeThree = new Developer(3, "Ioncho", "Draskov", 1500.00m, "Production", projectsOne);
     RegularEmployee regularEmployeeFour = new Developer(4, "Dobri", "Mileshkov", 1300.00m, "Production", projectsTwo);
     List<Employee> employeesTwo = new List<Employee>();
     employeesTwo.Add(regularEmployeeThree);
     employeesTwo.Add(regularEmployeeFour);
     Manager managerTwo = new Manager(2, "Ioana", "Velikova", 505.03m, "Production", employeesTwo);
     List<Person> people = new List<Person>();
     people.Add(regularEmployeeOne);
     people.Add(regularEmployeeTwo);
     people.Add(regularEmployeeThree);
     people.Add(regularEmployeeFour);
     people.Add(managerOne);
     people.Add(managerTwo);
     foreach (var person in people)
     {
         Console.WriteLine(person);
     }
 }
예제 #3
0
        static void Main()
        {
            Sale dairy = new Sale("Milk", new DateTime(2014, 10, 1), 2.50m);
            Sale chocolate = new Sale("Chocolate", new DateTime(2014, 10, 1), 1.80m);
            Sale meat = new Sale("Meat", new DateTime(2014, 10, 1), 4.80m);
            Sale vegitables = new Sale("Vegitables", new DateTime(2014, 10, 1), 3.80m);
            Sale books = new Sale("C# Programming", new DateTime(2014, 10, 2), 9.90m);
            Sale laptop = new Sale("Toshiba Satelite", new DateTime(2014, 10, 2), 999.90m);
            Sale beer = new Sale("Stolichno tymno", new DateTime(2014, 10, 3), 1.75m);
            Sale whiskey = new Sale("Jameson", new DateTime(2014, 10, 3), 29.50m);

            var foodSales = new HashSet<Sale>();
            foodSales.Add(dairy);
            foodSales.Add(chocolate);
            foodSales.Add(meat);
            foodSales.Add(vegitables);

            var otherSales = new HashSet<Sale>();
            otherSales.Add(books);
            otherSales.Add(laptop);
            otherSales.Add(beer);
            otherSales.Add(whiskey);

            Project CSharp = new Project("Accounting system", new DateTime(2014, 9, 15), "N/A");
            Project Java = new Project("Booking system", new DateTime(2014, 5, 13), "N/A");
            Project PHP = new Project("Database Center", new DateTime(2014, 8, 20), "N/A");
            Project JavaScript = new Project("On-line games", new DateTime(2014, 7, 28), "N/A");
            Project HTML_CSS = new Project("A fancy web-site", new DateTime(2014, 8, 8), "N/A");

            var webPoejcts = new HashSet<Project>();
            webPoejcts.Add(HTML_CSS);
            webPoejcts.Add(JavaScript);
            webPoejcts.Add(Java);

            var otherProjects = new HashSet<Project>();
            otherProjects.Add(CSharp);
            otherProjects.Add(PHP);

            RegularEmployee foodSalesEmployee = new SalesEmployee(100, "Ivan", "Ivanov", 1000, Department.Sales, foodSales);
            RegularEmployee othersSalesEmployee = new SalesEmployee(97, "Dragan", "Peshev", 1400, Department.Sales, otherSales);

            RegularEmployee webDeveloper = new Developer(333, "Maria", "Mainova", 1800, Department.Marketing, webPoejcts);
            RegularEmployee appDevelooper = new Developer(666, "Gosho", "Topciev", 2800, Department.Production, otherProjects);

            var otherEmployees = new HashSet<Employee>();
            otherEmployees.Add(foodSalesEmployee);
            otherEmployees.Add(othersSalesEmployee);

            var programmerEmployees = new HashSet<Employee>();
            programmerEmployees.Add(webDeveloper);
            programmerEmployees.Add(appDevelooper);

            Employee programmingManager = new Manager(1, "Muncho", "Gunchev", 5000, Department.Sales, programmerEmployees);
            Employee accountingManager = new Manager(2, "Iskra", "Gringo", 4000, Department.Accounting, otherEmployees);

            var managers = new List<Person>();
            managers.Add(programmingManager);
            managers.Add(accountingManager);

            foreach (var manager in managers)
            {
                Console.WriteLine(manager);
            }
        }
예제 #4
0
        static void Main()
        {
            var rnd     = new Random();
            int counter = 4;

            var sales    = new HashSet <Sale>();
            var projects = new HashSet <Project>();

            var employees      = new HashSet <Employee>();
            var salesEmployees = new HashSet <Employee>();

            var customers = new HashSet <Customer>();

            for (int i = 0; i < 4; i++)
            {
                var sale = new Sale("Product" + i, rnd.Next(0, 200000));
                sales.Add(sale);
            }

            for (int i = 0; i < 4; i++)
            {
                var project = new Project("Project" + i, DateTime.Now);
                projects.Add(project);
            }

            do
            {
                var customer = new Customer(rnd.Next(1, 99),
                                            firstNames[rnd.Next(0, firstNames.Length)],
                                            lastNames[rnd.Next(0, lastNames.Length)],
                                            rnd.Next(0, 200000)
                                            );

                customers.Add(customer);
            } while (counter > customers.Count());

            counter = 8;

            do
            {
                var seller = new SalesEmployee(rnd.Next(3, 99),
                                               firstNames[rnd.Next(0, firstNames.Length)],
                                               lastNames[rnd.Next(0, lastNames.Length)],
                                               sales.ToList().GetRange(0, sales.Count)
                                               );

                salesEmployees.Add(seller);
            } while (counter > salesEmployees.Count());

            var developer = new Developer(3, "Peter", "Zlatanov", projects);

            var manager1 = new Manager(2, "Iliq", "Petrov");
            var manager2 = new Manager(1, "Mariq", "Petkova", developer, manager1);

            manager2.AddManagedEmployees(salesEmployees);

            employees.Add(manager1);
            employees.Add(manager2);
            employees.Add(developer);
            employees.UnionWith(salesEmployees);

            //Console.WriteLine("All employees: \n");
            //employees.ToList().ForEach(Console.WriteLine);

            var persons = new List <Person>();

            persons.AddRange(employees);
            persons.AddRange(customers);

            Console.WriteLine("All persons: \n");
            persons.ForEach(Console.WriteLine);
        }
예제 #5
0
        static void Main()
        {
            var rnd = new Random();
            int counter = 4;

            var sales = new HashSet<Sale>();
            var projects = new HashSet<Project>();

            var employees = new HashSet<Employee>();
            var salesEmployees = new HashSet<Employee>();

            var customers = new HashSet<Customer>();

            for (int i = 0; i < 4; i++)
            {
                var sale = new Sale("Product" + i, rnd.Next(0, 200000));
                sales.Add(sale);
            }

            for (int i = 0; i < 4; i++)
            {
                var project = new Project("Project" + i, DateTime.Now);
                projects.Add(project);
            }

            do
            {
                var customer = new Customer(rnd.Next(1, 99),
                                firstNames[rnd.Next(0, firstNames.Length)],
                                lastNames[rnd.Next(0, lastNames.Length)],
                                rnd.Next(0, 200000)
                            );

                customers.Add(customer);
            } while (counter > customers.Count());

            counter = 8;

            do
            {
                var seller = new SalesEmployee(rnd.Next(3, 99),
                                firstNames[rnd.Next(0, firstNames.Length)],
                                lastNames[rnd.Next(0, lastNames.Length)],
                                sales.ToList().GetRange(0, sales.Count)
                            );

                salesEmployees.Add(seller);
            } while (counter > salesEmployees.Count());

            var developer = new Developer(3, "Peter", "Zlatanov", projects);

            var manager1 = new Manager(2, "Iliq", "Petrov");
            var manager2 = new Manager(1, "Mariq", "Petkova", developer, manager1);
            manager2.AddManagedEmployees(salesEmployees);

            employees.Add(manager1);
            employees.Add(manager2);
            employees.Add(developer);
            employees.UnionWith(salesEmployees);

            //Console.WriteLine("All employees: \n");
            //employees.ToList().ForEach(Console.WriteLine);

            var persons = new List<Person>();
            persons.AddRange(employees);
            persons.AddRange(customers);

            Console.WriteLine("All persons: \n");
            persons.ForEach(Console.WriteLine);
        }