protected void Button1_Click(object sender, EventArgs e) { using (QuizBookDbEntities1 _db = new QuizBookDbEntities1()) { var stid = staffId.Text; var tent = long.Parse(SessionHelper.GetTenantID(Session)); var cand = _db.Candidates.FirstOrDefault(s => s.Username == stid.Trim() && s.TenantId == tent); if (cand != null) { var actTest = _db.T_CTestTracker.AsEnumerable().Where(s => s.CandidateId == cand.Id && s.Finished == true).OrderByDescending(x => x.CurrentStartTime).Select(x => new { Name = x.T_Batch.Name, Candidate = x.CandidateId, Batch = x.BatchId, TimeFinished = ErecruitHelper.GetDateStringFromDate(x.CurrentStartTime.Value) }); CandidateTestList.DataSource = actTest.ToList(); CandidateTestList.DataBind(); DAlert.Visible = false; DMain.Visible = true; } else { var actTest = new List <object>(); CandidateTestList.DataSource = actTest.ToList(); CandidateTestList.DataBind(); //alert.InnerText = "This Candidate does not exist on the portal."; DAlert.Visible = false; DMain.Visible = true; } } }
protected void Page_Load(object sender, EventArgs e) { try { string currentPageFileName = new FileInfo(this.Request.Url.AbsolutePath).Name; var PermMgr = new PermissionManager(Session); if (PermMgr.IsAdmin || PermMgr.CanManageTestBatches) { string alink = Request["z"]; if (!string.IsNullOrEmpty(alink)) { var candBatch = _db.T_Batch.FirstOrDefault(s => s.Id == long.Parse(alink)); var bs = _db.T_BatchSet.Where(s => s.BatchId == candBatch.Id); var candNo = bs.Count(); var res = bs.Select(a => new ViewBatchResultsGridModel { ID = (long)a.CandidateId, Code = ErecruitHelper.getCandidateCode((long)a.CandidateId).ToString(), FirstName = ErecruitHelper.getCandidateFirstName((long)a.CandidateId).ToString(), LastName = ErecruitHelper.getCandidateLastName((long)a.CandidateId).ToString(), Score = a.TestScore == null ? "Not Attempted" : a.TestScore + "%", DateOfBirth = ErecruitHelper.getCandidateDOB((long)a.CandidateId).ToString(), Sex = ErecruitHelper.getCandidateSex((long)a.CandidateId).ToString(), Passport = ErecruitHelper.getCandidateImgUrl((long)a.CandidateId).ToString(), Alt = ErecruitHelper.getCandidateCode((long)a.CandidateId).ToString() }); bname.InnerHtml = candBatch.Name; NoCands.InnerHtml = candNo.ToString(); dateTaken.InnerHtml = ErecruitHelper.GetDateStringFromDate((DateTime)candBatch.StartDate); BatchScoreList.DataSource = res.ToList(); BatchScoreList.DataBind(); } } } catch (Exception ex) { ErecruitHelper.SetErrorData(ex, Session); Response.Redirect("ErrorPage.aspx", false); } }
protected void check_Click(object sender, EventArgs e) { var code = Code.Text; var cand = _db.T_Candidate.FirstOrDefault(s => s.Code == code); if (!(cand == null)) { var b_set = _db.T_BatchSet.Where(s => s.CandidateId == cand.Id).ToList(); int count = b_set.Count(); if (count > 1) { var quests = b_set.Select(a => new PrevBatchGridModel { ID = a.Id, BatchName = ErecruitHelper.getBatchName((long)a.BatchId), Code = a.Finished == true ? ErecruitHelper.getCandidateCode((long)a.CandidateId) + "," + a.Id : ErecruitHelper.getCandidateCode((long)a.CandidateId), DateTaken = a.Finished == true ? ErecruitHelper.GetDateStringFromDate((DateTime)a.TimeStarted) : "Not Finished." }).Distinct().ToList(); batchHistory.DataSource = quests; batchHistory.DataBind(); batchHistoryPanel.Visible = true; ScoreListPanel.Visible = false; SessionHelper.NullCandidateCode(Session); Session["BatchSetId"] = null; } else if (count == 1) { batchHistoryPanel.Visible = false; SessionHelper.SetCandidateCode(code, Session); Session["BatchSetId"] = null; Response.Redirect("ViewTestScore.aspx", false); } else { resultLbl.Text = String.Empty; batchHistoryPanel.Visible = false; } } else { resultLbl.Text = "This is not a valid candidate code"; batchHistoryPanel.Visible = false; } }
protected void check_Click(object sender, EventArgs e) { var code = Code.Text; var cand = _db.T_Candidate.FirstOrDefault(s => s.Code == code); if (!(cand == null)) { var b_set = _db.T_BackGroundQuestAnswers.Where(s => s.CandidateId == cand.Id).ToList(); int count = b_set.Count(); if (count > 1) { var quests = b_set.Select(a => new PrevBatchGridModel { ID = a.Id, BatchName = ErecruitHelper.getBatchName((long)a.BatchId), Code = ErecruitHelper.getCandidateCode((long)a.CandidateId) + "," + a.BatchId, DateTaken = ErecruitHelper.GetDateStringFromDate((DateTime)a.Dateadded) }).Distinct().ToList(); batchHistory.DataSource = quests; batchHistory.DataBind(); batchHistoryPanel.Visible = true; SessionHelper.NullCandidateCode(Session); Session["Batchid"] = null; } else if (count == 1) { batchHistoryPanel.Visible = false; SessionHelper.SetCandidateCode(code, Session); Session["Batchid"] = b_set[0].BatchId; Response.Redirect("BackgroundView.aspx", false); } else { resultLbl.Text = "No History"; batchHistoryPanel.Visible = false; } } else { resultLbl.Text = "This is not a valid candidate code"; batchHistoryPanel.Visible = false; } //if (!string.IsNullOrEmpty(code)) //{ // var cand = _db.T_Candidate.FirstOrDefault(s => s.Code == code); // if (cand != null) // { // var b_id = _db.T_BatchSet.Where(s => s.CandidateId == cand.Id).Select(x => x.BatchId); // var candBatch = _db.T_Batch.FirstOrDefault(s => b_id.Contains(s.Id) && s.IsActive.Value); // if (candBatch != null) // { // var cbSet = _db.T_BatchSet.FirstOrDefault(s => s.BatchId == candBatch.Id && s.CandidateId == cand.Id); // var c_off = _db.T_Settings.FirstOrDefault(s => s.SettingsName == ErecruitHelper.Settings.CUT_OFF_MARK.ToString()).SettingsValue; // if (cbSet != null && cbSet.Finished == true) // { // if (double.Parse(cbSet.TestScore) > double.Parse(c_off)) // { // SessionHelper.SetCandidateCode(code, Session); // Response.Redirect("BackgroundView.aspx", false); // } // else // { // resultLbl.Text = "The candidate did not pass the test."; // } // } // else // { // var rsltTxt = "The candidate has not concluded the test."; // resultLbl.Text = rsltTxt; // } // } // else // { // resultLbl.Text = "The candidate has not been assigned to a test batch."; // } // } // else // { // resultLbl.Text = "This is not a valid candidate code"; // } //} }