public void showgrid() { ITestStatusManager objTestAdminManager = TestStatusManagerFactory.Create_TestStatusManager(); List <ITestStatus> lstTestStatus = new List <ITestStatus>(); lstTestStatus = objTestAdminManager.GetTestStatus(Convert.ToInt32(ddl_VacancyID.SelectedValue)); DataTable objDataTable = new DataTable(); DataColumn objDataColumn1 = new DataColumn("CandidateID"); objDataTable.Columns.Add(objDataColumn1); DataColumn objDataColumn2 = new DataColumn("WrittenTestDate"); objDataTable.Columns.Add(objDataColumn2); DataColumn objDataColumn3 = new DataColumn("WrittenTestStatus"); objDataTable.Columns.Add(objDataColumn3); DataColumn objDataColumn4 = new DataColumn("TechnicalInterviewDate"); objDataTable.Columns.Add(objDataColumn4); DataColumn objDataColumn5 = new DataColumn("TechnicalInterviewStatus"); objDataTable.Columns.Add(objDataColumn5); DataColumn objDataColumn6 = new DataColumn("HRInterviewDate"); objDataTable.Columns.Add(objDataColumn6); DataColumn objDataColumn7 = new DataColumn("HRInterviewStatus"); objDataTable.Columns.Add(objDataColumn7); foreach (ITestStatus TestStatus in lstTestStatus) { DataRow objDataRow = objDataTable.NewRow(); objDataRow["CandidateID"] = TestStatus.get_CandidateID; objDataRow["WrittenTestDate"] = TestStatus.get_Written_TestDate.ToString("dd/MM/yyyy"); objDataRow["WrittenTestStatus"] = TestStatus.get_Written_TestStatus; objDataRow["TechnicalInterviewDate"] = TestStatus.get_Technical_InterviewDate.ToString("dd/MM/yyyy"); objDataRow["TechnicalInterviewStatus"] = TestStatus.get_Technical_InterviewStatus; objDataRow["HRInterviewDate"] = TestStatus.get_HR_InterviewDate.ToString("dd/MM/yyyy"); objDataRow["HRInterviewStatus"] = TestStatus.get_HR_InterviewStatus; objDataTable.Rows.Add(objDataRow); } gv_TestStatus.DataSource = objDataTable; gv_TestStatus.DataBind(); }
public DateTime compare(int cand_id, string type) { try { DateTime date = Convert.ToDateTime("1/1/2012"); ITestStatusManager objTestStatusManager = TestStatusManagerFactory.Create_TestStatusManager(); List <ITestStatus> lstTestStatus = objTestStatusManager.GetTestStatus(Convert.ToInt32(ddlVacancyID.SelectedValue)); if (type == "HR") { foreach (ITestStatus element in lstTestStatus) { if (element.get_CandidateID == cand_id) { return(element.get_HR_InterviewDate); } } } if (type == "tech") { foreach (ITestStatus objelement in lstTestStatus) { if (objelement.get_CandidateID == cand_id) { return(objelement.get_Technical_InterviewDate); } } } if (type == "written") { foreach (ITestStatus objelement in lstTestStatus) { if (objelement.get_CandidateID == cand_id) { return(objelement.get_Written_TestDate); } } } return(date); } catch (Exception) { return(Convert.ToDateTime("1/1/2012")); } }
protected void gv_TestStatus_RowUpdating(object sender, GridViewUpdateEventArgs e) { ITestStatusManager objTestStatusManager = TestStatusManagerFactory.Create_TestStatusManager(); Label lbCandidateID = (Label)gv_TestStatus.Rows[e.RowIndex].FindControl("CandidateID"); DropDownList ddlWrittenTestStatus = (DropDownList)gv_TestStatus.Rows[e.RowIndex].FindControl("WrittenTestStatus"); DropDownList ddlTechnicalInterviewStatus = (DropDownList)gv_TestStatus.Rows[e.RowIndex].FindControl("TechnicalInterviewStatus"); DropDownList ddlHRInterviewStatus = (DropDownList)gv_TestStatus.Rows[e.RowIndex].FindControl("HRInterviewStatus"); int i = objTestStatusManager.update_TestStatus(Convert.ToInt32(lbCandidateID.Text), ddlWrittenTestStatus.Text, ddlTechnicalInterviewStatus.Text, ddlHRInterviewStatus.Text); ICandidateManager objCandidateManager = CandidateManagerFactory.Candidate_Manager(); List <ICandidateProfile> lstCandidateProfile = new List <ICandidateProfile>(); lstCandidateProfile = objCandidateManager.display_candidate_toPC(); switch (i) { case 1: int status = 0; foreach (ICandidateProfile element in lstCandidateProfile) { if (element.get_CandidateProfileID == Convert.ToInt32(lbCandidateID.Text)) { if (element.get_TestStatus == 2) { status = 1; } else if (element.get_TestStatus == 3) { status = 2; } else if (element.get_TestStatus == 4) { status = 3; } } } switch (status) { case 1: string script2 = "alert('Candidate ID :" + lbCandidateID.Text + " Written Test status has been updated successfully.');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script2, true); break; case 2: string script3 = "alert('Candidate ID :" + lbCandidateID.Text + " Technical Interview status has been updated successfully.');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script3, true); break; case 3: string script4 = "alert('Candidate ID :" + lbCandidateID.Text + " HR Interview status has been updated successfully.');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script4, true); break; } break; case 2: string script5 = "alert('HR Interview cannot be cleared before Technical and Written Test.');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script5, true); break; case 3: string script6 = "alert('Technical Interview cannot be cleared before Written Test.');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script6, true); break; case 4: string script7 = "alert('Technical or HR Interview cannot be cleared before Written Test.');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script7, true); break; case 5: string script8 = "alert('HR cannot be cleared before Technical.');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script8, true); break; } gv_TestStatus.EditIndex = -1; showgrid(); }
protected void gv_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { DateTimeFormatInfo date = new DateTimeFormatInfo(); date.ShortDatePattern = "dd/MM/yyyy"; lbWritten.Visible = false; lbTechnical.Visible = false; lbHR.Visible = false; ITestStatusManager objTestStatusManager = TestStatusManagerFactory.Create_TestStatusManager(); Label lbcandidateID = (Label)gv.Rows[e.RowIndex].FindControl("lbCandidateID"); TextBox tb1 = (TextBox)gv.Rows[e.RowIndex].FindControl("tbWrittenTestDate"); int intcandidate = Convert.ToInt32(lbcandidateID.Text); TextBox tbTechnicalDate = (TextBox)gv.Rows[e.RowIndex].FindControl("tbTechnicalInterviewDate"); TextBox tb3 = (TextBox)gv.Rows[e.RowIndex].FindControl("tbHRInterviewDate"); Label lbWrittenStatus = (Label)gv.Rows[e.RowIndex].FindControl("lbWrittenTestStatus"); Label lbTechnicalStatus = (Label)gv.Rows[e.RowIndex].FindControl("lbTechnicalInterviewStatus"); Label lbHRStatus = (Label)gv.Rows[e.RowIndex].FindControl("lbHRInterviewStatus"); DateTime dtWritten, dtTechnical, dtHR; if (tb1.Text != "" && tbTechnicalDate.Text != "" && tb3.Text != "") { dtWritten = Convert.ToDateTime(tb1.Text, date); dtTechnical = Convert.ToDateTime(tbTechnicalDate.Text, date); dtHR = Convert.ToDateTime(tb3.Text, date); if (tb1.Text == tbTechnicalDate.Text || tbTechnicalDate.Text == tb3.Text || tb3.Text == tb1.Text) { string script2 = "alert('Test Dates cannot be same.');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script2, true); } else if (dtWritten < dtTechnical && dtTechnical < dtHR) { if (lbHRStatus.Text == "pending") { bool st = objTestStatusManager.validateTest(Convert.ToInt32(ddlVacancyID.SelectedValue), Convert.ToInt32(lbcandidateID.Text), dtHR); if (st == false) { string script2 = "alert('Please check HR interview date.');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script2, true); } else { if (compare(intcandidate, "HR") != dtHR) { lbHR.Visible = true; } objTestStatusManager.updatetest(Convert.ToInt32(ddlVacancyID.SelectedValue), Convert.ToInt32(lbcandidateID.Text), "HR", dtHR); if (lbTechnicalStatus.Text == "pending") { bool st1 = objTestStatusManager.validateTest(Convert.ToInt32(ddlVacancyID.SelectedItem.Text), Convert.ToInt32(lbcandidateID.Text), dtTechnical); if (st1 == false) { string script = "alert('Please check the Technical interview date');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script, true); } else { if (compare(intcandidate, "tech") != dtTechnical) { lbTechnical.Visible = true; } objTestStatusManager.updatetest(Convert.ToInt32(ddlVacancyID.SelectedItem.Text), Convert.ToInt32(lbcandidateID.Text), "technical", dtTechnical); if (lbWrittenStatus.Text == "pending") { bool st2 = objTestStatusManager.validateTest(Convert.ToInt32(ddlVacancyID.SelectedItem.Text), Convert.ToInt32(lbcandidateID.Text), dtWritten); if (st2 == false) { string script = "alert('Please check the written test date');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script, true); } else { if (compare(intcandidate, "written") != dtWritten) { lbWritten.Visible = true; } objTestStatusManager.updatetest(Convert.ToInt32(ddlVacancyID.SelectedItem.Text), Convert.ToInt32(lbcandidateID.Text), "written", dtWritten); } } else { string script5 = "alert('The written test status is cleared!');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script5, true); } } } else { string script6 = "alert('The technical Interview status is cleared !');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script6, true); } } } else { string script2 = "alert('The HR interview status is cleared !');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script2, true); } } else { string script2 = "alert('Please check the entered dates');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script2, true); } } else { string script2 = "alert('Please give valid details');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script2, true); } gv.EditIndex = -1; showgrid(); } catch (Exception) { string script2 = "alert('Please give valid details');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script2, true); } }
protected void gv_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { DateTimeFormatInfo w = new DateTimeFormatInfo(); w.ShortDatePattern = "dd/MM/yyyy"; lbWritten.Visible = false; lbTechnical.Visible = false; lbHR.Visible = false; ITestStatusManager objTestStatusManager = TestStatusManagerFactory.Create_TestStatusManager(); Label l1 = (Label)gv.Rows[e.RowIndex].FindControl("CandidateID"); TextBox tb1 = (TextBox)gv.Rows[e.RowIndex].FindControl("WrittenTestDate"); int c = Convert.ToInt32(l1.Text); TextBox tb2 = (TextBox)gv.Rows[e.RowIndex].FindControl("TechnicalInterviewDate"); TextBox tb3 = (TextBox)gv.Rows[e.RowIndex].FindControl("HRInterviewDate"); Label l2 = (Label)gv.Rows[e.RowIndex].FindControl("WrittenTestStatus"); Label l3 = (Label)gv.Rows[e.RowIndex].FindControl("TechnicalInterviewStatus"); Label l4 = (Label)gv.Rows[e.RowIndex].FindControl("HRInterviewStatus"); DateTime written, tech, hr; if (tb1.Text != "" && tb2.Text != "" && tb3.Text != "") { written = Convert.ToDateTime(tb1.Text, w); tech = Convert.ToDateTime(tb2.Text, w); hr = Convert.ToDateTime(tb3.Text, w); if (tb1.Text == tb2.Text || tb2.Text == tb3.Text || tb3.Text == tb1.Text) { string script2 = "alert('No two test or interview dates can be same');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script2, true); } else if (written < tech && tech < hr) { if (l4.Text == "pending") { bool st = objTestStatusManager.validateTest(Convert.ToInt32(ddlVacancyID.SelectedValue), Convert.ToInt32(l1.Text), hr); if (st == false) { string script2 = "alert('HR interview date cannot be rescheduled more than 3 days from the scheduled date.');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script2, true); } else { if (compare(c, "HR") != hr) { lbHR.Visible = true; } objTestStatusManager.updatetest(Convert.ToInt32(ddlVacancyID.SelectedValue), Convert.ToInt32(l1.Text), "HR", hr); if (l3.Text == "pending") { bool st1 = objTestStatusManager.validateTest(Convert.ToInt32(ddlVacancyID.SelectedItem.Text), Convert.ToInt32(l1.Text), tech); if (st1 == false) { string script = "alert('Technical interview date cannot be rescheduled more than 3 days from the scheduled date.');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script, true); } else { if (compare(c, "tech") != tech) { lbTechnical.Visible = true; } objTestStatusManager.updatetest(Convert.ToInt32(ddlVacancyID.SelectedItem.Text), Convert.ToInt32(l1.Text), "technical", tech); if (l2.Text == "pending") { bool st2 = objTestStatusManager.validateTest(Convert.ToInt32(ddlVacancyID.SelectedItem.Text), Convert.ToInt32(l1.Text), written); if (st2 == false) { string script = "alert(' Written test date cannot be rescheduled more than 3 days from the scheduled date.');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script, true); } else { if (compare(c, "written") != written) { lbWritten.Visible = true; } objTestStatusManager.updatetest(Convert.ToInt32(ddlVacancyID.SelectedItem.Text), Convert.ToInt32(l1.Text), "written", written); } } else { string script5 = "alert('The written test status is cleared for candidate with id: '" + l1.Text + ".');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script5, true); } } } else { string script6 = "alert('The technical Interview status is cleared for candidate with id: '" + l1.Text + ".');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script6, true); } } } else { string script2 = "alert('The HR interview status is cleared for the candidate with id: '" + l1.Text + ".');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script2, true); } } else { string script2 = "alert('Please check the entered dates');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script2, true); } } else { string script2 = "alert('Please enter the valid dates');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script2, true); } gv.EditIndex = -1; showgrid(); } catch (Exception) { string script2 = "alert('Please enter the valid dates');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script2, true); } }