protected void subApply(object sender, RepeaterCommandEventArgs e) { switch (e.CommandName) { case "ApplyNow": applicantsDataContext objApplicantDC = new applicantsDataContext(); applicant objNewApplicant = new applicant(); TextBox txtFname = (TextBox)e.Item.FindControl("txt_fnameApp"); TextBox txtLname = (TextBox)e.Item.FindControl("txt_lnameApp"); TextBox txtEmail = (TextBox)e.Item.FindControl("txt_emailApp"); TextBox txtPhone = (TextBox)e.Item.FindControl("txt_phoneApp"); TextBox txtMsg = (TextBox)e.Item.FindControl("txt_msgBox"); Label lblConfirm = (Label)e.Item.FindControl("lbl_confirmApply"); HiddenField hdfJobID = (HiddenField)e.Item.FindControl("hdf_jobID"); objNewApplicant.firstname = txtFname.Text; objNewApplicant.lastname = txtLname.Text; objNewApplicant.email = txtEmail.Text; objNewApplicant.job_id = int.Parse(hdfJobID.Value.ToString()); objApplicantDC.applicants.InsertOnSubmit(objNewApplicant); objApplicantDC.SubmitChanges(); txtFname.Text = ""; txtLname.Text = ""; txtEmail.Text = ""; txtPhone.Text = ""; txtMsg.Text = ""; lblConfirm.Text = "Your applicantion was sent successfully!"; break; case "Refresh": //_subRefresh(); //Response.Redirect("Career.aspx?tabIndex=0"); break; } }
public IQueryable<applicant> getApplicantByID(int _id) { applicantsDataContext objApplicantDC = new applicantsDataContext(); var allApplicants = objApplicantDC.applicants.Where(x => x.Id == _id).Select(x => x); return allApplicants; }
// this is what happens when admin chooses to delete an applicant public bool commitDelete(int _id) { applicantsDataContext objApplicantDC = new applicantsDataContext(); using (objApplicantDC) { var objDelApplicant = objApplicantDC.applicants.Single(x => x.Id == _id); objApplicantDC.applicants.DeleteOnSubmit(objDelApplicant); objApplicantDC.SubmitChanges(); return true; } }
// this is what happens when admin chooses to update an existing applicant's details public bool commitUpdate(int _id, string _fname, string _lname, string _email) { applicantsDataContext objApplicantDC = new applicantsDataContext(); using (objApplicantDC) { var objUpApplicant = objApplicantDC.applicants.Single(x => x.Id == _id); objUpApplicant.firstname = _fname; objUpApplicant.lastname = _lname; objUpApplicant.email = _email; objApplicantDC.SubmitChanges(); return true; } }
// this defines what will happen when admin chooses to insert a new applicant public bool commitInsert(int _jobID, string _fname, string _lname, string _email) { applicantsDataContext objApplicantDC = new applicantsDataContext(); using (objApplicantDC) { applicant objNewApplicant = new applicant(); objNewApplicant.firstname = _fname; objNewApplicant.lastname = _lname; objNewApplicant.email = _email; objNewApplicant.Id = _jobID; objApplicantDC.applicants.InsertOnSubmit(objNewApplicant); objApplicantDC.SubmitChanges(); return true; } }
public IQueryable<applicant> getApplicants() { applicantsDataContext objApplicantDC = new applicantsDataContext(); var allApplicants = objApplicantDC.applicants.Select(x => x); return allApplicants; }