Esempio n. 1
0
 // Refresh the form.
 private void RefreshForm()
 {
     pAssign = new PProjectAssign(this);
     projectNameBox.SelectedIndex = 0;
     projectList             = pAssign.AssignList();
     assignedList.DataSource = new BindingList <ProjectAssignData>(projectList.OrderBy(x => x.ProjectName).ToList());
 }
Esempio n. 2
0
        private void F201_ProjectAssign_Load(object sender, EventArgs e)
        {
            // Getting the necessary lists.
            pAssign     = new PProjectAssign(this);
            projectList = pAssign.AssignList();
            pNameList   = pAssign.GetProjects();
            // DataGridView Lists
            selectProjectList = pAssign.GetProjects();
            selectProjectList.RemoveAt(0);
            selectEmployeeList = pAssign.GetEmployeeDatas();
            selectRoleList     = pAssign.GetRoleDatas();
            // Setting Datasource for the combobox, DataGridView
            projectNameBox.DataSource    = pNameList;
            projectNameBox.DisplayMember = "ProjectName";
            dataProjectAssign.DataSource = assignedList;
            assignedList.DataSource      = new BindingList <ProjectAssignData>(projectList.OrderBy(x => x.ProjectName).ToList());

            // Setting some attributes for the DataGrid. Rename the columns.
            // Hide the ProjectName Column to replace with a combobox.
            dataProjectAssign.Columns["ProjectName"].Visible = false;
            ProjectCol.DataPropertyName  = "ProjectName";
            ProjectCol.DataSource        = selectProjectList;
            middleProjectBox.DataSource  = selectProjectList;
            middleProjectBox.ValueMember = "ProjectID";
            ProjectCol.DisplayMember     = "ProjectName";
            //ProjectCol.ValueMember = "ProjectID".ToString();
            //
            // Hide the EmployeeName column and replace with a combobox
            dataProjectAssign.Columns["EmployeeName"].Visible = false;
            EmployeeCol.DataPropertyName = "EmployeeName";
            EmployeeCol.DataSource       = selectEmployeeList;
            middleEmpBox.DataSource      = selectEmployeeList;
            middleEmpBox.ValueMember     = "EmployeeID";
            EmployeeCol.DisplayMember    = "EmployeeName";
            //EmployeeCol.ValueMember = "EmployeeID";
            //
            // Hide the Role column and replace with a combobox
            dataProjectAssign.Columns["Role"].Visible = false;
            RoleCol.DataPropertyName  = "Role";
            RoleCol.DataSource        = selectRoleList;
            middleRoleBox.DataSource  = selectRoleList;
            middleRoleBox.ValueMember = "RoleID";
            RoleCol.DisplayMember     = "RoleName";
            //RoleCol.ValueMember = "RoleID";
            //
            dataProjectAssign.Columns["StartDate"].HeaderText    = "Start Date";
            dataProjectAssign.Columns["EndDate"].HeaderText      = "End Date";
            dataProjectAssign.Columns["ProjectAssignID"].Visible = false;
            dataProjectAssign.Columns["ProjectID"].Visible       = false;
            dataProjectAssign.Columns["EmployeeID"].Visible      = false;
            dataProjectAssign.Columns["RoleID"].Visible          = false;

            // Setting autosize mode.
            EmployeeCol.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            ProjectCol.AutoSizeMode  = DataGridViewAutoSizeColumnMode.DisplayedCells;
        }