protected void grdpc_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = grdpc.Rows[e.RowIndex]; HiddenField hdnID = (HiddenField)row.FindControl("hdnID"); TextBox name = (TextBox)row.FindControl("txtname"); TextBox pwd = (TextBox)row.FindControl("txtpwd"); TextBox location = (TextBox)row.FindControl("txtloc"); DropDownList loc1 = (DropDownList)row.FindControl("ddlloc1"); PlacementConsultantBO bo = new PlacementConsultantBO(); bo.pcid = Convert.ToInt32(hdnID.Value.ToString()); bo.pcname = Convert.ToString(name.Text); bo.pwd = Convert.ToString(pwd.Text); bo.loc = Convert.ToString(loc1.Text); PlacementConsultantBL update = new PlacementConsultantBL(); int result1 = update.UpdatePC(bo); if (result1 == 1) { Page.ClientScript.RegisterStartupScript(this.GetType(), "alertkey", "<script>alert('Details Updated successfully');</script>", false); } grdpc.EditIndex = -1; bind(); }
protected void grdpc_RowDeleting(object sender, GridViewDeleteEventArgs e) { GridViewRow row = grdpc.Rows[e.RowIndex]; HiddenField hdnID = (HiddenField)row.FindControl("hdnID"); PlacementConsultantBL del = new PlacementConsultantBL(); RecruitmentRequestBL rbl = new RecruitmentRequestBL(); RecruitmentRequestBO rbo = new RecruitmentRequestBO(); rbo.pcid = Convert.ToInt32(hdnID.Value); int Associated = rbl.CheckPC(rbo); if (Associated != 0) { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Placement Consultant can't be deleted as " + Associated + " recruitment requests are associated with him/her.');window.location='HDeletePC.aspx';", true); return; } int result = del.DeletePC(Convert.ToInt32(hdnID.Value)); ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Vacancy deleted successfully');", true); //Move to normal mode grdpc.EditIndex = -1; bind(); }
protected void btnSubmit_Click(object sender, EventArgs e) { string name = txtpcname.Text; string pwd = txtPwd.Text; string loc = ddlloc.SelectedValue; int HRID = Convert.ToInt32(Session["UserID"].ToString()); PlacementConsultantBO bo = new PlacementConsultantBO(); bo.pcname = name; bo.pwd = pwd; bo.loc = loc; bo.HRID = HRID; PlacementConsultantBL bl1 = new PlacementConsultantBL(); int result = bl1.AddPlacementConsultant(bo); if (result == 1) { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Placement Consultant added successfully');window.location='HRHome.aspx';", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", "alert('Failure')", true); } }
public void bind() { int empid = Int32.Parse(Session["UserID"].ToString()); PlacementConsultantBL vac2 = new PlacementConsultantBL(); DataTable dt1 = vac2.GetPC(empid); grdpc.DataSource = dt1; grdpc.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { gv1.Visible = false; if (Session["UserName"] == null) { Response.Redirect("~/WelcomePage.aspx"); } else { lblUser.Text = Session["UserName"].ToString(); if (!IsPostBack) { ddlPCID.Visible = true; lblSelect.Visible = true; ddlReqDate.Visible = true; lblSelect2.Visible = true; PlacementConsultantBL pbl = new PlacementConsultantBL(); List <int> pcList = new List <int>(); pcList = pbl.GetDDLPC(); ddlPCID.DataSource = pcList; ddlPCID.AppendDataBoundItems = true; ddlPCID.DataBind(); RecruitmentRequestBL rbl = new RecruitmentRequestBL(); List <string> rdList = new List <string>(); rdList = rbl.GetDDLRD(); ddlReqDate.DataSource = rdList; ddlReqDate.AppendDataBoundItems = true; ddlReqDate.DataBind(); RecruitmentRequestBL bl = new RecruitmentRequestBL(); DataTable result = bl.GetRecReqDetails(); gv1.DataSource = result; gv1.DataBind(); if (gv1.Rows.Count == 0) { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('There are no recruitment requests to display');window.location='HRHome.aspx';", true); } } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserName"] == null) { Response.Redirect("~/WelcomePage.aspx"); } else { lblUser.Text = Session["UserName"].ToString(); int empid = Int32.Parse(Session["UserID"].ToString()); PlacementConsultantBL pc1 = new PlacementConsultantBL(); DataTable dt1 = pc1.GetPC(empid); grdpc.DataSource = dt1; grdpc.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserName"] == null) { Response.Redirect("~/WelcomePage.aspx"); } else { lblUser.Text = Session["UserName"].ToString(); if (!IsPostBack) { VacancyBL vbl = new VacancyBL(); DataTable res = vbl.GetAllApprovedVacancy(); gv1.DataSource = res; gv1.DataBind(); if (gv1.Rows.Count == 0) { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('No Vacancies to add.');window.location='HRHome.aspx';", true); btnSubmit.Visible = false; ddlpcid.Visible = false; lblNoV.Visible = false; } PlacementConsultantBL bl = new PlacementConsultantBL(); List <int> pclist = new List <int>(); pclist = bl.GetDDLPC(); ddlpcid.DataSource = pclist; ddlpcid.AppendDataBoundItems = true; ddlpcid.DataBind(); } } }