public void InitEmployee_Project() { picNew.Visible = false; picDelete.Visible = false; picUpdate.Visible = false; flagCbPartners = 0; // load lable AllProject lbAllProject.Visible = false; tbl_ProjectDAO projectDAO = new tbl_ProjectDAO(); projectDAO.GetAllProject(ref gvSmallList); // load lable company name tbl_CompanyDAO companyDAO = new tbl_CompanyDAO(); tbl_PartnerDAO partnerDAO = new tbl_PartnerDAO(); int companyId = partnerDAO.GetCompanyIdById(int.Parse(gvSmallList.CurrentRow.Cells[3].Value.ToString())); lbCompanyName.Text = companyDAO.GetNameById(companyId); // load partner infor int parnerId = int.Parse(gvSmallList.CurrentRow.Cells[3].Value.ToString()); DisplayPartnerInfor(parnerId); // display employees tbl_JoiningDAO joiningDAO = new tbl_JoiningDAO(); List <int> employeeIDs = joiningDAO.GetListEmIDByProjectId(int.Parse(gvSmallList.CurrentRow.Cells[0].Value.ToString())); List <tbl_EmployeeDTO> listEmployee = new List <tbl_EmployeeDTO>(); tbl_EmployeeDAO emDAO = new tbl_EmployeeDAO(); foreach (var emId in employeeIDs) { listEmployee.Add(emDAO.GetById(emId)); } gvBigList.DataSource = listEmployee; }
public void LoadAll_EP_Page() { tbl_ProjectDAO dao = new tbl_ProjectDAO(); dao.GetAllProject(ref gvSmallList); InitEmployee_Project(); }
/// <summary> /// Load employee information /// </summary> private void frmEmployeeDetail_Load(object sender, EventArgs e) { try { tbl_EmployeeDAO emDAO = new tbl_EmployeeDAO(); currentEm = emDAO.GetById(EmId); txtId.Text = currentEm.Id.ToString(); txtName.Text = currentEm.Name; txtAddress.Text = currentEm.Address; birthday.Value = currentEm.Birthday; txtPhone.Text = currentEm.Phone; txtEmail.Text = currentEm.Email; string[] role = currentEm.Role.Split('-'); cbPosition.Text = role[1].Trim().ToUpper(); tbl_RoleDAO roleDAO = new tbl_RoleDAO(); roleDAO.GetAll(ref cbPosition); txtSalary.Text = currentEm.Salary.ToString(); // display list project tbl_JoiningDAO joinDAO = new tbl_JoiningDAO(); List <int> listProId = joinDAO.GetListProjectByEmId(EmId); tbl_ProjectDAO projectDAO = new tbl_ProjectDAO(); listProject = new List <tbl_ProjectDTO>(); foreach (int id in listProId) { listProject.Add(projectDAO.GetById(id)); } gvProject.DataSource = listProject; // load all project List <string> items = projectDAO.GetAllProject(); cbProject.DataSource = items; } catch (Exception ex) { MessageBox.Show(ex.Message); } }