public void KeyWordDAO_Test()
        {
            /*Context*/
            KeyWordDAO key_context = new KeyWordDAO();
            VacancyDAO vac_context = new VacancyDAO();

            /*Insert*/
            VacancyDTO vac = new VacancyDTO();
            vac.department = "IS";
            vac.description = "Web services";
            vac.manager = "Tom";
            vac.recruiter = "Thumi";
            vac.site = "www.petrosa.co.za";
            vac.startDate = new DateTime(2012, 10, 10);
            vac.endDate = new DateTime(2012, 12, 1);
            vac.description = "desktop support";
            vac.title = "support technician";
            vac.vacancyNumber = "1";
            vac.viewCount = 10;
            vac.viewStatus = "published";
            vac.status = "active";

            vac_context.presist(vac);

            KeyWordDTO key = new KeyWordDTO();
            key.vacancyNumber = "1";
            key.word = "Fish";
            key_context.presist(key);
            bool expectedVac = true;
            bool actualVac;
            actualVac = key_context.isFound("Fish", "1");
            Assert.AreEqual(expectedVac, actualVac);

            /*Update*/
            //Not Applicable - Composite primary key can not be changed,except by removing the entity.

            /*Delete*/
            Assert.AreEqual(key_context.isFound("Fish", "1"), true);
            key_context.removeByUserId("Fish", "1");
            Assert.AreEqual(key_context.isFound("Fish", "1"), false);
            vac_context.removeByUserId("1");
        }
 public void doAddKeyWord()
 {
     AccountService accountService = new AccountServiceImpl();
     if (isValid())
     {
         if (accountService.isUniqueKeyWord(view.getKeyWord(), view.getQuestion()))
         {
             KeyWordDAO keyWordDao = new KeyWordDAO();
             keyWordDao.presist(getKeyWordDto());
             view.pageReload();
         }
         else
         {
             view.setKeyWordError("Error, this Date type is already used. Enter another value");
         }
     }
     else
     {
         view.showFeedback("Error Field vlaues are not valid");
     }
 }
        protected void rptKeyWord_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            KeyWordDTO dto;
            KeyWordDAO dao = new KeyWordDAO();
            String element = e.CommandName.ToString();

            if (element.Equals("word"))
            {
                dto = dao.find(e.CommandArgument.ToString(), getVacancyNumber());
                presenter.setKeyWordDto(dto);
                presenter.updateKeyWordView();
            }
        }
 public void doResetKeyWord()
 {
     if (isMinimumValid())
     {
         KeyWordDAO keyWordDao = new KeyWordDAO();
         KeyWordDTO keyWordDto = keyWordDao.find(view.getKeyWord(), view.getVacancyNumber());
         setKeyWordDto(keyWordDto);
         view.showFeedback("Fields are reset.");
     }
     else
     {
         view.showFeedback("Error Field vlaues are not valid");
     }
 }
 public void doRemoveKeyWord()
 {
     if (isMinimumValid())
     {
         KeyWordDAO vacancyDao = new KeyWordDAO();
         vacancyDao.removeByUserId(view.getKeyWord(), view.getVacancyNumber());
         view.pageReload();
     }
     else
     {
         view.showFeedback("Error Field vlaues are not valid");
     }
 }
 public bool isUniqueKeyWord(string vacancyNumber, string keyWord)
 {
     bool isUnique = false;
     KeyWordDAO dao = new KeyWordDAO();
     try
     {
         return (!dao.isFound(keyWord, vacancyNumber));
     }
     catch (InvalidOperationException ioe)
     {
         isUnique = true;
     }
     return isUnique;
 }
        public List<KeyWordDTO> getUserKeyWords(string vacancyNumber)
        {
            List<KeyWordDTO> dtoList = new List<KeyWordDTO>();
            KeyWordDAO dao = new KeyWordDAO();
            List<KeyWordDTO> list = dao.findAll();

            foreach (KeyWordDTO emp in list)
            {
                if (emp.vacancyNumber.Equals(vacancyNumber))
                {
                    dtoList.Add(emp);
                }
            }
            return dtoList;
        }