private void add_Click(object sender, EventArgs e)
        {
            //we take the project from the parent of the button, to add it in our list of projects
            Button         btnAdd  = (Button)sender;
            AfficheProject affiche = (AfficheProject)btnAdd.Parent;
            Project        project = affiche.project;

            parent.add(project);
        }
示例#2
0
        private void remove(object sender, EventArgs e)
        {
            projectSelected = null;
            Button         btnAdd  = (Button)sender;
            AfficheProject affiche = (AfficheProject)btnAdd.Parent;
            Project        project = affiche.Project;

            foreach (Employee employee in project.EmployeeAssigned)
            {
                employee.removeProject(project);
            }
            this.company.ListProjects.Remove(project);
            affiche.Hide();
            this.pnlList.Controls.Remove(affiche);
            this.refresh();
        }
示例#3
0
        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);
            }
        }
示例#4
0
        public ListAddProject(ListProjects listProjects)
        {
            this.listProjects = listProjects;
            this.listProjects.game.storyGoOn += storyShow;
            this.listProjects.game.loseGame  += loseGame;
            InitializeComponent();
            this.BackgroundImage = listProjects.BackgroundImage;
            int i = 0;

            //We draw the projects which are proposed
            foreach (Project project in listProjects.ListProject)
            {
                AfficheProject afficheProject = new AfficheProject(false, project, this);
                afficheProject.Location = new Point(0, i * 155);
                afficheProject.TopLevel = false;
                i++;
                afficheProject.Show();
                this.pnList.Controls.Add(afficheProject);
            }
            pnList.Size = new Size(370, 300);
        }
示例#5
0
 public void DrawListProjects(List <Project> listProjects)
 {
     if (listProjects.Count() != 0)
     {
         int i = 0;
         //draw the list of projects
         foreach (Project project in listProjects)
         {
             AfficheProject afficheProject = new AfficheProject(true, project);
             afficheProject.TopLevel = false;
             afficheProject.Location = new Point(0, i * 155);
             i++;
             afficheProject.Show();
             Button btnDelete = afficheProject.getButtonDelete();
             btnDelete.Click += new EventHandler(remove);
             Button btnEmployee = afficheProject.getButtonAssignedEmployee();
             btnEmployee.Click += new EventHandler(showEmployees);
             this.pnlList.Controls.Add(afficheProject);
         }
         pnlList.Size = new Size(315, 300);
     }
 }