private void btnSave_Click(object sender, EventArgs e)
        {
            errorProvider1.Clear();
            //Revalidate the controls
            bool success = ValidateOldPassword();

            if (success)
            {
                success = ValidatePassword();
            }
            if (success)
            {
                success = ValidateNewPassword();
            }
            if (success)
            {
                string mySalt = BCrypt.Net.BCrypt.GenerateSalt();
                employee.Password = BCrypt.Net.BCrypt.HashPassword(txtNewPassword.Text, mySalt);
                if (employeeBLL.EditEmployee(employee) == true)
                {
                    MessageBox.Show("Success!");
                    this.Close();
                }
                else
                {
                    MessageBox.Show(":( Unsuccess. Please try again baby!");
                }
            }
            else
            {
                MessageBox.Show(":( Unsuccess. Please try again baby!");
            }
        }
Example #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool result = false;

            foreach (var item in ListEmpEdit)
            {
                if (employeeBLL.EditEmployee(item) == false)
                {
                    MessageBox.Show("Cannot save. Please try again");
                    break;
                }
                else
                {
                    result = true;
                }
            }
            if (result == true)
            {
                DialogResult dialog = MessageBox.Show("Saved successfully", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (dialog == DialogResult.OK)  //click ok thì chuyển lại form đầu.
                {
                    mainform.loadUCEmployee();
                }
            }
            dgvEmployee.DataSource = employeeBLL.LoadRecord(pageNumber, numberRecord);
        }
Example #3
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            if (!InputValidation())
            {
                return;
            }
            EmployeeEntity employeeEntity = new EmployeeEntity();

            employeeEntity.EmployeeNumber    = txtEmployeeNumber.Text;
            employeeEntity.EmployeeFirstName = txtEmployeeFirstName.Text;
            employeeEntity.EmployeeLastName  = txtEmployeeLastName.Text;
            employeeEntity.Address           = txtAddress.Text;
            employeeEntity.IDCard            = txtIdCard.Text;
            employeeEntity.DOB            = dtpDOB.Value;
            employeeEntity.Sex            = (SexValue)cbxSex.SelectedItem;
            employeeEntity.JobRankType    = (JobRankValue)cbxJobRankType.SelectedItem;
            employeeEntity.JobRankLevel   = (JobRankLevelValue)cbxJobRankLevel.SelectedItem;
            employeeEntity.SalaryLevel    = (SalaryLevelValue)cbxSalaryLevel.SelectedItem;
            employeeEntity.SalarySubLevel = Convert.ToInt32(txtSalarySubLevel.Text);

            if (mode == 0)
            {
                employeeBLL.AddEmployee(employeeEntity);
            }
            if (mode == 1)
            {
                employeeBLL.EditEmployee(employeeEntity, ID);
            }
            this.Close();
        }
Example #4
0
 private void BtnAdd_Click(object sender, RoutedEventArgs e)
 {
     if (Validate())
     {
         employeeBLL.EditEmployee(GetFieldInfo());
         this.Frame.Navigate(typeof(EmployeeInfoPage));
         this.ValidateTxtBox.Visibility = Visibility.Collapsed;
     }
 }
Example #5
0
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtName.Text) || (String.IsNullOrEmpty(txtPhoneNumber.Text)) ||
                String.IsNullOrEmpty(txtAddress.Text) || (String.IsNullOrEmpty(txtCMND.Text)) ||
                String.IsNullOrEmpty(txtEmail.Text) || (String.IsNullOrEmpty(txtUsername.Text))
                )
            {
                MessageBox.Show("Please insert fully information");
            }
            else
            {
                errorProvider1.Clear();

                //Revalidate the controls
                bool success = ValidateName();
                if (success)
                {
                    success = ValidatePhone();
                }
                if (success)
                {
                    success = ValidateAddress();
                }
                if (success)
                {
                    success = ValidateCMND();
                }
                if (success)
                {
                    success = ValidateEmail();
                }
                if (success)
                {
                    employee.Name        = txtName.Text;
                    employee.CMND        = txtCMND.Text;
                    employee.DateOfBirth = dtpDOB.Value;
                    employee.Email       = txtEmail.Text;
                    employee.Address     = txtAddress.Text;
                    employee.IsFemale    = (cbGender.SelectedIndex == 0) ? true : false;
                    employee.PhoneNumber = txtPhoneNumber.Text;
                    if (employeeBLL.EditEmployee(employee) == true)
                    {
                        MessageBox.Show("Success!");
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(":( Unsuccess. Please try again baby!");
                    }
                }
                else
                {
                    MessageBox.Show(":( Unsuccess. Please try again baby!");
                }
            }
        }
Example #6
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (ValidateInput())
     {
         emp.DepartmentID = (int)cboDept.SelectedValue;
         emp.Name         = txtName.Text.Trim();
         emp.Sex          = rdoMale.Checked ? "男" : "女";
         emp.Position     = cboPosition.Text;
         emp.Phone        = txtPhone.Text.Trim();
         emp.Email        = txtEmail.Text.Trim();
         emp.Nation       = cboNation.Text;
         emp.Polity       = cboPolity.Text;
         emp.Degree       = cboDegree.Text;
         emp.Salary       = Convert.ToDecimal(txtSalary.Text.Trim());
         emp.Resume       = txtResume.Text;
         emp.Memo         = txtMemo.Text;
         emp.Status       = ckbStatus.Checked;
         try
         {
             if (op == Operator.Add)
             {
                 if (empbll.AddEmployee(emp))
                 {
                     this.DialogResult = DialogResult.OK;
                     MessageBox.Show("添加成功!");
                     op = Operator.Other;
                 }
             }
             else if (op == Operator.Edit)
             {
                 if (empbll.EditEmployee(emp))
                 {
                     this.DialogResult = DialogResult.OK;
                     MessageBox.Show("修改成功");
                     op = Operator.Other;
                 }
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
Example #7
0
        protected void EmployeeEditButton_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                EmployeeBLL       bll      = new EmployeeBLL(connectionString);
                EmployeeViewModel employee = new EmployeeViewModel();

                employee.EmployeeID = Convert.ToInt32(Request.QueryString["EmployeeID"]);
                employee.FirstName  = EmployeeFirstName.Text;
                employee.LastName   = EmployeeLastName.Text;
                employee.Gender     = Convert.ToBoolean(EmployeeGender.SelectedValue);
                employee.BirthDate  = EmployeeBirthDate.Text;
                employee.JobTitle   = EmployeeJobTitle.Text;
                employee.StartDate  = EmployeeStartDate.Text;

                bll.EditEmployee(employee);
                Response.Redirect("~/CurrentEmployees.aspx");
            }
        }