コード例 #1
0
        static void Main(string[] args)
        {
            // Console.WriteLine("Hello World! this is LSP correct lib");

            //   Manager manager =new Manager();
            //   manager.FirstName="pamal";
            //   manager.LastName="sahan";
            //   manager.CalculatePerHourRate(4);

            //   Employee employee=new Employee();
            //   employee.FirstName="chamath";
            //   employee.LastName="deshan";
            //   employee.AssignManager(manager);
            //   employee.CalculatePerHourRate(2);

            //   Console.WriteLine($"{employee.FirstName}'s salary is ${employee.Salary}/hour");

            // LSPcorrect.model. Manager manager =new Manager();
            // manager.FirstName="pamal";
            // manager.LastName="sahan";
            // manager.CalculatePerHourRate(4);

            BaseEmployee employee = new CEO();

            employee.FirstName = "pamal";
            employee.LastName  = "sahan";
            employee.CalculatePerHourRate(4);

            Console.WriteLine($"{employee.FirstName}'s salary is ${employee.Salary}/hour");
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Employee dev1 = new Developer("Kiran");
            Employee dev2 = new Developer("Bhaskar");

            Employee manager = new Manager("Vaibhav");

            manager.AddEmployee(dev1);
            manager.AddEmployee(dev2);

            Employee director1 = new Director("Brian");

            director1.AddEmployee(manager);

            dev1 = new Developer("Viswa");
            dev2 = new Developer("Anil");

            manager = new Manager("Narasimha");
            manager.AddEmployee(dev1);
            manager.AddEmployee(dev2);

            Director director2 = new Director("Mike");

            director2.AddEmployee(manager);

            Employee ceo = new CEO();

            ceo.AddEmployee(director1);
            ceo.AddEmployee(director2);

            ceo.PerformanceReview();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Manager    bob  = new Manager("Bob", "Bobert", "Development department", 1200);
            Manager    rick = new Manager("Rick", "Rickert", "HR department", 1300);
            Contratcor mona = new Contratcor("Mona", "Monalisa", 20.5, 70, bob);
            Contratcor igor = new Contratcor("Igor", "Igorsky", 12.2, 80, rick);
            Sales      lea  = new Sales("Lea", "Leova");

            lea.AddSuccessRevenue(1800);

            Employee[] employees = new Employee[] { bob, rick, mona, igor, lea };

            Console.WriteLine($"{mona.GetInfo()} - salary: {mona.Salary}$ - department: {mona.CurrentPossition()}");

            Console.WriteLine("----------------");

            CEO ceo = new CEO("Ron", "Ronsky", employees, 1500, 140);

            ceo.AddSharesPrice(10);
            Console.WriteLine($"{ceo.GetInfo()} - salary: {ceo.Salary}");
            Console.WriteLine($"Salary of CEO is: {ceo.GetSalary()}");
            Console.WriteLine("Employees:");
            ceo.PrintEmployees();
            Console.ReadLine();
        }
コード例 #4
0
        public List <CEO> ListCEO()
        {
            string          connectionString = "server=localhost;database=broong;uid=root;pwd=cs1234;";
            MySqlConnection conn             = null;

            if (conn == null)
            {
                conn = new MySqlConnection(connectionString);
            }

            DataSet ds = new DataSet();

            string           sql  = "select * from CEO";
            MySqlDataAdapter adpt = new MySqlDataAdapter(sql, conn);

            adpt.Fill(ds, "CEO");


            foreach (DataRow CEO in ds.Tables[0].Rows)
            {
                CEO e = new CEO();

                e.Id           = CEO["Id"] as string;
                e.Password     = CEO["Passwd"] as string;
                e.StoreAddress = CEO["StoreAddress"] as string;
                e.StoreName    = CEO["StoreName"] as string;
                e.StoreNumber  = (int)CEO["StoreTelNumber"];
                e.CeoBalance   = (int)CEO["ceoBalance"];
                ceo.Add(e);
            }
            return(ceo);
        }
コード例 #5
0
        static void Main(string[] args)
        {
            Manager accountingVP = new Manager();

            accountingVP.FirstName = "Steve Aguilar";
            accountingVP.LastName  = "Stone";
            accountingVP.CalculatePerHourRate(4);

            IManager man  = new Manager();
            IManager man1 = new CEO();

            IEmployee man2 = new CEO();



            IManaged emp = new Manager();

            emp.FirstName = "Kenneth";
            emp.LastName  = "Aguilar";
            emp.AssignManager(accountingVP);
            emp.CalculatePerHourRate(2);

            Console.WriteLine($"{ emp.FirstName }'s salary is ${ emp.Salary }/hour.");

            Console.ReadLine();
        }
コード例 #6
0
        public int GetMaximumRegisteredProbesAmount()
        {
            var extension = ExtensionReader.GetExtensionByName(ExtensionNames.VISIBILITY_PROBE_USER);

            Debug.Assert(extension != null, "extension != null");
            return(10 + CEO.GetExtensionLevel(extension.id) * (int)extension.bonus);
        }
コード例 #7
0
        static void Main(string[] args)
        {
            Employee    employee      = new Employee("Bob", "Bobsky", Role.Other, 600);
            SalesPerson salesPerson   = new SalesPerson("Bill", "Billsky", 1500);
            Manager     manager       = new Manager("Elon", "Musk", 5000);
            Manager     managerTwo    = new Manager("Bil", "Gates", 5000);
            Contractor  contractor    = new Contractor("Steve", "Stevensky", 160, 15, manager);
            Contractor  contractorTwo = new Contractor("John", "Johnsky", 160, 30, manager);

            Employee[] company = { contractor, contractorTwo, manager, managerTwo, salesPerson };

            CEO RonCEO = new CEO("Ron", "Ronsky", company, 70, 20);

            RonCEO.PrintInfo();
            Console.WriteLine($"Salary of CEO is: {RonCEO.GetSalary()}");
            RonCEO.PrintEmployees();



            salesPerson.ExtendSuccessRevenue(2000);
            manager.AddBonus(4000);
            salesPerson.ExtendSuccessRevenue(3000);

            Console.WriteLine(employee.GetInfo());
            Console.WriteLine(salesPerson.GetInfo());
            Console.WriteLine(manager.GetInfo());


            Console.WriteLine($" \n Employee salary: {employee.GetSalary()}");
            Console.WriteLine($"SalesPerson salary: {salesPerson.GetSalary()}");
            Console.WriteLine($"Manager salary: {manager.GetSalary()}");
        }
コード例 #8
0
        static void Main(string[] args)
        {
            Manager john = new Manager("John", "Brown");
            Manager bryn = new Manager("Bryn", "Ward");

            john.AddBonus(600);
            Console.WriteLine(john.GetSalary());
            Console.WriteLine("-----------------");
            SalesPerson mike = new SalesPerson("Mike", "Smith");

            mike.ExtendSuccessRevenue(1300);
            Console.WriteLine(mike.GetSalary());
            Console.WriteLine("-----------------");
            Contractor tim   = new Contractor("Tim", "Jones", 160, 2.5, john);
            Contractor brook = new Contractor("Brook", "Hanks", 160, 2.5, john);

            Console.WriteLine(tim.GetSalary());
            Console.WriteLine("-----------------");
            Employee[] company =
            {
                brook, tim, bryn, john, mike
            };
            CEO luke = new CEO("Luke", "Redd", company);

            luke.AddSharesPrice(5);
            Console.WriteLine($"{luke.Role}:");
            luke.PrintInfo();
            Console.WriteLine($"Salary of {luke.Role} is {luke.GetSalary()}");
            luke.PrintEmployees();
            Console.ReadLine();
        }
コード例 #9
0
        public static void Main()
        {
            IManager peach = new CEO
            {
                FirstName = "Peach"
            };

            peach.CalculatePerHourRate(6);

            IManaged mario = new Manager
            {
                FirstName = "Mario"
            };

            mario.AssignManager(peach);
            mario.CalculatePerHourRate(4);

            Employee luigi = new Employee
            {
                FirstName = "Luigi"
            };

            luigi.AssignManager(mario);
            luigi.CalculatePerHourRate(2);

            Console.WriteLine($"{luigi.FirstName}'s salary is {luigi.Salary}/hour");
        }
コード例 #10
0
        static void Main(string[] args)
        {
            var leaveRequest1 = new LeaveRequest {
                Id = 1, Severity = 1, Subject = "Sick Leave", NoOfLeaves = 1, Approved = false
            };
            var leaveRequest2 = new LeaveRequest {
                Id = 1, Severity = 2, Subject = "Planned Leave", NoOfLeaves = 5, Approved = false
            };
            var leaveRequest3 = new LeaveRequest {
                Id = 1, Severity = 3, Subject = "Paternity Leave", NoOfLeaves = 10, Approved = false
            };
            var leaveRequest4 = new LeaveRequest {
                Id = 1, Severity = 4, Subject = "Sebbatical", NoOfLeaves = 100, Approved = false
            };

            var CEO = new CEO {
                Name = "CEO"
            };
            var president = new President {
                Name = "President", Next = CEO
            };
            var manager = new Manager {
                Name = "Manager", Next = president
            };

            manager.ProcessRequest(leaveRequest1);
            manager.ProcessRequest(leaveRequest2);
            manager.ProcessRequest(leaveRequest3);
            manager.ProcessRequest(leaveRequest4);
            Console.ReadKey();
        }
コード例 #11
0
        public static void Approve(ICategoria spesa)
        {
            var manager   = new Manager();
            var OpManager = new OperationalManager();
            var CEO       = new CEO();

            //concateno i livelli di approvazione
            manager.SetNext(OpManager).SetNext(CEO);


            List <ICategoria> spese = new List <ICategoria> {
            };

            //foreach (var import in spese)
            //{

            //    var approve = manager.Handle(import);

            //    if (approve != null)
            //    {
            //        //approvazione
            //    }
            //    else if (import > 2500)
            //    {
            //        Console.WriteLine($"La spesa non è stata approvata");
            //    }
            //    else
            //    {
            //        Console.WriteLine($"ERRORE");
            //    }
            //}
        }
コード例 #12
0
        static void Main(string[] args)
        {
            Contractor constractor1 = new Contractor()
            {
                FirstName = "Bob", LastName = "Bobert", Role = Role.Other
            };
            Contractor constractor2 = new Contractor()
            {
                FirstName = "Rick", LastName = "Rickert", Role = Role.Other
            };
            Manager     manager1   = new Manager("Mona", "Monalisa");
            Manager     manager2   = new Manager("Igor", "Igorsky");
            SalesPerson salePeson1 = new SalesPerson("Lea", "Leova");

            Employee[] Company = { constractor1, constractor2, manager1, manager2, salePeson1 };
            CEO        ceo1    = new CEO()
            {
                FirstName = "Ron", LastName = "Ronsky", Role = Role.Other, Shares = 300
            };

            ceo1.SetSalary(1500);
            ceo1.Employees = Company;
            Console.WriteLine("CEO: ");
            ceo1.PrintInfo();
            ceo1.AddSharesPrice(200);
            Console.WriteLine($"Salary of CEO  is: {ceo1.GetSalary()}");
            ceo1.PrintEmployees();
            //CurrentPosition
            //manager1.Dedepartment = "department1";
            //constractor1.Responsible = manager1;
            //constractor1.CurrentPosition();
            Console.ReadLine();
        }
コード例 #13
0
ファイル: Program.cs プロジェクト: SilviuOlariu/SOLID
        static void Main(string[] args)
        {
            IManager manager = new Manager()
            {
                FirstName = "Silviu",
                LastName  = "Olariu",
            };

            manager.CalculatePerHourRate(2);
            Console.WriteLine($"Manager salary is:{manager.Salary} ");

            IEmployee employee = new Employee()
            {
                FirstName = "Mirel",
                LastName  = "Radoi",
                Salary    = 1000
            };

            employee.AssignManager(manager);

            Console.WriteLine($"Radoi's manager is: {employee.Manager.FirstName}");

            ICEO cEO = new CEO();

            cEO.FireSomeone();
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: markonaumov/marko-naumov
        static void Main(string[] args)
        {
            Employee emp = new Employee()
            {
                FirstName = "Marko", LastName = "Naumov", Role = Role.Other
            };
            SalesPerson sp   = new SalesPerson("Bojan", "Sazdovski");
            Manager     mg   = new Manager("Damjan", "Temelko", 500);
            Employee    emp2 = new Employee()
            {
                FirstName = "Petko", LastName = "petkovski", Role = Role.Other
            };
            Employee emp3 = new Employee()
            {
                FirstName = "Stanko", LastName = "stankovski", Role = Role.Other
            };
            Contractor cont  = new Contractor("Ivan", "Ivanovski");
            Contractor cont2 = new Contractor("Stojan", "Stojanovski");
            Manager    mg2   = new Manager("Elena", "Stojanovska", 400);

            Employee[] company = { sp, mg, mg2, cont, cont2 };

            CEO ceo = new CEO("Steve", "Jobs", 500, company, 120);

            ceo.AddSharePrice(200);


            ceo.GetInfo();
            Console.WriteLine($"The salary of CEO is {ceo.GetSalary()}");
            ceo.PrintEmployees();
            Console.ReadLine();
        }
コード例 #15
0
ファイル: Program.cs プロジェクト: Vorsutus/LSP
        static void Main(string[] args)
        {
            //Manager accountingVP = new Manager();
            IManager accountingVP = new Manager(); //this would work with new CEO too because

            accountingVP.FirstName = "Emma";
            accountingVP.LastName  = "Stone";
            accountingVP.CalculatePerHourRate(4);

            Console.WriteLine($"{ accountingVP.FirstName }'s salary is ${ accountingVP.Salary }/hour.");

            //Employee emp = new Employee(); //this works so no VIOLATION of Liskov Sub
            //Employee emp = new Manager(); //This works so no VIOLATION of Liskov Sub
            //Employee emp = new CEO(); //This DOES NOT work so it violates Liskov Sub

            //this works for new Employee, new Manager, and new CEO because they all inherit from BaseEmployee
            BaseEmployee emp = new CEO();

            emp.FirstName = "Tim";
            emp.LastName  = "Corey";
            //emp.AssignManager(accountingVP);
            emp.CalculatePerHourRate(2);

            Console.WriteLine($"{ emp.FirstName }'s salary is ${ emp.Salary }/hour.");

            Console.ReadLine();
        }
コード例 #16
0
        public static void Test()
        {
            Employee manager = new Manager();

            manager.GetSalary();
            Employee ceo = new CEO();

            ceo.GetSalary();
        }
コード例 #17
0
ファイル: frmRegisterCeo.cs プロジェクト: japhet98/FMS
 public frmRegisterCeo(CEO ceo)
 {
     InitializeComponent();
     txtName.Text        = ceo.Name;
     txtPhone.Text       = ceo.Phone;
     txtUsername.Text    = ceo.Username;
     txtPassword.Text    = ceo.Password;
     btnRegister.Visible = false;
 }
コード例 #18
0
    static void Main()
    {
        // Create an instance of CEO, a class derived from the C# proxy of the
        // underlying C++ class. The calls to getName() and getPosition() are standard,
        // the call to getTitle() uses the director wrappers to call CEO.getPosition().

        CEO e = new CEO("Alice");

        Console.WriteLine(e.getName() + " is a " + e.getPosition());
        Console.WriteLine("Just call her \"" + e.getTitle() + "\"");
        Console.WriteLine("----------------------");

        // Create a new EmployeeList instance.  This class does not have a C++
        // director wrapper, but can be used freely with other classes that do.

        using (EmployeeList list = new EmployeeList()) {
            // EmployeeList owns its items, so we must surrender ownership of objects we add.
            e.disownMemory();
            list.addEmployee(e);
            Console.WriteLine("----------------------");

            // Now we access the first four items in list (three are C++ objects that
            // EmployeeList's constructor adds, the last is our CEO). The virtual
            // methods of all these instances are treated the same. For items 0, 1, and
            // 2, all methods resolve in C++. For item 3, our CEO, getTitle calls
            // getPosition which resolves in C#. The call to getPosition is
            // slightly different, however, because of the overidden getPosition() call, since
            // now the object reference has been "laundered" by passing through
            // EmployeeList as an Employee*. Previously, C# resolved the call
            // immediately in CEO, but now C# thinks the object is an instance of
            // class Employee. So the call passes through the
            // Employee proxy class and on to the C wrappers and C++ director,
            // eventually ending up back at the C# CEO implementation of getPosition().
            // The call to getTitle() for item 3 runs the C++ Employee::getTitle()
            // method, which in turn calls getPosition(). This virtual method call
            // passes down through the C++ director class to the C# implementation
            // in CEO. All this routing takes place transparently.

            Console.WriteLine("(position, title) for items 0-3:");

            Console.WriteLine("  " + list.get_item(0).getPosition() + ", \"" + list.get_item(0).getTitle() + "\"");
            Console.WriteLine("  " + list.get_item(1).getPosition() + ", \"" + list.get_item(1).getTitle() + "\"");
            Console.WriteLine("  " + list.get_item(2).getPosition() + ", \"" + list.get_item(2).getTitle() + "\"");
            Console.WriteLine("  " + list.get_item(3).getPosition() + ", \"" + list.get_item(3).getTitle() + "\"");
            Console.WriteLine("----------------------");

            // The using statement ensures the EmployeeList.Dispose() will be called, which will delete all the Employee*
            // items it contains. The last item is our CEO, which gets destroyed as well.
        }
        Console.WriteLine("----------------------");

        // All done.

        Console.WriteLine("C# exit");
    }
コード例 #19
0
ファイル: runme.cs プロジェクト: FeepingCreature/swig
  static void Main() 
  {
    // Create an instance of CEO, a class derived from the C# proxy of the 
    // underlying C++ class. The calls to getName() and getPosition() are standard,
    // the call to getTitle() uses the director wrappers to call CEO.getPosition().

    CEO e = new CEO("Alice");
    Console.WriteLine( e.getName() + " is a " + e.getPosition() );
    Console.WriteLine( "Just call her \"" + e.getTitle() + "\"" );
    Console.WriteLine( "----------------------" );

    // Create a new EmployeeList instance.  This class does not have a C++
    // director wrapper, but can be used freely with other classes that do.

    using (EmployeeList list = new EmployeeList()) {

    // EmployeeList owns its items, so we must surrender ownership of objects we add.
    e.disownMemory();
    list.addEmployee(e);
    Console.WriteLine( "----------------------" );

    // Now we access the first four items in list (three are C++ objects that
    // EmployeeList's constructor adds, the last is our CEO). The virtual
    // methods of all these instances are treated the same. For items 0, 1, and
    // 2, all methods resolve in C++. For item 3, our CEO, getTitle calls
    // getPosition which resolves in C#. The call to getPosition is
    // slightly different, however, because of the overridden getPosition() call, since
    // now the object reference has been "laundered" by passing through
    // EmployeeList as an Employee*. Previously, C# resolved the call
    // immediately in CEO, but now C# thinks the object is an instance of
    // class Employee. So the call passes through the
    // Employee proxy class and on to the C wrappers and C++ director,
    // eventually ending up back at the C# CEO implementation of getPosition().
    // The call to getTitle() for item 3 runs the C++ Employee::getTitle()
    // method, which in turn calls getPosition(). This virtual method call
    // passes down through the C++ director class to the C# implementation
    // in CEO. All this routing takes place transparently.

    Console.WriteLine( "(position, title) for items 0-3:" );

    Console.WriteLine( "  " + list.get_item(0).getPosition() + ", \"" + list.get_item(0).getTitle() + "\"" );
    Console.WriteLine( "  " + list.get_item(1).getPosition() + ", \"" + list.get_item(1).getTitle() + "\"" );
    Console.WriteLine( "  " + list.get_item(2).getPosition() + ", \"" + list.get_item(2).getTitle() + "\"" );
    Console.WriteLine( "  " + list.get_item(3).getPosition() + ", \"" + list.get_item(3).getTitle() + "\"" );
    Console.WriteLine( "----------------------" );

    // The using statement ensures the EmployeeList.Dispose() will be called, which will delete all the Employee*
    // items it contains. The last item is our CEO, which gets destroyed as well.
    }
    Console.WriteLine( "----------------------" );

    // All done.

    Console.WriteLine( "C# exit" );
  }
コード例 #20
0
        private static void MonoStateSingleonBizarreAlternative()
        {
            var ceo = new CEO();

            ceo.Name = "Adam Smith";
            ceo.Age  = 55;

            var ceo2 = new CEO();

            WriteLine(ceo2);
        }
コード例 #21
0
        static void Main(string[] args)
        {
            //Employee e = new Employee();
           // e.GiveBonus();
            Employee e1 = new Manager();
            e1.GiveBonus();
            Employee e2 = new CEO();
            e2.GiveBonus(); 
            carvan c=new Maheshbabucarvan();

        }
コード例 #22
0
 public override string Execute()
 {
     IOrganizationalUnit company = this.db.Companies.FirstOrDefault(c => c.Name == this.companyName);
     if (company == null)
     {
         throw new ArgumentException(
             string.Format("Company {0} does not exist", this.companyName));
     }
     ceo = (CEO)company.Head;
     PrintHierarchy(company, 0);
     return "";
 }
コード例 #23
0
        public void InheritanceExample()
        {
            var employee = new Employee(150);
            var manager  = new Manager(200);
            var ceo      = new CEO(300);

            var payrollProcessor = new PayrollProcessor();

            payrollProcessor.ProcessPayRollForEmployee(employee);
            payrollProcessor.ProcessPayRollForManager(manager);
            payrollProcessor.ProcessPayRollForCEO(ceo);
        }
コード例 #24
0
        private void LogInUser()
        {
            /// Check if CEO Login
            if (chkCeo.Checked == true)
            {
                var ceo = new CEO();
                ceo.CeoId    = 1;
                ceo.Name     = "John Mensah";
                ceo.Phone    = "0232332028";
                ceo.Username = "******";
                ceo.Password = "******";

                //Check if Login is succesfull
                if (checkLogin(ceo.Username, ceo.Password) == true)
                {
                    MessageBox.Show("Login Succesful");
                    var dashboard = new Form1("ceo", null, ceo);
                    this.Hide();
                    dashboard.Show();
                }
                else
                {
                    MessageBox.Show("Login Failed!! Invalid username or password ");
                }
            }

            else
            {
                var sec = new  Secretary();
                sec.SecretaryId = 1;
                sec.Name        = "Japhet Kuntu Blankson";
                sec.Phone       = "02452342433";
                sec.Residence   = "Elmina";
                sec.Username    = "******";
                sec.Password    = "******";

                //Check if Login is succesfull
                if (checkLogin(sec.Username, sec.Password) == true)
                {
                    MessageBox.Show("Login Succesful");
                    var dashboard = new Form1("secretary", sec, null);
                    this.Hide();
                    dashboard.Show();
                }
                else
                {
                    MessageBox.Show("Login Failed!! Invalid username or password ");
                }
            }

            txtusername.Text = "";
            txtpassword.Text = "";
        }
コード例 #25
0
        public override string Execute()
        {
            var company = this.db.Companies.FirstOrDefault(c => c.Name == this.companyName);

            if (company == null)
            {
                throw new ArgumentException(
                          string.Format("Company {0} does not exist", this.companyName));
            }
            this.ceo = (CEO)company.Head;
            this.Pay(company, 0, 0);
            return(this.output.ToString());
        }
コード例 #26
0
ファイル: CeoController.cs プロジェクト: japhet98/FMS
 public void DeleteCEO(CEO ceo)
 {
     ceo = _db.CEOs.FirstOrDefault(cust => cust.CeoId == ceo.CeoId);
     if (ceo != null)
     {
         _db.Entry(ceo).State = EntityState.Deleted;
         _db.SaveChanges();
     }
     else
     {
         throw new Exception("CEO Id cannot be found");
     }
 }
        public override string Execute()
        {
            IOrganizationalUnit company = this.db.Companies.FirstOrDefault(c => c.Name == this.companyName);

            if (company == null)
            {
                throw new ArgumentException(
                          string.Format("Company {0} does not exist", this.companyName));
            }
            ceo = (CEO)company.Head;
            PrintHierarchy(company, 0);
            return("");
        }
コード例 #28
0
ファイル: Program.cs プロジェクト: radmila177/Csharp-Basic
        static void Main(string[] args)
        {
            Employee[] company = new Employee[]
            {
                new Contractor("Bob", "Bobert"),
                new Contractor("Rick", "Rickert"),
                new Manager("Mona", "Monalisa"),
                new Manager("Igor", "Igorsky"),
                new SalesPerson("Lea", "Leova"),
            };

            CEO ceoName = new CEO("Ron", "Ronsky", company);

            Console.WriteLine("CEO:");
            ceoName.PrintInfo();
            ceoName.AddSharesPrice(1400);
            var getSalary = ceoName.GetSalary();

            Console.WriteLine($"Salary of CEO is:{getSalary}");
            ceoName.PrintEmployees(company);


            Console.WriteLine("------------------------------------------------");

            Manager manager = new Manager("Bob", "Bobsky");

            manager.PrintInfo();
            var bonusF = manager.AddBonus(1500);

            Console.WriteLine($"The bonus is: {bonusF}");
            var mSalary = manager.GetSalary();

            Console.WriteLine($"The salary with bonus is: {mSalary}");

            Console.WriteLine("------------------------------------------------");

            SalesPerson salesPer = new SalesPerson("Radmila", "Sokolovska");

            salesPer.PrintInfo();
            Console.WriteLine(salesPer.GetSalary());

            Console.WriteLine("------------------------------------------------");

            Contractor contractor = new Contractor("Petre", "Petreski");

            contractor.PrintInfo();
            Console.Write("Salary is: ");
            Console.WriteLine(contractor.GetSalary());

            Console.ReadLine();
        }
コード例 #29
0
        static void Main(string[] args)
        {
            Employee    employee    = new Employee("Bob", "Bobsky", Role.Others, 600);
            SalesPerson salesPerson = new SalesPerson("Bill", "Bilsky", 1500);
            Manager     manager     = new Manager("Elon", "Musk", 5000);

            salesPerson.ExtendSuccessRevenue(2000);
            manager.AddBonus(4000);
            salesPerson.ExtendSuccessRevenue(3000);

            Console.WriteLine(employee.GetInfo());
            Console.WriteLine(salesPerson.GetInfo());
            Console.WriteLine(manager.GetInfo());

            Console.WriteLine($"Employee salary: {employee.GetSalary()}");
            Console.WriteLine($"Sales person salary: {salesPerson.GetSalary()}");
            Console.WriteLine($"Manager salary: {manager.GetSalary()}");


            Contractor contractor = new Contractor("Greg", "Gregsky", 40, 50, manager);

            Console.WriteLine($"Contractor current manager: {contractor.CurrentManager()}");
            Console.WriteLine($"Manager salary: {contractor.GetSalary()}");



            Employee[] company = new Employee[5]
            {
                new Contractor("Bill", "Bilsky", 38, 55, manager),
                new Contractor("Mallory", "Monroe", 44, 60, manager),
                new Manager("Scot", "Scotsky", 1000),
                new Manager("Ben", "Bensky", 2000),
                new SalesPerson("Jill", "Jillsky", 1500)
            };

            CEO ceo = new CEO("Ron", "Ronsky", 1500, company);

            Console.WriteLine($"\n\nCEO: {ceo.GetInfo()}");
            Console.WriteLine("Employees: ");
            foreach (string employee1 in ceo.GetEmployees())
            {
                Console.WriteLine(employee1);
            }

            Console.WriteLine(ceo.GetSalary());

            ceo.SetShares(30);
            ceo.AddSharesPrice(500);

            Console.WriteLine($"CEO sallary with shares: {ceo.GetSalary()}");
        }
コード例 #30
0
        static void Main(string[] args)
        {
            Manager firstManager = new Manager("Dan", "Dan", 100);

            Manager secondManager = new Manager("Dan", "Dan", 100);

            Employee employee = new Employee("Dan", "Dan", 100);

            CEO ceo = new CEO("Dan", "Dan", 100);

            employee.AssignManager(secondManager);
            secondManager.AssignManager(firstManager);
            //ceo.AssignManager(firstManager);
        }
コード例 #31
0
        static void Main(string[] args)
        {
            Client   ha       = new Client(5);
            Employee employee = new Employee();
            TeamLead teamLead = new TeamLead();
            Manager  manager  = new Manager();
            CEO      ceo      = new CEO();

            employee.SetNext(teamLead).SetNext(manager).SetNext(ceo);
            var result = ha.CreateRequest(employee);

            Console.WriteLine(result);
            Console.ReadKey();
        }
コード例 #32
0
ファイル: Program.cs プロジェクト: rocker8942/AbstractAndNew
        static void Main(string[] args)
        {
            List<Employee> list = new List<Employee>();
            list.Add(new Manager());
            list.Add(new CEO());
            foreach (var e in list)
            {
                e.Draw();
            }

            CEO o = new CEO();
            o.Draw();

            Console.ReadLine();
        }
コード例 #33
0
        private string ExecuteCreateCompanyCommand(ICommand command)
        {
            var ceo = new CEO(command.Parameters[1], command.Parameters[2], decimal.Parse(command.Parameters[3]));

            this.database.TotalSalaries[ceo] = 0m;
            var company = new Company(command.Parameters[0], ceo);

            if (this.database.Companies.Any(c => c.Name == company.Name))
            {
                return(string.Format($"Company {company.Name} already exists"));
            }

            this.database.Companies.Add(company);
            return(null);
        }
コード例 #34
0
        public void CompositeGetAllInTreeView_CorrectData_ReturnTree()
        {
            var       service   = new Mock <IEmployeeService>();
            Composite composite = new Composite(service.Object);
            var       ceo       = new CEO {
                FirstName = "test1", LastName = "test1"
            };

            service.Setup(x => x.GetAll()).Returns(new List <EmployeeDTO> {
                ceo
            });

            var res = composite.GetAllInTreeView();

            Assert.AreEqual("CEO: test1 test1\n", res);
        }
コード例 #35
0
ファイル: Company.cs プロジェクト: zhf/EarningsPattern
 public Company()
 {
     AllProducts = new ProductList();// new List<Product>();
     AllProjects = new List<Project>();
     AllEmployees = new StaffList();
     CEO = new CEO();
     AllEmployees.Add(CEO);
     Accounting = new Accounting(1500000);
     Office = new Office();
     Office.PhysicalObjectsInOffice.Add(AllEmployees);
     //BusinessCycles.ProjectCreated += new ProjectCreatedEventHandler(BusinessCycles_ProjectCreated);
     Accounting.ProfitableItems.Add(AllProducts);
     Accounting.IndebtedItems.Add(AllEmployees);
     Accounting.IndebtedItems.Add(Office);
     Accounting.IndebtedItems.Add(AllProducts);
 }