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 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); } } }
public List <VacancyBO> deleteApprovedVacancyDispList(int empid) { try { SqlConnection conn = d.logindal(); SqlCommand cmd = new SqlCommand("select VR_VacancyRequestID from E_Link_Vacancy_request where VR_EmployeeID=" + empid, conn); SqlDataReader dr = cmd.ExecuteReader(); List <int> vacancyid = new List <int>(); while (dr.Read()) { int temp = (int)dr[0]; vacancyid.Add(temp); } cmd.Dispose(); dr.Dispose(); string vacancyidstring = ""; if (vacancyid.Count > 0) { vacancyidstring = vacancyid[0] + ""; for (int i = 1; i < vacancyid.Count; i++) { vacancyidstring = vacancyidstring + "," + vacancyid[i]; } string query = "select * from E_Data_Vacancy where Vac_IsDeleted <> 1 and Vac_ApprovalStatus = 'Approved' and Vac_Hasappliedfordeletion <> 1 and Vac_VacancyID IN (" + vacancyidstring + ")"; cmd = new SqlCommand(query, conn); dr = cmd.ExecuteReader(); List <VacancyBO> vbolist = new List <VacancyBO>(); while (dr.Read()) { VacancyBO vbo = new VacancyBO(); vbo.id = (int)dr[0]; vbo.noof_vacancies = (int)dr[1]; vbo.skills = dr[2].ToString(); vbo.experience = (int)dr[3]; vbo.location = dr[4].ToString(); vbo.domain = dr[5].ToString(); vbo.date = dr[6].ToString(); vbo.date = vbo.date.Substring(0, 9); vbo.status = dr[7].ToString(); vbolist.Add(vbo); } return(vbolist); } else { return(null); } } catch (Exception e) { Console.Write(e.Message); return(null); } }
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); } }
public int UpdateRecInVacancy(VacancyBO vbo) { string ConnectionString = "Data Source=ingnrilpsql02;" + "Initial Catalog=AHD13_AMS60;" + "User id=a36;" + "Password=a36;"; SqlConnection connection = new SqlConnection(ConnectionString); //Connection is opened using Open method //create command object SqlCommand command = new SqlCommand(); //Set command type as stored procedure command.CommandType = CommandType.StoredProcedure; //Command text is stored procedure name if command type is stored command.CommandText = "sp_UpdateRecID"; //Used to relate command object to connection command.Connection = connection; //Used to pass parameter to procedure command.Parameters.AddWithValue("@RecruitmentRequestID", vbo.RecruitmentRequestID); command.Parameters.AddWithValue("@VacancyID", vbo.VacancyID); try { connection.Open(); int rowsAffected = command.ExecuteNonQuery(); connection.Close(); if (rowsAffected > 0) { return(1); } else { return(rowsAffected); } } catch (SqlException ex) { Console.WriteLine(ex.Message); } finally { command.Dispose(); connection.Dispose(); connection.Close(); } return(0); }
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); } }
public DataTable DisplayVacancyByRecID(VacancyBO vbo) { string ConnectionString = "Data Source=ingnrilpsql02;" + "Initial Catalog=AHD13_AMS60;" + "User id=a36;" + "Password=a36;"; DataTable dt = new DataTable(); SqlConnection connection = new SqlConnection(ConnectionString); SqlCommand command = new SqlCommand(); //Set command type as stored procedure command.CommandType = CommandType.StoredProcedure; //Command text is stored procedure name if command type is stored command.CommandText = "sp_GetRecruitmentRequestByRecID"; //Used to relate command object to connection command.Connection = connection; //Used to pass parameter to procedure command.Parameters.AddWithValue("@RecruitmentRequestID", vbo.RecruitmentRequestID); try { connection.Open(); // command.ExecuteNonQuery(); SqlDataReader reader = command.ExecuteReader(); dt.Load(reader); connection.Close(); } catch (SqlException ex) { } finally { command.Dispose(); connection.Close(); connection.Dispose(); } return(dt); }
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 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(); }
public int UpdateVacancy(VacancyBO upbo) { string ConnectionString = "Data Source=ingnrilpsql02;" + "Initial Catalog=AHD13_AMS60;" + "User id=a36;" + "Password=a36;"; SqlConnection connection = new SqlConnection(ConnectionString); //Connection is opened using Open method //create command object SqlCommand command = new SqlCommand(); //Set command type as stored procedure command.CommandType = CommandType.StoredProcedure; //Command text is stored procedure name if command type is stored command.CommandText = "sp_UpdateVacancy"; //Used to relate command object to connection command.Connection = connection; //Used to pass parameter to procedure command.Parameters.AddWithValue("@VacancyID", upbo.VacancyID); command.Parameters.AddWithValue("@NoOfPositions", upbo.NoOfPositions); command.Parameters.AddWithValue("@Skills", upbo.Skills); command.Parameters.AddWithValue("@Experience", upbo.Experience); command.Parameters.AddWithValue("@Location", upbo.Location); command.Parameters.AddWithValue("@BusinessDomain", upbo.BusinessDomain); command.Parameters.AddWithValue("@RequiredByDate", upbo.RequiredByDate); //SqlParameter outputparameter = new SqlParameter(); //outputparameter.ParameterName = "@VacancyID"; //outputparameter.SqlDbType = System.Data.SqlDbType.Int; //outputparameter.Direction = System.Data.ParameterDirection.Output; //command.Parameters.Add(outputparameter); ////Denotes that id is a output parameter //command.Parameters["@id"].Direction=ParameterDirection.Output; ////Used to execute command try { connection.Open(); int rowAffected = command.ExecuteNonQuery(); connection.Close(); ////Connection should be closed after use. Its done using close method // Used to return the value of output parameter if (rowAffected > 0) { return(1); } else { //returntype = false; return(rowAffected); } } catch (SqlException ex) { Console.WriteLine(ex.Message); } finally { command.Dispose(); connection.Dispose(); connection.Close(); } return(0); }
public int DeleteRecInVacancy(VacancyBO vbo) { VacancyDB db = new VacancyDB(); return(db.DeleteRecInVacancy(vbo)); }
public DataTable DisplayVacancyByRecID(VacancyBO vbo) { VacancyDB db = new VacancyDB(); return(db.DisplayVacancyByRecID(vbo)); }
public int UpdateRecInVacancy(VacancyBO vbo) { VacancyDB vdb = new VacancyDB(); return(vdb.UpdateRecInVacancy(vbo)); }
public int UpdateVacancy(VacancyBO upbo) { VacancyDB up = new VacancyDB(); return(up.UpdateVacancy(upbo)); }
public bool AddVacancy(VacancyBO vac) { VacancyDB db = new VacancyDB(); return(db.AddVacancy(vac)); }