public void doReset() { if (isMinimumValid()) { DisabilityDAO disabilityDao = new DisabilityDAO(); DisabilityDTO disabilityInfoDto = disabilityDao.find(view.getUsername(), view.getDisabilityType()); setDisabilityDto(disabilityInfoDto); view.showFeedback("Fields are reset."); } else { view.showFeedback("Error Field vlaues are not valid"); } }
public void DisabilityDAOConstructorTest() { /*Context*/ DisabilityDAO disability_context = new DisabilityDAO(); AccountDAO account_context = new AccountDAO(); /*Insert*/ AccountDTO account = new AccountDTO(); account.userName = "******"; account.status = "active"; account.password = "******"; account.accountType = "admin"; account_context.presist(account); DisabilityDTO disability = new DisabilityDTO(); disability.disabilityType = "hearing"; disability.description = "loss of hearing"; disability.userName = "******"; disability_context.presist(disability); bool expected = true; bool actual; actual = disability_context.isFound("john", "hearing"); Assert.AreEqual(expected, actual); /*Update*/ disability.description = "no hearing"; disability_context.merge(disability); string expectedUpdate = "no hearing"; DisabilityDTO contUpd = disability_context.find("john", "hearing"); Assert.AreEqual(expectedUpdate, contUpd.description); /*Delete*/ disability_context.removeByUserId("john", "hearing"); bool expectedDelete = false; bool actualDelete = disability_context.isFound("john", "hearing"); Assert.AreEqual(expectedDelete, actualDelete); account_context.removeByUserId("john"); }
protected void rptDisability_ItemCommand(object source, RepeaterCommandEventArgs e) { DisabilityDTO dto; DisabilityDAO dao = new DisabilityDAO(); String element = e.CommandName.ToString(); if (element.Equals("disabilityType")) { dto = dao.find(getUsername(), e.CommandArgument.ToString()); presenter.setDisabilityDto(dto); presenter.updateView(); } }