示例#1
0
        public AfficheEmployee(int show, Employee employee, ListAddEmployee parent = null)
        {
            this.parent   = parent;
            this.employee = employee;
            InitializeComponent();

            //Initialize the text in the labels
            this.lbName.Text             = String.Format("{0} {1} ", employee.FirstName, employee.LastName);
            this.lbSalary.Text           = String.Format("{0}$ /month", employee.Salary);
            this.lbLevel.Text            = employee.Level.ToString();
            this.lbXp.Text               = String.Format("{0} xp /1000", employee.Experience);
            this.picture.BackgroundImage = employee.Portrait;

            //Initialize the buttons
            switch (show)
            {
            //cas0: the person is not an employee yet, we show only the button "Add"
            case 0:
                btAdd.Show(); btFire.Hide(); chkAssigned.Hide(); btForm.Hide();
                break;

            //cas1: the person is an employee, you can fire him or form him, so we show "Fire" and "Form" button
            case 1:
                btAdd.Hide(); btFire.Show(); chkAssigned.Hide(); btForm.Show();
                break;

            //cas2: the person is an employee, you can assigne him to a project, we show the "assigned" check
            case 2:
                btAdd.Hide(); btFire.Hide(); chkAssigned.Show(); btForm.Hide();
                break;
            }

            //event if the employee has his level updated
            this.employee.employeeUpdate += EmployeeUpdate;
        }
示例#2
0
        private void addEmployee_Click(object sender, EventArgs e)
        {
            int k = 0;

            while ((listPerson.Count + company.ListEmployee.Count < game.Company.LevelCompany * 2) && (k <= 13))
            {
                Employee person       = new Employee();
                bool     alreadyKnown = false;
                //Verification if the person is already a candidate (we have just 13 persons)
                foreach (Employee employee in listPerson)
                {
                    if ((person.FirstName == employee.FirstName) && (person.LastName == employee.LastName))
                    {
                        alreadyKnown = true;
                    }
                }

                //Verification if the person is already an employee
                foreach (Employee employee in company.ListEmployee)
                {
                    if ((person.FirstName == employee.FirstName) && (person.LastName == employee.LastName))
                    {
                        alreadyKnown = true;
                    }
                }
                //If he is not already known, we can add him in our list
                if (!alreadyKnown)
                {
                    listPerson.Add(person);
                }
                k++;
            }
            ListAddEmployee listAddEmployee = new ListAddEmployee(this);

            this.Hide();
            listAddEmployee.Show();
        }