public void EmploymentDAOConstructorTest()
        {
            /*Context*/
            EmploymentDAO emp_context = new EmploymentDAO();
            AccountDAO account_context = new AccountDAO();
            /*Insert*/
            AccountDTO account = new AccountDTO();
            account.userName = "******";
            account.status = "active";
            account.password = "******";
            account.accountType = "admin";

            account_context.presist(account);

            EmploymentDTO employment = new EmploymentDTO();
            employment.company = "fuzion";
            employment.country = "SA";
            employment.currentEmployer = "Apple";
            employment.empType = "Contract";
            employment.endDate = new DateTime(2012, 12, 30);
            employment.gross = 10000;
            employment.industry = "IT";
            employment.province = "WP";
            employment.responsibilities = "web development";
            employment.startDate = new DateTime(2012, 6, 7);
            employment.title = "web developer";
            employment.town = "cape town";
            employment.userName = "******";

            emp_context.presist(employment);

            bool expected = true;
            bool actual;
            actual = emp_context.isFound("john", new DateTime(2012, 6, 7));
            Assert.AreEqual(expected, actual);

            /*Update*/
            employment.gross = 125000;
            emp_context.merge(employment);

            double expectedUpdate = 125000;
            EmploymentDTO contUpd = emp_context.find("john", new DateTime(2012, 6, 7));
            Assert.AreEqual(expectedUpdate, contUpd.gross);

            /*Delete*/
            emp_context.removeByUserId("john", new DateTime(2012, 6, 7));
            bool expectedDelete = false;
            bool actualDelete = emp_context.isFound("john", new DateTime(2012, 6, 7));
            Assert.AreEqual(expectedDelete, actualDelete);

            account_context.removeByUserId("john");
        }
 public void doReset()
 {
     if (isMinimumValid())
     {
         EmploymentDAO employmentDao = new EmploymentDAO();
         EmploymentDTO employmentInfoDto = employmentDao.find(view.getUsername(), view.getStartDate());
         setEmploymentDto(employmentInfoDto);
         view.showFeedback("Fields are reset.");
     }
     else
     {
         view.showFeedback("Error Field vlaues are not valid");
     }
 }
        protected void rptEmployment_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            EmploymentDTO dto;
            EmploymentDAO dao = new EmploymentDAO();
            String element = e.CommandName.ToString();

            if (element.Equals("startDate"))
            {
                dto = dao.find(getUsername(), DateTime.Parse(e.CommandArgument.ToString()));
                presenter.setEmploymentDto(dto);
                presenter.updateView();
            }
        }