Beispiel #1
0
        private void picUpdate_Click(object sender, EventArgs e)
        {
            if (page.Equals("Project-Company"))
            {
                frmProjectDetail frmProject = frmProjectDetail.GetInstance();
                if (!frmProject.Visible)
                {
                    frmProject.ComName      = lbCompanyName.Text;
                    frmProject.PartnerInfor = cbPartners.Text;
                    frmProject.ProjectId    = int.Parse(gvBigList.CurrentRow.Cells[0].Value.ToString());

                    frmProject.Show();
                }
                else
                {
                    frmProject.BringToFront();
                }
            }
            if (page.Equals("Employee-Project"))
            {
                frmEmployeeDetail frmEm = frmEmployeeDetail.GetInstance();
                if (!frmEm.Visible)
                {
                    frmEm.EmId = int.Parse(gvBigList.CurrentRow.Cells[0].Value.ToString());
                    frmEm.Show();
                }
                else
                {
                    frmEm.BringToFront();
                }
            }
        }
        public void InsertEmployee()
        {
            frmEmployeeDetail detail = new frmEmployeeDetail(true, this);

            detail.setIsUpdate(false);
            DialogResult r = detail.ShowDialog();
        }
Beispiel #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmEmployeeDetail frmED = new frmEmployeeDetail();

            frmED.iFunction = 1;
            frmED.ShowDialog();
            if (frmED.DialogResult == DialogResult.OK)
            {
                FillGridControl();
            }
        }
        public void saveEmployee(frmEmployeeDetail detail)
        {
            TblEmployeesDTO emp = new TblEmployeesDTO();

            emp.idEmployee = detail.getUserName();
            emp.name       = detail.getFullName();
            emp.password   = detail.getPassword();
            emp.role       = detail.getRole().Trim();
            bool status = true;

            if (detail.getStatus().Trim().Equals("True"))
            {
                status = true;
            }
            else
            {
                status = false;
            }

            emp.status = status;

            bool validate = ValidateEmplpyee(emp);

            if (validate)
            {
                if (!detail.getIsUpdate())
                {
                    if (model.InsertEmployee(emp))
                    {
                        MessageBox.Show(MessageUtil
                                        .SAVE_SUCCESS);
                    }
                    else
                    {
                        MessageBox.Show(MessageUtil.ERROR + " add Employee");
                    }
                }
                else
                {
                    if (model.UpdateEmployee(emp))
                    {
                        MessageBox.Show(MessageUtil
                                        .SAVE_SUCCESS);
                    }
                    else
                    {
                        MessageBox.Show(MessageUtil.ERROR + " update Employee");
                    }
                }
            }
        }
Beispiel #5
0
        private void btnEmployeeDetail_Click(object sender, EventArgs e)
        {
            frmEmployeeDetail frmED = new frmEmployeeDetail();

            frmED.iFunction = 2;
            var rowHandle = gridView1.FocusedRowHandle;

            frmED.employee = new EmployeeDAO().GetByID(Convert.ToInt32(gridView1.GetRowCellValue(rowHandle, "EmployeeID").ToString()));
            frmED.ShowDialog();
            if (frmED.DialogResult == DialogResult.OK)
            {
                FillGridControl();
            }
        }
        public void updateEmp()
        {
            frmEmployeeDetail detail = new frmEmployeeDetail(true, this);

            detail.setIsUpdate(true);

            //lấy dữ liệu gán vào textbox
            detail.getID().Text   = form.getIdEmp().Text;
            detail.getName().Text = form.getEmpName().Text;
            detail.getPwd().Text  = form.getPassword().Text;
            detail.selectrole(form.getRoletext());
            detail.selectstatus(form.getStatus().Text);
            // detail.selectstatus(bool.Parse(form.getStatus().Text));
            DialogResult r = detail.ShowDialog();
        }