protected void btnSubmit_Click(object sender, EventArgs e) { if (txtExperience == null) { txtExperience.Text = "0"; } VacancyBO bo = new VacancyBO(); bo.VacancyRequestID = Convert.ToInt32(txtVacReqID.Text); bo.NoOfPositions = Convert.ToInt32(txtNumberOfPositions.Text); bo.Skills = ddlSkills.SelectedValue.ToString(); bo.Experience = Convert.ToInt32(txtExperience.Text); bo.Location = ddlLocation.SelectedValue; bo.BusinessDomain = ddlDomain.SelectedValue; bo.RequiredByDate = Convert.ToDateTime(txtDate.Text); bo.RequestStatus = 1; // bo.RecruitmentRequestID = 0; bo.ApprovalStatus = "approved"; bo.EmployeeID = Convert.ToInt32(Session["UserID"].ToString()); VacancyBL bl = new VacancyBL(); //bool returnType = emp.AddEmployee(txtEmployeeName.Text, txtDesignation.Text, int.Parse(txtExperience.Text)); bool returnType = bl.AddVacancy(bo); if (returnType) { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Vacancy added successfully');window.location='UAddVacancyRequest.aspx';", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", "alert('Failure');window.location='UAddVacancyRequest.aspx';", true); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserName"] == null) { Response.Redirect("~/WelcomePage.aspx"); } else { lblUser.Text = "Welcome " + Session["UserName"].ToString(); //if (!IsPostBack) //{ int eid = Convert.ToInt32(Session["UserID"].ToString()); VacancyBL vb1 = new VacancyBL(); DataTable dt = vb1.GetVacancyList(eid); gv1.DataSource = dt; gv1.DataBind(); //} if (dt.Rows.Count == 0) { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('There are no pending vacancies');window.location='UnitheadHome.aspx';", true); } } }
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 bindData() { VacancyBL vbl = new VacancyBL(); DataTable res = vbl.GetAllApprovedVacancy(); gv1.DataSource = res; gv1.DataBind(); }
public void bind() { int empid = Int32.Parse(Session["UserID"].ToString()); VacancyBL vac2 = new VacancyBL(); DataTable dt1 = vac2.GetVacancy(empid); gv1.DataSource = dt1; gv1.DataBind(); }
protected void gv1_RowCommand(object sender, GridViewCommandEventArgs e) { int eid = Convert.ToInt32(Session["UserID"].ToString()); if (e.CommandName == "Approve") { VacancyBL vbl = new VacancyBL(); int result = vbl.ApproveStatus(eid, Convert.ToInt32(e.CommandArgument.ToString())); ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Status changed successfully');window.location='UApproveVacancies.aspx';", true); } }
protected void btndelete_Click(object sender, EventArgs e) { int flag = 0; int count = gv1.Rows.Count; int result1 = 0; int res = 0; foreach (GridViewRow gvr in gv1.Rows) { CheckBox chk = (CheckBox)gvr.FindControl("chk_select"); if (chk.Checked) { flag = flag + 1; Label vacidLabel = (Label)gvr.FindControl("lblname"); int vacids = Convert.ToInt32(vacidLabel.Text); VacancyBO vbo = new VacancyBO(); vbo.VacancyID = vacids; VacancyBL bl1 = new VacancyBL(); result1 = bl1.DeleteRecInVacancy(vbo); } } if (flag == 0) { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Select atleast 1 Vacancy.')", true); } else if (count == flag) { RecruitmentRequestBO bo = new RecruitmentRequestBO(); bo.recid = Convert.ToInt32(ddlRecID.SelectedValue.ToString()); RecruitmentRequestBL bl = new RecruitmentRequestBL(); res = bl.DeleteRecReq(bo); } if (result1 == 1 && res == 1) { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Recruitment Request is deleted successfully');window.location='HRHome.aspx';", true); } else if (result1 == 1) { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Vacancies from Recruitment Request deleted successfully');window.location='HRHome.aspx';", true); } else { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Error Occured');window.location='HRHome.aspx';", true); } }
protected void btnSubmit_Click(object sender, EventArgs e) { VacancyRequestBO vbo = new VacancyRequestBO(); vbo.EmployeeID = Int32.Parse(txtEmployeeID.Text); vbo.NoOfVacancies = Int32.Parse(txtNoV.Text); VacancyBL vbl = new VacancyBL(); int rt = vbl.AddVacancyRequest(vbo); Session["VacancyReq"] = rt; ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Vacancy Request added successfully');window.location='EAddVacancy.aspx';", true); }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserName"] == null) { Response.Redirect("~/WelcomePage.aspx"); } else { int empid = Int32.Parse(Session["UserID"].ToString()); lblUser.Text = "Welcome " + Session["UserName"].ToString(); VacancyBL vac1 = new VacancyBL(); DataTable dt1 = vac1.GetVacancy(empid); gv1.DataSource = dt1; gv1.DataBind(); } }
protected void gv1_RowDeleting(object sender, GridViewDeleteEventArgs e) { GridViewRow row = gv1.Rows[e.RowIndex]; HiddenField hdnID = (HiddenField)row.FindControl("hdnID"); VacancyBL del = new VacancyBL(); int result = del.DeleteVacancy(Convert.ToInt32(hdnID.Value)); ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Vacancy deleted successfully');", true); //Move to normal mode gv1.EditIndex = -1; bind(); }
protected void gv1_RowDeleting(object sender, GridViewDeleteEventArgs e) { GridViewRow row = gv1.Rows[e.RowIndex]; HiddenField hdnID = (HiddenField)row.FindControl("hdnID"); VacancyBL del = new VacancyBL(); int result = del.DeleteVacancy(Convert.ToInt32(hdnID.Value)); //Move to normal mode gv1.EditIndex = -1; bind(); }
protected void Submit_Click(object sender, EventArgs e) { btndelete.Visible = true; int recID = Convert.ToInt32(ddlRecID.SelectedValue.ToString()); VacancyBO vbo = new VacancyBO(); vbo.RecruitmentRequestID = recID; VacancyBL vbl = new VacancyBL(); DataTable dt = vbl.DisplayVacancyByRecID(vbo); gv1.DataSource = dt; gv1.DataBind(); if (dt.Rows.Count == 0) { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('There are no vacancies to display');", true); } }
protected void btnAdd_Click(object sender, EventArgs e) { ddlRecID.Visible = false; lblSelect.Visible = false; Submit.Visible = false; btnDeleteVac.Visible = false; btnAddVacancies.Visible = true; btnAdd.Visible = false; VacancyBL vbl = new VacancyBL(); DataTable res = vbl.GetAllApprovedVacancy(); gv1.DataSource = res; gv1.DataBind(); if (res.Rows.Count == 0) { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('There are no vacancies to add');window.location='HRHome.aspx';", true); } }
protected void gv1_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = gv1.Rows[e.RowIndex]; HiddenField hdnID = (HiddenField)row.FindControl("hdnID"); TextBox positions = (TextBox)row.FindControl("txtpositions"); DropDownList skills = (DropDownList)row.FindControl("ddlSkills"); //TextBox skills = (TextBox)row.FindControl("txtskills"); TextBox experience = (TextBox)row.FindControl("txtexp"); //TextBox location = (TextBox)row.FindControl("txtlocation"); DropDownList location = (DropDownList)row.FindControl("ddlLocation"); //TextBox domain = (TextBox)row.FindControl("txtdomain"); DropDownList domain = (DropDownList)row.FindControl("ddlDomain"); TextBox date = (TextBox)row.FindControl("txtdate"); VacancyBO upbo = new VacancyBO(); upbo.VacancyID = Convert.ToInt32(hdnID.Value.ToString()); upbo.NoOfPositions = Convert.ToInt32(positions.Text); upbo.Skills = Convert.ToString(skills.Text); upbo.Experience = Convert.ToInt32(experience.Text); upbo.Location = Convert.ToString(location.Text); upbo.BusinessDomain = Convert.ToString(domain.Text); upbo.RequiredByDate = Convert.ToDateTime(date.Text.ToString()); //Id is displayed in the page directly. Call the required method to delete customer by id //dCustomerDBb = new CustomerDB(); VacancyBL update = new VacancyBL(); int result1 = update.UpdateVacancy(upbo); //int result1 = update.UpdateVacancy(Convert.ToInt32(hdnID.Value), Convert.ToInt32(positions.Text),skills.Text,Convert.ToInt32(experience.Text),location.Text,domain.Text,Convert.ToDateTime(date.Text)); ////int result = db.updateCustomer(Convert.ToInt32(hdnID.Value), Convert.ToInt32(txtAge.Text)); if (result1 == 1) { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Vacancy updated successfully');", true); } gv1.EditIndex = -1; bind(); }
protected void btnDelete_Click(object sender, EventArgs e) { int flag = 0; int result1 = 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); VacancyBO vbo = new VacancyBO(); vbo.VacancyID = vacids; VacancyBL bl1 = new VacancyBL(); result1 = bl1.DeleteRecInVacancy(vbo); } } if (flag == 0) { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Select atleast 1 Vacancy.')", true); } else if (result1 == 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", "alert('Failure')", true); } else { ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Vacancies from recruitment Request deleted successfully');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(); 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(); } } }
protected void gv1_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = gv1.Rows[e.RowIndex]; HiddenField hdnID = (HiddenField)row.FindControl("hdnID"); TextBox positions = (TextBox)row.FindControl("txtpositions"); DropDownList skills = (DropDownList)row.FindControl("ddlSkills"); //TextBox skills = (TextBox)row.FindControl("txtskills"); TextBox experience = (TextBox)row.FindControl("txtexp"); //TextBox location = (TextBox)row.FindControl("txtlocation"); DropDownList location = (DropDownList)row.FindControl("ddlLocation"); //TextBox domain = (TextBox)row.FindControl("txtdomain"); DropDownList domain = (DropDownList)row.FindControl("ddlDomain"); TextBox date = (TextBox)row.FindControl("txtdate"); VacancyBO upbo = new VacancyBO(); upbo.VacancyID = Convert.ToInt32(hdnID.Value.ToString()); upbo.NoOfPositions = Convert.ToInt32(positions.Text); upbo.Skills = Convert.ToString(skills.Text); upbo.Experience = Convert.ToInt32(experience.Text); upbo.Location = Convert.ToString(location.Text); upbo.BusinessDomain = Convert.ToString(domain.Text); upbo.RequiredByDate = Convert.ToDateTime(date.Text.ToString()); DateTime today = DateTime.Now; if (date.Text == null || date.Text == "") { return; } DateTime reqDate = Convert.ToDateTime(date.Text); DateTime marginDate = today.AddMonths(2); if (reqDate < today) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", "alert('Enter future date')", true); date.Text = ""; return; } else if (reqDate > marginDate) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", "alert('Required date can not be more than two months from today')", true); date.Text = ""; return; } //Id is displayed in the page directly. Call the required method to delete customer by id //dCustomerDBb = new CustomerDB(); VacancyBL update = new VacancyBL(); int result1 = update.UpdateVacancy(upbo); //int result1 = update.UpdateVacancy(Convert.ToInt32(hdnID.Value), Convert.ToInt32(positions.Text),skills.Text,Convert.ToInt32(experience.Text),location.Text,domain.Text,Convert.ToDateTime(date.Text)); ////int result = db.updateCustomer(Convert.ToInt32(hdnID.Value), Convert.ToInt32(txtAge.Text)); if (result1 == 1) { Page.ClientScript.RegisterStartupScript(this.GetType(), "alertkey", "<script>alert('Details Updated successfully');</script>", false); } gv1.EditIndex = -1; bind(); }