protected void btnSubmit_Click(object sender, EventArgs e) { int result = 0; int pcid = Convert.ToInt32(ddlpcid.SelectedValue.ToString()); RecruitmentRequestBO rbo = new RecruitmentRequestBO(); rbo.pcid = pcid; rbo.Requested_Date = DateTime.Now; RecruitmentRequestBL rbl = new RecruitmentRequestBL(); result = rbl.AddRecruitmentRequest(rbo); if (result == 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", "alert('Failure');window.location='HRHome.aspx';", true); } else { int rec = result; int flag = 0; int result1 = 0; //int[] vacids; foreach (GridViewRow gvr in gv1.Rows) { CheckBox chk = (CheckBox)gvr.FindControl("chk_select"); if (chk.Checked) { flag = 1; Label vacidLabel = (Label)gvr.FindControl("lblname"); int vacids = Convert.ToInt32(vacidLabel.Text); int HRID = Convert.ToInt32(Session["UserID"].ToString()); VacancyBO vbo = new VacancyBO(); vbo.RecruitmentRequestID = rec; vbo.VacancyID = vacids; VacancyBL bl1 = new VacancyBL(); result1 = bl1.UpdateRecInVacancy(vbo); } } if (flag == 0) { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Select atleast 1 vacancy.');window.location='HAddRecReq.aspx';", true); } else if (result1 == 0) { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Failed to add Vacancy.');window.location='HRHome.aspx';", true); } else { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Recruitment Request added successfully');window.location='HRHome.aspx';", true); } } }
protected void btnAddVacancies_Click(object sender, EventArgs e) { int flag = 0; int res = 0; foreach (GridViewRow gvr in gv1.Rows) { CheckBox chk = (CheckBox)gvr.FindControl("chk_select"); if (chk.Checked) { flag = 1; Label vacidLabel = (Label)gvr.FindControl("lblname"); int vacids = Convert.ToInt32(vacidLabel.Text); int HRID = Convert.ToInt32(Session["UserID"].ToString()); VacancyBO vbo = new VacancyBO(); vbo.RecruitmentRequestID = Convert.ToInt32(ddlRecID.SelectedValue.ToString()); vbo.VacancyID = vacids; VacancyBL bl1 = new VacancyBL(); res = bl1.UpdateRecInVacancy(vbo); } } if (flag == 0) { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Select atleast 1 Vacancy.')", true); } else if (res == 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", "alert('Failure')", true); } else { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Vacancies are added to recruitment request successfully');window.location='HRHome.aspx';", true); } }