// To retrieve all candidates from database public List <ICandidateProfile> getCandidates() { List <ICandidateProfile> lstCandidateProfile = new List <ICandidateProfile>(); SqlCommand myCommand; SqlConnection myConnection = DBUtility.getConnection(); try { using (myConnection) { myCommand = new SqlCommand("SP_getCandidates", myConnection); myCommand.CommandType = CommandType.StoredProcedure; myConnection.Open(); SqlDataReader objSqlDataReader = myCommand.ExecuteReader(); while (objSqlDataReader.Read()) { int CandidateProfileID = Convert.ToInt32(objSqlDataReader["CandidateProfileID"]); int VacancyID = Convert.ToInt32(objSqlDataReader["VacancyID"]); DateTime DOB = Convert.ToDateTime(objSqlDataReader["DOB"]); string Location = Convert.ToString(objSqlDataReader["Location"]); string Gender = Convert.ToString(objSqlDataReader["Gender"]); float Percentage_10 = Convert.ToSingle(objSqlDataReader["Percentage_10"]); float Percentage_12 = Convert.ToSingle(objSqlDataReader["Percentage_12"]); int GapInEducation = Convert.ToInt32(objSqlDataReader["GapInEducation"]); int GapInExperience = Convert.ToInt32(objSqlDataReader["GapInExperience"]); string ResumeFile = Convert.ToString(objSqlDataReader["ResumeFile"]); int TestID = Convert.ToInt32(objSqlDataReader["TestID"]); int TestStatus = Convert.ToInt32(objSqlDataReader["TestStatus"]); int MedicalTestStatus = Convert.ToInt32(objSqlDataReader["MedicalTestStatus"]); int BGCTestID = Convert.ToInt32(objSqlDataReader["BGCTestID"]); bool BGCTestStatus = Convert.ToBoolean(objSqlDataReader["BGCTestStatus"]); ICandidateProfile objcandidate = CandidateProfileFactory.create_Candidate(VacancyID, CandidateProfileID, DOB, Location, Gender, Percentage_10, Percentage_12, GapInEducation, GapInExperience, TestID, TestStatus, MedicalTestStatus, BGCTestID, BGCTestStatus, ResumeFile); lstCandidateProfile.Add(objcandidate); } objSqlDataReader.Close(); } return(lstCandidateProfile); } catch (Exception EE) { Console.WriteLine(EE); Console.Read(); return(null); } finally { myConnection.Close(); } }
// to save data into data base public int save(ICandidateProfile objCandidateProfile) { int result = 0; SqlCommand myCommand; SqlConnection myConnection = DBUtility.getConnection(); try { using (myConnection) { myCommand = new SqlCommand("sp_save", myConnection); myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.AddWithValue("@VacancyID", objCandidateProfile.get_VacancyID); myCommand.Parameters.AddWithValue("@DOB", objCandidateProfile.get_DOB); myCommand.Parameters.AddWithValue("@Location", objCandidateProfile.get_Location); myCommand.Parameters.AddWithValue("@Gender", objCandidateProfile.get_Gender); myCommand.Parameters.AddWithValue("@Percentage_10", objCandidateProfile.get_Percentage_10); myCommand.Parameters.AddWithValue("@Percentage_12", objCandidateProfile.get_Percentage_12); myCommand.Parameters.AddWithValue("@GapInEducation", objCandidateProfile.get_GapInEducation); myCommand.Parameters.AddWithValue("@GapInExperience", objCandidateProfile.get_GapInExperience); myCommand.Parameters.AddWithValue("@TestID", objCandidateProfile.get_TestID); myCommand.Parameters.AddWithValue("@TestStatus", objCandidateProfile.get_TestStatus); myCommand.Parameters.AddWithValue("@MedicalTestStatus", objCandidateProfile.get_MedicalTestStatus); myCommand.Parameters.AddWithValue("@BGCTestID", objCandidateProfile.get_BGCTestID); myCommand.Parameters.AddWithValue("@BGCTestStatus", objCandidateProfile.get_BGCTestStatus); myConnection.Open(); result = myCommand.ExecuteNonQuery(); } return(result); } catch (Exception EE) { Console.WriteLine(EE); Console.Read(); return(0); } finally { myConnection.Close(); } }
// To add candidates. public int AddCandidateProfile(ICandidateProfile cand) { try { ICandidateDB objCandidateDB = CandidateDBFactory.Create_CandidateDB(); VacancyManager objvacancymanager = new VacancyManager(); if (filledstatus_50percent(cand.get_VacancyID) == false) { if (filledstatus_bydate(cand.get_VacancyID) == false) { objCandidateDB.save(cand); return(1); } else if ((filledstatus_bydate(cand.get_VacancyID) == true) && (filledstatus_20percent(cand.get_VacancyID) == true)) { objvacancymanager.updateStatus(cand.get_VacancyID, 2); return(3); } else { return(0); } } else if ((filledstatus_50percent(cand.get_VacancyID) == true) && (filledstatus_bydate(cand.get_VacancyID) == true)) { objvacancymanager.updateStatus(cand.get_VacancyID, 2); return(2); } else { return(0); } } catch (Exception EX) { Console.WriteLine(EX); return(0); } }
// To update candidates public int candidate_update(ICandidateProfile objCandidateProfile) { ICandidateDB objCandidateDB = CandidateDBFactory.Create_CandidateDB(); return(objCandidateDB.updateCandidates(objCandidateProfile)); }
protected void submit_Click1(object sender, EventArgs e) { //dateinfo.ShortDatePattern = "DD/MM/YYYY"; ICandidateProfile objCandidateProfile = CandidateProfileFactory.create_Candidates(); objCandidateProfile.get_CandidateProfileID = (Int32)Session["CandidateProfileID"]; try { objCandidateProfile.get_DOB = Convert.ToDateTime(dob.Text); } catch (Exception) { string script = "alert('please enter date of birth in DD/MM/YYYY');"; ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script); } objCandidateProfile.get_Gender = gender.Text; objCandidateProfile.get_Location = location.Text; objCandidateProfile.get_Percentage_10 = Convert.ToSingle(tenth.Text); objCandidateProfile.get_Percentage_12 = Convert.ToSingle(twelfth.Text); if (gapsedu.SelectedItem.Text == "No") { objCandidateProfile.get_GapInEducation = 0; } else { objCandidateProfile.get_GapInEducation = Convert.ToInt32(gapsedu_months.Text); } if (gapsexp.SelectedItem.Text == "No") { objCandidateProfile.get_GapInExperience = 0; } else { objCandidateProfile.get_GapInExperience = Convert.ToInt32(gapsexp_months.Text); } objCandidateProfile.get_VacancyID = Convert.ToInt32(Session["VacancyID"]); objCandidateProfile.get_TestID = 0; objCandidateProfile.get_TestStatus = 0; objCandidateProfile.get_MedicalTestStatus = 0; objCandidateProfile.get_BGCTestID = 0; objCandidateProfile.get_BGCTestStatus = false; ICandidateManager objCandidateManager = CandidateManagerFactory.Candidate_Manager(); if (objCandidateManager.candidate_update(objCandidateProfile) == 1) { DialogResult result = MessageBox.Show(" Do you want to edit more candidates? ", "Success:", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { Response.Redirect("Edit_Candidates_byPC.aspx"); } else { Response.Redirect("Home_PlacementConsultant.aspx"); } } }
protected void submit_Click1(object sender, EventArgs e) { // date.ShortDatePattern="dd-MM-yyyy"; try { Session["VacancyID"] = ddl_vacancy.SelectedItem.Text; ICandidateProfile candidate = CandidateProfileFactory.create_Candidates(); candidate.get_DOB = Convert.ToDateTime(dob.Text); //catch (Exception) //{ // DialogResult result = MessageBox.Show(" Date of birth should be in the MM/DD/YYYY format. ", "Failure:", MessageBoxButtons.OK); //} candidate.get_Gender = gender.Text; candidate.get_Location = location.Text; candidate.get_Percentage_10 = Convert.ToSingle(tenth.Text); candidate.get_Percentage_12 = Convert.ToSingle(twelfth.Text); if (gapsedu.SelectedItem.Text == "No") { candidate.get_GapInEducation = 0; } else { candidate.get_GapInEducation = Convert.ToInt32(gapsedu_months.SelectedItem.Text); } if (gapsexp.SelectedItem.Text == "No") { candidate.get_GapInExperience = 0; } else { candidate.get_GapInExperience = Convert.ToInt32(gapsexp_months.SelectedItem.Text); } int intvacancyid = Convert.ToInt32(Convert.ToString(Session["VacancyID"])); candidate.get_VacancyID = intvacancyid; candidate.get_TestID = 0; candidate.get_TestStatus = 0; candidate.get_MedicalTestStatus = 0; candidate.get_BGCTestID = 0; candidate.get_BGCTestStatus = false; ICandidateManager objCandidateManager = CandidateManagerFactory.Candidate_Manager(); int inti = objCandidateManager.AddCandidateProfile(candidate); List <ICandidateProfile> lstCandidateProfile = new List <ICandidateProfile>(); lstCandidateProfile = objCandidateManager.display_candidate_toPC(); int CandidateID = 0; foreach (ICandidateProfile objCandidateProfile in lstCandidateProfile) { CandidateID = objCandidateProfile.get_CandidateProfileID; } string Requirebydate = ""; IVacancyManager objVacancyManager = VacancyManagerFactory.Create_VacancyManager(); List <IVacancy> lstVacancy = new List <IVacancy>(); foreach (IVacancy element in lstVacancy) { if (element.get_VacancyID == intvacancyid) { Requirebydate = Convert.ToString(element.get_RequiredByDate); break; } } if (inti == 1) { DialogResult result = MessageBox.Show(" Candidate with ID:" + CandidateID + " is Successfully added", "Success:", MessageBoxButtons.OK); Response.Redirect("Add_Candidates_byPC.aspx"); } else if (inti == 2) { DialogResult result = MessageBox.Show(" All candidates for Vacancy ID:" + intvacancyid + " are filled", "Failure:", MessageBoxButtons.OK); Response.Redirect("Add_Candidates_byPC.aspx"); } else if (inti == 3) { DialogResult result = MessageBox.Show(" Date has been expired for this vacancy ", "Failure:", MessageBoxButtons.OK); Response.Redirect("Add_Candidates_byPC.aspx"); } } catch (Exception) { } }
public CandidateProfileController(ICandidateProfile _repository) { this._repository = _repository; }
public static ICandidateProfile create_Candidates() { objCandidateProfile = new CandidateProfile(); return(objCandidateProfile); }
public static ICandidateProfile create_Candidate(int VacancyID, int CandidateProfileID, DateTime DOB, String Location, String Gender, float Percentage_10, float Percentage_12, int GapInEducation, int GapInExperience, int TestID, int TestStatus, int MedicalTestStatus, int BGCTestID, bool BGCTestStatus, String ResumeFile) { objCandidateProfile = new CandidateProfile(VacancyID, CandidateProfileID, DOB, Location, Gender, Percentage_10, Percentage_12, GapInEducation, GapInExperience, TestID, TestStatus, MedicalTestStatus, BGCTestID, BGCTestStatus, ResumeFile); return(objCandidateProfile); }
public DesignationController(ICandidateProfile _repository) { this._repository = _repository; }