Exemplo n.º 1
0
        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;
        }
        //
        //load project detail
        //
        private void frmProjectManagement_Load(object sender, EventArgs e)
        {
            lbCompanyName.Text  = ComName;
            lbPartnerInfor.Text = PartnerInfor;
            tbl_ProjectDAO dao = new tbl_ProjectDAO();
            tbl_ProjectDTO dto = dao.GetById(ProjectId);

            currentDTO = dto;

            txtID.Text          = dto.Id.ToString();
            txtName.Text        = dto.Name;
            txtDescription.Text = dto.Description;
            lbStatus.Text       = dto.Status;
            txtAdPayment.Text   = dto.AdvancePayment.ToString();
            txtCost.Text        = dto.Cost.ToString();
            dateStart.Value     = dto.BeginTime;
            if (dto.Deadline != null)
            {
                dateDeadline.Value = dto.Deadline.Value;
            }
            if (dto.Status.Equals("Doing..."))
            {
                chbDone.Visible    = true;
                chbDone.Checked    = false;
                dateEnd.Visible    = false;
                lbStatus.BackColor = Color.Red;
            }
            else
            {
                chbDone.Checked    = true;
                dateEnd.Visible    = true;
                dateEnd.Value      = dto.EndTime.Value;
                lbStatus.BackColor = Color.Blue;
            }
            // display list employee
            tbl_JoiningDAO joiningDAO  = new tbl_JoiningDAO();
            List <int>     employeeIDs = joiningDAO.GetListEmIDByProjectId(ProjectId);

            listEmployee = new List <tbl_EmployeeDTO>();
            listFirt     = listEmployee;
            tbl_EmployeeDAO emDAO = new tbl_EmployeeDAO();

            foreach (var emId in employeeIDs)
            {
                listEmployee.Add(emDAO.GetById(emId));
            }
            gvListEmployee.DataSource = listEmployee;
            // display domainEmployee
            listAllEmp = emDAO.GetAllEmployee();
            List <String> itemsCbEmployee = new List <string>();

            foreach (tbl_EmployeeDTO employee in listAllEmp)
            {
                itemsCbEmployee.Add(employee.Name + " - ID :" + employee.Id + " (" + employee.Role + ")");
            }
            cbEmployee.DataSource = itemsCbEmployee;
        }
Exemplo n.º 3
0
        public void CellClick_EP_Page()
        {
            //load 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;
        }