Esempio n. 1
0
        public static Company GetCompany(int companyKey)
        {
            if (_companies.ContainsKey(companyKey))
            {
                return(_companies[companyKey]);
            }

            Company company;

            switch (companyKey)
            {
            case 1:
                company = new SoftwareCompany();
                break;

            case 2:
                company = new FoodCompany();
                break;

            default:
                throw new Exception("Key not found");
            }

            _companies.Add(companyKey, company);

            return(company);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            SoftwareCompany company = new SoftwareCompany();

            FirstDepartment  firstDepartment  = new FirstDepartment(company);
            SecondDepartment secondDepartment = new SecondDepartment(company);
            ThirdDepartment  thirdDepartment  = new ThirdDepartment(company);

            company.setAssignment(7, "Task 1 of the day ", "1/6/2016");
            Console.Out.WriteLine("\n");
            company.setAssignment(5, "Task 2 of the day", "1/7/2016");
            Console.Out.WriteLine("\n");
            company.setAssignment(8, "Task 3 of the day", "17/7/2016");
        }
        static void Main(string[] args)
        {
            SoftwareCompany company = new SoftwareCompany();

            FirstDepartment firstDepartment = new FirstDepartment(company);
            SecondDepartment secondDepartment = new SecondDepartment(company);
            ThirdDepartment thirdDepartment = new ThirdDepartment(company);

            company.setAssignment(7, "Task 1 of the day ", "1/6/2016");
            Console.Out.WriteLine("\n");
            company.setAssignment(5, "Task 2 of the day", "1/7/2016");
            Console.Out.WriteLine("\n");
            company.setAssignment(8, "Task 3 of the day", "17/7/2016");
        }
 public SecondDepartment(SoftwareCompany company)
 {
     this.company = company;
     company.registerObserver(this);
 }