コード例 #1
0
        static void Main(string[] args)
        {
            SalesEmployee saler = new SalesEmployee(123145, "Joro", "Petrov", 120.20m, DepartmentType.Production);

            saler.AddSale(new Sale("Liutenica", DateTime.Parse("12.12.2015"), 2.20m));

            Customer kakaMinka      = new Customer(15651513, "Kaka", "Minka", 5000);
            Customer pepiMotichkata = new Customer(67654654, "Pepi", "Motichkata", 3000);
            Manager  theBoss        = new Manager(156136, "Chicho", "Gosho", 10000, DepartmentType.Marketing);

            Developer dev            = new Developer(333, "Bai", "Stavri", 101010, DepartmentType.Accounting);
            var       projectAmazon  = new Project("Amazon", null, null, true);
            var       projectSoftUni = new Project("SoftUni", DateTime.Now, "....", true);

            dev.Projects.Add(projectAmazon);


            List <Person> people = new List <Person>();

            people.Add(kakaMinka);
            people.Add(pepiMotichkata);
            people.Add(theBoss);


            foreach (Person per in people)
            {
                Console.WriteLine("ID: {0}\nFirst name: {1}\nLast name: {2}", per.Id,
                                  per.FirstName, per.LastName);
                Console.WriteLine("----------------------------");
            }
        }
コード例 #2
0
        public static void Main()
        {
            List <Sale> sales = new List <Sale>
            {
                new Sale("notebook", 20, DateTime.Now),
                new Sale("pen", 2, DateTime.Now)
            };

            SalesEmployee retailer = new SalesEmployee("Kiril", "Petrov", 2314763, Departments.Marketing, 900);

            retailer.AddSale(sales[0]);
            retailer.AddSale(sales[1]);

            var pesho = new Manager("Petur", "Asenov", 3874303, Departments.Accounting, 1200);
            var katya = new Developer("Katya", "Katerina", 5344363, Departments.Production, 2300);
            var ivan  = new SalesEmployee("Ivan", "Ivanov", 3429993, Departments.Accounting, 1300);

            var project = new Project("Code", DateTime.Now, ProjectState.Open);

            katya.AddProject(project);

            pesho.AddEmployee(retailer);
            pesho.AddEmployee(katya);
            pesho.AddEmployee(ivan);

            List <Employee> employees = new List <Employee>();

            employees.Add(retailer);
            employees.Add(pesho);
            employees.Add(katya);
            employees.Add(ivan);


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

            Console.WriteLine(new string('=', 10));

            foreach (var employee in pesho.EmployeesManaged)
            {
                Console.WriteLine(employee);
            }
        }
コード例 #3
0
        static void Main()
        {
            Employee employeeOne   = new Employee("Ivan", "Ivanov", "9004223664", 340.56, Department.Production);
            Employee employeeTwo   = new Employee("Hasan", "Hasanov", "9004223665", 390.56, Department.Sales);
            Employee employeeThree = new Employee("Stamat", "Georgiev", "9004223662", 1000, Department.Marketing);
            Employee employeeFour  = new Employee("Velin", "Angelov", "9004223660", 710.11, Department.Marketing);

            Manager managerOne = new Manager("Maria", "Angelova", "9405063102", 450.32, Department.Marketing);

            managerOne.AddSubordinate(employeeOne);
            managerOne.AddSubordinate(employeeTwo);
            Manager managerTwo = new Manager("Lidiq", "Nikolova", "9602010345", 500.02, Department.Sales);

            managerTwo.AddSubordinate(employeeThree);
            managerTwo.AddSubordinate(employeeFour);

            RegularEmployee regularEmployeeOne = new RegularEmployee("Maria", "Dimitrova", "0101032333", 400, Department.Marketing);

            SalesEmployee salesEmployeeOne = new SalesEmployee("Ivan", "Pehlivanov", "7808123344", 4322, Department.Sales);

            salesEmployeeOne.AddSale(new Sale("Milak", new DateTime(2015, 6, 17), 12));

            Developer developerOne = new Developer("Dimitur", "Dimitrov", "8909184560", 5000, Department.Accounting);

            developerOne.AddProject(new Project("SoftUni 2.0", new DateTime(2014, 12, 31), "", State.Open));

            Customer customerOne = new Customer("Nadejda", "Petrova", "6711117890", 450);

            Person[] companyArray = new Person[]
            {
                employeeOne, employeeTwo, employeeThree, employeeFour,
                managerOne, managerTwo,
                regularEmployeeOne,
                salesEmployeeOne,
                developerOne,
                customerOne,
            };

            for (int i = 0; i < companyArray.Length; i++)
            {
                Console.WriteLine("{0}.", i);
                Console.WriteLine(companyArray[i]);
            }
        }