示例#1
0
        static void Main(string[] args)
        {
            Sale firstSale = new Sale("Ime", new DateTime(2011-11-11), 1222m);
            Sale secondSale = new Sale("Saleee", new DateTime(2012 - 12 - 12), 200.2m);

            Project project1 = new Project("HomePro", new DateTime(2012 - 01 - 01), "some details");
            Project project2 = new Project("ProProject", new DateTime(2002 - 02 - 02), "project detils here");
            project2.CloseProject();

            Manager manager1 = new Manager("12345", "Marco", "Polo", Departament.Sales, 1000.1m);
            Manager manager2 = new Manager("00001", "Manager2", "Manager2 Last name", Departament.Accounting, 123m);

            SalesEmployee saler1 = new SalesEmployee("99999", "Prodavach", "Prodavalnik", 12.34m, Departament.Sales);
            SalesEmployee saler2 = new SalesEmployee("88889", "Pazar", "Seller", 4321m, Departament.Sales);
            SalesEmployee saler3 = new SalesEmployee("88988", "Best", "Sellerman", 432.1m, Departament.Sales);

            Developer developer1 = new Developer("12321", "Razrabotchik", "Codov", 999.9m, Departament.Production);
            Developer developer2 = new Developer("32123", "Kolyo", "Hakera", 999.9m, Departament.Production);
            Developer developer3 = new Developer("32123", "Cody-Mnogo", "Harchi-Malko", 111.111m, Departament.Production);

            manager1.AddEmployee(saler1);
            manager1.AddEmployee(saler3);
            manager1.AddEmployee(developer2);

            manager2.AddEmployee(developer1);
            manager2.AddEmployee(developer3);
            manager2.AddEmployee(saler2);

            saler1.AddSale(firstSale);
            saler2.AddSale(secondSale);

            developer1.AddProject(project1);
            developer2.AddProject(project2);

            IList<Employee> employees = new List<Employee>
            {
                manager1,
                manager2,
                saler1,
                saler2,
                saler3,
                developer1,
                developer2,
                developer3
            };

            foreach (var employee in employees)
            {
                Console.WriteLine(employee);
                Console.WriteLine();
            }

            Customer customer1 = new Customer("00000", "Mnogo", "Para");
            customer1.BueProduct(firstSale);
            customer1.BueProduct(secondSale);

            Console.WriteLine(customer1.NetPurchaseAmount);
        }
        static void Main()
        {
            List <Sale> sales1 = new List <Sale>
            {
                new Sale("Coffee", new DateTime(2015, 11, 26), 5.34m),
                new Sale("Tea", new DateTime(2015, 10, 13), 2.34m),
                new Sale("Beer", new DateTime(2015, 11, 25), 3.79m)
            };
            List <Sale> sales2 = new List <Sale>
            {
                new Sale("Tomatoes", new DateTime(2015, 2, 28), 9.20m),
                new Sale("Meat", new DateTime(2015, 3, 13), 4.00m),
                new Sale("Onions", new DateTime(2015, 10, 5), 7.66m)
            };

            List <Project> projects1 = new List <Project>
            {
                new Project("ASP MVC", null, "SoftUni", State.Closed),
                new Project("PHP MVC", new DateTime(2015, 10, 30), "SoftUni shit", State.Open),
                new Project("Databases", new DateTime(2015, 07, 20), "Exam", State.Closed),
            };
            List <Project> projects2 = new List <Project>
            {
                new Project("HouseOne", new DateTime(2015, 10, 13), "Polu", State.Open),
                new Project("Hotel", new DateTime(2014, 11, 11), "Drqn", State.Open),
                new Project("Vacation Village", new DateTime(2014, 10, 25), "Expencive project", State.Open),
            };

            SalesEmployee qze  = new SalesEmployee(01, "Stef", "Petrov", 780.50m, Department.Sales, sales1);
            SalesEmployee tize = new SalesEmployee(02, "Dan", "Florev", 1100.90m, Department.Sales, sales2);

            Developer minka  = new Developer(03, "Mariq", "Dimitrova", 1500m, Department.Production, projects1);
            Developer chichi = new Developer(04, "Sisa", "Zarkova", 1499.99m, Department.Production, projects2);

            Manager mitko = new Manager(05, "Dimitar", "Peshev", 2345.67m, Department.Sales, new List <Employee> {
                qze, tize
            });
            Manager gencho = new Manager(06, "Gencho", "Yankov", 3456.78m, Department.Production, new List <Employee> {
                minka, chichi
            });

            List <Employee> empoyees = new List <Employee> {
                qze, tize, minka, gencho, mitko, gencho
            };

            foreach (var e in empoyees)
            {
                Console.WriteLine(e);
                Console.WriteLine();
            }

            var customer = new Customer(2, "Mitko", "Mitkov", 500);

            Console.WriteLine(customer);
        }