public void TestCRUDEmployee() { string userNameExpected = "AnLe"; string nameExpected = "AnLe"; string passWord = "******"; Employee employee = employeeBLL.CreateEmployee(nameExpected, userNameExpected, passWord); EmployeeDepartment employeeDepartment = new EmployeeDepartment(); List <Department> departments = departmentBLL.ListDepartment(); employeeDepartment.DepartmentID = departments[0].ID; employeeDepartment.EmployeeID = employee.ID; emloyeeDepartmentBLL.CreateEmployeeDepartment(employeeDepartment); bool isCreated = false; List <Employee> employees = employeeBLL.ListEmployeeByDepartment(departments[0]); for (int i = 0; i < employees.Count; i++) { if (employees[i].Name == nameExpected && employees[i].Username == userNameExpected) { isCreated = true; } } Assert.AreEqual(true, isCreated); TestUpdateInformationEmployee(employee, employeeDepartment); }
public ActionResult Create(Employee model) { var empBll = new EmployeeBLL(); var result = empBll.CreateEmployee(model); return(View()); }
private void BtnAdd_Click(object sender, RoutedEventArgs e) { if (Validate()) { employeeBLL.CreateEmployee(FirstNameTxtBox.Text, SecondNameTxtBox.Text, LastNameTxtBox.Text, EGNTxtBox.Text, DutyTxtBox.Text, TownTxtBox.Text, PhoneNumberTxtBox.Text, CardNUmberTxtBox.Text); TextClear(); this.ValidateTxtBox.Visibility = Visibility.Collapsed; } }
private void addEmployee() { if (this.tvName.Text.Trim() == "") { MessageBox.Show("Please, enter the employee's full name!", "Warning", MessageBoxButtons.OK); } else { if (this.tvUserName.Text.Trim() == "") { MessageBox.Show("Please, enter your full username!", "Warning", MessageBoxButtons.OK); } else { if (this.tvPassword.Text == this.tvRetypePassword.Text) { EmployeeBLL employeeBLL = new EmployeeBLL(); EmloyeeDepartmentBLL emloyeeDepartmentBLL = new EmloyeeDepartmentBLL(); string mySalt = BCrypt.Net.BCrypt.GenerateSalt(); string userPassWork = BCrypt.Net.BCrypt.HashPassword(this.tvRetypePassword.Text, mySalt); Employee employee = employeeBLL.CreateEmployee(this.tvName.Text, this.tvUserName.Text, userPassWork); EmployeeDepartment employeeDepartment = new EmployeeDepartment(); employeeDepartment.DepartmentID = department.ID; employeeDepartment.EmployeeID = employee.ID; emloyeeDepartmentBLL.CreateEmployeeDepartment(employeeDepartment); this.Close(); } else { MessageBox.Show("The retype password you entered is incorrect!", "Warning", MessageBoxButtons.OK); } } } }