private void ButtonClick(object sender, EventArgs e) { string clickedButton = (sender as Button).Text; switch (clickedButton) { case "Add Employee": MVCForm.DisposeView(this.view); AddEmployee addEmployeeDashboard = new AddEmployee(); AddEmployeeView addEmployeeView = new AddEmployeeView(); AddEmployeeController addEmployeeController = new AddEmployeeController(addEmployeeDashboard, addEmployeeView, this.curForm); addEmployeeController.DisplayView(); DisplayNavigation(); break; case "Edit Employee": MVCForm.DisposeView(this.view); EditEmployee editEmployeeDashboard = new EditEmployee(); EditEmployeeView editEmployeeView = new EditEmployeeView(); EditEmployeeController editEmployeeController = new EditEmployeeController(editEmployeeDashboard, editEmployeeView, this.curForm); editEmployeeController.DisplayView(); DisplayNavigation(); break; case "Delete Employee": MVCForm.DisposeView(this.view); DeleteEmployee deleteEmployeeDashboard = new DeleteEmployee(); DeleteEmployeeView deleteEmployeeView = new DeleteEmployeeView(); DeleteEmployeeController deleteEmployeeController = new DeleteEmployeeController(deleteEmployeeDashboard, deleteEmployeeView, this.curForm); deleteEmployeeController.DisplayView(); DisplayNavigation(); break; } }
public void DeleteEmployee_Action_Fails() { // Arrange var employeeDto = TestHelper.EmployeeDto(); GenericServiceResponse <bool> fakeResponse = null; mockClientServicesProvider.Setup(x => x.Logger).Returns(mockLogger.Object).Verifiable(); mockClientServicesProvider.Setup(x => x.EmployeeService.DeleteEmployee(employeeDto)).Returns(fakeResponse).Verifiable(); var viewModel = new GenericViewModel(); var action = new DeleteEmployee <GenericViewModel>(mockClientServicesProvider.Object) { OnComplete = model => viewModel = model }; // Act var result = action.Invoke(employeeDto); // Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(GenericViewModel)); Assert.IsNotNull(result.Notifications); Assert.IsInstanceOfType(result.Notifications, typeof(NotificationCollection)); Assert.IsTrue(result.Notifications.Count() == 1); Assert.IsTrue(result.HasErrors); Assert.IsNotNull(result.Success); Assert.IsInstanceOfType(result.Success, typeof(bool)); Assert.IsFalse(result.Success); }
private void DeleteEmployee_Click(object sender, RoutedEventArgs e) { DeleteEmployee deleteEmployee = new DeleteEmployee(); deleteEmployee.Owner = this; deleteEmployee.Show(); }
public void ClickDeleteEmployee() { var wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(20)); wait.Until(ExpectedConditions.ElementToBeClickable(DeleteEmployee)); DeleteEmployee.WaitAndClick(_driver); }
private void btnDelete_Click(object sender, EventArgs e) { int selectedRowCount = dgvEmpDetails.Rows.GetRowCount(DataGridViewElementStates.Selected); string employeeName = txtEmpName.Text; string messageHeader = "Continue Process?"; string messageContent = $"Do you want to DELETE { employeeName }'s record?"; try { if (selectedRowCount >= 0) { DialogResult dialog = MessageBox.Show(messageContent, messageHeader, MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { DeleteEmployee deleteEmployee = new DeleteEmployee(ConnectionString.config); deleteEmployee.SpecificRecord(EmployeeId, employeeName); RefreshData(); return; } } MessageBox.Show("Please Select A Record !!!"); } catch (Exception ex) { MessageBox.Show($"Cannot DELETE { txtEmpName.Text }'s record! \nError: { ex.Message }"); } }
public async Task Dispatch(Terminated evt, Guid employeeId) { var command = new DeleteEmployee { EmployeeId = employeeId }; await mediator.Send(command); }
public ActionResult Delete([Bind(Include = "EmployeeID")] DeleteEmployee modal) { Employee employee = db.Employees.Find(modal.EmployeeID); db.Employees.Remove(employee); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task Delete(DeleteEmployee command) { var deleted = await db.Employees .Include(e => e.Dependents) .FirstAsync(e => e.Id == command.Id); db.Remove(deleted); await db.SaveChangesAsync(); }
public DeleteEmployeeController(DeleteEmployee model, DeleteEmployeeView view, Form curForm) { db = new LINQDataContext(); this.model = model; this.view = view; this.curForm = curForm; this.view.BtnDelete.Click += (sender, e) => btnDelete_Click(sender, e); this.view.ComboName.SelectedIndexChanged += (sender, e) => comboName_SelectedIndexChanged(sender, e); }
public object Delete(DeleteEmployee request) { var entity = request.ConvertTo <Employee>(); return(InTransaction(db => { Logic.Remove(entity); return new CommonResponse(); })); }
public virtual void SetUp() { deleteEmployee = A.Fake <DeleteEmployee>(); createEmployee = A.Fake <CreateEmployee>(); queryFactory = A.Fake <IQueryFactory>(); sut = new EmployeesController(queryFactory, createEmployee, deleteEmployee); }
public async Task HandleAsync_Should_Delete_Employee_With_Given_Id_Using_Repository() { var command = new DeleteEmployee(Guid.NewGuid()); var employee = new Employee(command.Id, "No Avatar", "Testowy Testo", Position.Grabarz, 1980); _repository.GetAsync(command.Id).Returns(employee); await Act(command); await _repository.Received(1).DeleteAsync(employee); }
private void btEmployeeDelete_Click(object sender, EventArgs e) { var selectedRowIndex = dgvEmployees.GetSelectedRowIndex(); var selectedRow = dgvEmployees.GetSelectedRow(); var deleteEmployee = new DeleteEmployee(repository); if (deleteEmployee.Perform(selectedRow)) { dgvEmployees.Rows.RemoveAt(selectedRowIndex); gridLoader.RefreshEmployeeCounter(filteredEmployees.Count - 1); } }
public async Task HandleAsync_Should_Throw_An_Exception_When_Employee_With_Given_Id_Does_Not_Exist() { //ARRANGE var command = new DeleteEmployee(Guid.NewGuid()); //ACT var exception = await Record.ExceptionAsync(async() => await Act(command)); //ASSERT exception.ShouldNotBeNull(); exception.ShouldBeAssignableTo <EmployeeDoesntExistException>(); }
public void ThenEmployeeShouldBeDeleted() { using (var connection = GetDatabaseConnection.Create()) { sut = new DeleteEmployee(connection); sut.Execute(newEmployeeId); connection.Open(); var retrievedEmployee = connection.Get <Employee>(newEmployeeId); connection.Close(); retrievedEmployee.Should().BeNull(); } }
private void btnDeleteAllRecords_Click(object sender, EventArgs e) { int selectedRowCount = dgvEmpDetails.Rows.GetRowCount(DataGridViewElementStates.Selected); string messageHeader = "Continue Process?"; string messageContent = "Do you want to DELETE ALL Employee Records?"; DialogResult dialog = MessageBox.Show(messageContent, messageHeader, MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { DeleteEmployee deleteEmployee = new DeleteEmployee(ConnectionString.config); deleteEmployee.AllRecords(selectedRowCount); RefreshData(); } }
/// <summary> /// Ta bort en specifik anställd /// </summary> /// <returns>Den borttagna anställda</returns> public EmployeeResponse Delete(DeleteEmployee request) { var employee = EmployeeRepository.GetEmployee(request.Id); if (employee == null) { Response.StatusCode = (int)HttpStatusCode.NotFound; return(null); } EmployeeRepository.DeleteEmployee(employee.Id); return(new EmployeeResponse { Employee = employee.ToDto() }); }
public void DeleteStaffTest() { // Create a new employee object employee addedEmployee = new employee { FirstName = "Testman", LastName = "MacTest", Password = "******", Telephone = "09876543234", EmailAddress = "*****@*****.**", Address = "123test-test-test-test", DateJoined = DateTime.Today.Date, StaffID = 987456 }; Console.WriteLine(" today date is " + DateTime.Today.Date); // Create a new Department object department addedDept = new department { DeptName = DepartmentType.Carpentry.ToString() }; // Create a new role object and add the employee and department role addedRole = new role { RoleType = Roletype.Head.ToString(), employee = addedEmployee, department = addedDept }; //Save changes to Database db.roles.InsertOnSubmit(addedRole); db.SubmitChanges(); DeleteEmployee delete = new DeleteEmployee(); // delete.DeleteStaff("987456"); int expected = 1; int actual = delete.deleteCount; Assert.AreEqual(expected, actual); }
public void ItShouldBeDeleted() { var employee = Builder <Employee> .CreateNew() .With(e => e.Id = employeeId) .Build(); connection.Insert(employee); sut = new DeleteEmployee(connection); sut.Run(employee.Id); var result = connection.Get <Employee>(new { employee.Id }); if (result != null) { connection.Delete(result); } connection.Dispose(); result.Should().BeNull(); }
Task Act(DeleteEmployee command) => _handler.HandleAsync(command);
private void MenuItem_Click_Delete(object sender, RoutedEventArgs e) { DeleteEmployee DEobj = new DeleteEmployee(); DEobj.ShowDialog(); }
private async void TSB_DeleteUser_Click(object sender, EventArgs e) { await DeleteEmployee?.Invoke(); }
public EmployeeController(Startup.DeleteByNameResolver deleteAccesor, IEmployeeReadOnlyRepository read, ICreate <Employee> create) { delete = new DeleteEmployee(deleteAccesor(DeletesEmail.Employee), read); this.create = new CreateEmployee(create, read); this.read = new ReadEmployee(read); }
public EmployeesController(IQueryFactory queryFactory, CreateEmployee createEmployee, DeleteEmployee deleteEmployee) { this.queryFactory = queryFactory; this.createEmployee = createEmployee; this.deleteEmployee = deleteEmployee; }