protected void Page_Load(object sender, EventArgs e)
        {
            String vacancyNumber = (String)Session["vacancyNumber"];
            String username = (String)Session["username"];

            setUsername(username);
            setVacancyNumber(vacancyNumber);

            if (Session["ShortlistedAccountDTOList"] == null)
            {
                selectedAccountDtoList = new List<AccountDTO>();
                Session["ShortlistedAccountDTOList"] = selectedAccountDtoList;
            }
            else
            {
                selectedAccountDtoList = (List<AccountDTO>)Session["ShortlistedAccountDTOList"];
            }

            ApplicationSearchService search = new ApplicationSearchServiceImpl();
            List<ApplicationDTO> applicationList = search.getApplicationsApplied(getVacancyNumber());
            List<ApplicationViewDTO> appViewList = search.getApplicationViewDtoList(applicationList);

            List<ApplicationViewDTO> appViewSelectedList = search.getApplicationViewDtoList(selectedAccountDtoList);

            rpt.DataSource = appViewSelectedList;
            rpt.DataBind();

            rptShortlistedSelect.DataSource = appViewList;
            rptShortlistedSelect.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            String username = (String)Session["username"];
            ApplicationSearchService appService = new ApplicationSearchServiceImpl();
            List<ApplicationDTO> applicationList = appService.getApplicationByUsername(username);

            rpt.DataSource = applicationList;
            rpt.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            String vacancyNumber = (String)Session["vacancyNumber"];
            setVacancyNumber(vacancyNumber);

            ApplicationSearchService search = new ApplicationSearchServiceImpl();
            List<ApplicationDTO> applicationList = search.getApplicationByVacancyNumber(getVacancyNumber());
            List<ApplicationViewDTO> appViewList = search.getApplicationViewDtoList(applicationList);

            rptShortlistedSelect.DataSource = appViewList;
            rptShortlistedSelect.DataBind();
        }
 protected void lbShortList_Click(object sender, EventArgs e)
 {
     List<AccountDTO> accontList = (List<AccountDTO>)Session["ShortlistedAccountDTOList"];
     ApplicationSearchService search = new ApplicationSearchServiceImpl();
     search.saveShortlisted(accontList, getVacancyNumber());
 }
        protected void rpt_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            String element = e.CommandName.ToString();

            if (element.Equals("username"))
            {
                AccountDAO dao = new AccountDAO();
                AccountDTO account = dao.find(e.CommandArgument.ToString());

                selectedAccountDtoList = (List<AccountDTO>)Session["ShortlistedAccountDTOList"];
                selectedAccountDtoList.Remove(account);

                ApplicationSearchService search = new ApplicationSearchServiceImpl();
                List<AccountDTO> accountList = search.removeAccountFormList(selectedAccountDtoList, account);
                Session.Remove("ShortlistedAccountDTOList");
                Session["ShortlistedAccountDTOList"] = accountList;
                reloadPage();

                //ApplicationSearchService searchService = new ApplicationSearchServiceImpl();
                //searchService.selectAsApplied(e.CommandArgument.ToString(), getVacancyNumber());
            }
        }
        public void applicationSearchServiceTest()
        {
            ApplicationSearchService target = new ApplicationSearchServiceImpl(); // TODO: Initialize to an appropriate value

            AccountDAO account_context = new AccountDAO();
            ApplicationDAO app_context = new ApplicationDAO();
            VacancyDAO vac_context = new VacancyDAO();

            /*Insert*/
            AccountDTO account = new AccountDTO();
            account.userName = "******";
            account.status = "active";
            account.password = "******";
            account.accountType = "admin";
            account_context.presist(account);

            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);
            bool expectedVac = true;
            bool actualVac;
            actualVac = vac_context.isFound("1");
            Assert.AreEqual(expectedVac, actualVac);

            ApplicationDTO application = new ApplicationDTO();
            application.userName = "******";
            application.vacancyNumber = "1";
            application.status = "open";
            app_context.presist(application);

            //Test getApplicationByUsername method
            List<ApplicationDTO> applicationTestListObj = target.getApplicationByUsername("graddy");
            Assert.AreEqual(application.status, applicationTestListObj[0].status);

            //Test getApplicationByStatus method
            List<ApplicationDTO> applicationTestListObj2 = target.getApplicationByStatus("open");
            Assert.AreEqual(application.status, applicationTestListObj2[0].status);

            //Test getApplicationByVacancyNumber method
            List<ApplicationDTO> applicationTestListObj3 = target.getApplicationByVacancyNumber("1");
            Assert.AreEqual(application.status, applicationTestListObj3[0].status);

            /*Delete*/
            /*
            account_context.removeByUserId("graddy");
            bool expectedDelete = false;
            bool actualDelete = account_context.isFound("graddy");
            Assert.AreEqual(expectedDelete, actualDelete);
            */
        }