Beispiel #1
0
        private void addEmployee_Click(object sender, EventArgs e)
        {
            Button          btnAdd   = (Button)sender;
            AfficheEmployee affiche  = (AfficheEmployee)btnAdd.Parent;
            Employee        employee = affiche.employee;

            parent.add(employee);
        }
Beispiel #2
0
        private void remove(object sender, EventArgs e)
        {
            Button          btnAdd   = (Button)sender;
            AfficheEmployee affiche  = (AfficheEmployee)btnAdd.Parent;
            Employee        employee = affiche.Employee;

            foreach (Project project in employee.ProjectAssigned)
            {
                project.removeEmployee(employee);
            }
            this.company.ListEmployee.Remove(employee);
            affiche.Hide();
            this.pnlEmployees.Controls.Remove(affiche);
            this.refresh();
        }
        private void showEmployees(object sender, EventArgs e)
        {
            Button         buttonClicked          = (Button)sender;
            AfficheProject afficheProjectSelected = (AfficheProject)buttonClicked.Parent;
            Boolean        isAlreadySelected      = false;

            projectSelected = null;

            //To know is the project has already selected or not
            if (afficheProjectSelected.getNameProject().BackColor == Color.Gray)
            {
                isAlreadySelected = true;
            }
            //We deselect all the project and so clear ListEmployees to visually have any project selected
            foreach (AfficheProject afficheProject in this.pnlList.Controls)
            {
                afficheProject.getNameProject().BackColor = Color.White;
            }
            pnlListEmployees.Controls.Clear();

            //If the project has never selected, we create the employees in the ListEmployees
            if (!isAlreadySelected)
            {
                afficheProjectSelected.getNameProject().BackColor = Color.Gray;
                projectSelected = afficheProjectSelected.Project;
                int i = 0;
                foreach (Employee employee in company.ListEmployee)
                {
                    AfficheEmployee afficheEmployee          = new AfficheEmployee(2, employee);
                    afficheEmployee.getButtonSelect().Click += new EventHandler(select);
                    afficheEmployee.TopLevel = false;
                    afficheEmployee.Location = new Point(0, i * 100);
                    i++;
                    afficheEmployee.Show();
                    Button btnDelete = afficheEmployee.getButtonDelete();
                    btnDelete.Click += new EventHandler(remove);
                    if (projectSelected.EmployeeAssigned.Contains(employee))
                    {
                        afficheEmployee.getButtonSelect().Checked = true;
                    }
                    this.pnlListEmployees.Controls.Add(afficheEmployee);
                }
                pnlListEmployees.Size = new Size(300, 300);
            }
        }
Beispiel #4
0
        private void showFormations(object sender, EventArgs e)
        {
            Button          buttonSelected          = (Button)sender;
            AfficheEmployee afficheEmployeeSelected = (AfficheEmployee)buttonSelected.Parent;

            if (employeeSelected != afficheEmployeeSelected.Employee)
            {
                pnlFormations.Show();
                employeeSelected = afficheEmployeeSelected.Employee;
                afficheEmployeeSelected.getLabelName().BackColor = Color.Gray;
            }
            else
            {
                afficheEmployeeSelected.getLabelName().BackColor = Color.White;
                pnlFormations.Hide();
                employeeSelected = null;
            }
        }
Beispiel #5
0
        public void DrawListEmployee(List <Employee> listEmployee)
        {
            int i = 0;

            //Show the employees
            foreach (Employee employee in listEmployee)
            {
                AfficheEmployee afficheEmployee = new AfficheEmployee(1, employee);
                afficheEmployee.TopLevel = false;
                afficheEmployee.Location = new Point(0, i * 100);
                i++;
                afficheEmployee.Show();
                Button btnDelete = afficheEmployee.getButtonDelete();
                btnDelete.Click += new EventHandler(remove);
                Button btnShowFormations = afficheEmployee.getButtonFormation();
                btnShowFormations.Click += new EventHandler(showFormations);
                this.pnlEmployees.Controls.Add(afficheEmployee);
            }
            pnlEmployees.Size = new Size(300, 300);
        }
Beispiel #6
0
        public ListAddEmployee(ListEmployees listEmployees)
        {
            this.listEmployees = listEmployees;
            this.listEmployees.game.storyGoOn += storyShow;
            listEmployees.game.loseGame       += loseGame;
            InitializeComponent();
            this.BackgroundImage = listEmployees.BackgroundImage;
            int i = 0;

            //Draw the list of the candidates
            foreach (Employee employee in listEmployees.ListPerson)
            {
                AfficheEmployee afficheEmployee = new AfficheEmployee(0, employee, this);
                afficheEmployee.TopLevel = false;
                afficheEmployee.Location = new Point(0, i * 100);
                i++;
                afficheEmployee.Show();
                this.pnlList.Controls.Add(afficheEmployee);
            }
            pnlList.Size = new Size(300, 300);
        }
        private void select(object sender, EventArgs e)
        {
            CheckBox        checkAssigned   = (CheckBox)sender;
            AfficheEmployee afficheEmployee = (AfficheEmployee)checkAssigned.Parent;

            if (checkAssigned.Checked)
            {
                if (projectSelected.Level <= afficheEmployee.Employee.Level)
                {
                    projectSelected.addEmployee(afficheEmployee.Employee);
                    afficheEmployee.Employee.addProject(projectSelected);
                }
                else
                {
                    afficheEmployee.getButtonSelect().Checked = false;
                    afficheEmployee.getButtonSelect().Text    = "level insufficient";
                }
            }
            else
            {
                projectSelected.removeEmployee(afficheEmployee.Employee);
                afficheEmployee.Employee.removeProject(projectSelected);
            }
        }