public void editDAL(VacancyRequestBO b1, int vacancyID) { SqlConnection con = new SqlConnection(consrting); con.Open(); SqlCommand cmd = new SqlCommand("update E_Data_vacancy set vac_noofpositions = '" + b1.NoOfPosition + "' , vac_skills = '" + b1.skills + "' , vac_experience = '" + b1.Experience + "' , vac_location = '" + b1.Location + "' , vac_business_domain = '" + b1.Domain + "' , vac_requiredBydate = '" + b1.RequireByDate + "' where vac_vacancyID = '" + vacancyID + "'", con); cmd.ExecuteNonQuery(); con.Close(); }
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); }
public int createvacancy(VacancyRequestBO vcbo, int id, string desg) { SqlConnection conn = d.logindal(); SqlCommand cmd = null; if (desg == "ASE") { cmd = new SqlCommand("insert into E_Data_Vacancy(Vac_NoOfPositions,Vac_Skills,Vac_Experience,Vac_Location,Vac_Business_Domain,Vac_RequiredByDate,Vac_Status,Vac_RecruitmentRequestID,Vac_ApprovalStatus,Vac_IsDeleted) values('" + Convert.ToInt32(vcbo.NoOfPosition) + "','" + Convert.ToString(vcbo.skills) + "','" + Convert.ToInt32(vcbo.Experience) + "','" + Convert.ToString(vcbo.Location) + "','" + Convert.ToString(vcbo.Domain) + "','" + Convert.ToDateTime(vcbo.RequireByDate) + "','Open',Null,'Pending',0)", conn); cmd.ExecuteNonQuery(); cmd.Dispose(); } else if (desg == "UH") { cmd = new SqlCommand("insert into E_Data_Vacancy(Vac_NoOfPositions,Vac_Skills,Vac_Experience,Vac_Location,Vac_Business_Domain,Vac_RequiredByDate,Vac_Status,Vac_RecruitmentRequestID,Vac_ApprovalStatus,Vac_IsDeleted) values('" + Convert.ToInt32(vcbo.NoOfPosition) + "','" + Convert.ToString(vcbo.skills) + "','" + Convert.ToInt32(vcbo.Experience) + "','" + Convert.ToString(vcbo.Location) + "','" + Convert.ToString(vcbo.Domain) + "','" + Convert.ToDateTime(vcbo.RequireByDate) + "','Open',Null,'Approved',0)", conn); cmd.ExecuteNonQuery(); cmd.Dispose(); } string n = "select max(Vac_VacancyId) from E_Data_Vacancy "; cmd = new SqlCommand(n, conn); SqlDataReader dr = cmd.ExecuteReader(); int x = 0; while (dr.Read()) { x = (int)dr[0]; } dr.Close(); cmd.Dispose(); cmd = new SqlCommand("Insert into E_Link_Vacancy_request values (" + x + "," + id + ")", conn); return(cmd.ExecuteNonQuery()); //conn.Close(); }
public int AddVacancyRequest(VacancyRequestBO 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_AddVacancyRequest"; //Used to relate command object to connection command.Connection = connection; //Used to pass parameter to procedure command.Parameters.AddWithValue("@EmployeeID", vbo.EmployeeID); command.Parameters.AddWithValue("@NoOfVacancies", vbo.NoOfVacancies); SqlParameter outputparameter = new SqlParameter(); outputparameter.ParameterName = "@VacancyRequestID"; outputparameter.SqlDbType = System.Data.SqlDbType.Int; outputparameter.Direction = System.Data.ParameterDirection.Output; command.Parameters.Add(outputparameter); try { connection.Open(); int rowAffected = command.ExecuteNonQuery(); ////Connection should be closed after use. Its done using close method // Used to return the value of output parameter if (rowAffected > 0) { return(Int32.Parse(command.Parameters["@VacancyRequestID"].Value.ToString())); } else { //returntype = false; return(rowAffected); } } catch (SqlException ex) { Console.WriteLine(ex.Message); } finally { command.Dispose(); connection.Dispose(); connection.Close(); } return(0); }
public void editBAL(VacancyRequestBO b1, int vacancyID) { d.editDAL(b1, vacancyID); }
public int AddVacancyRequest(VacancyRequestBO vbo) { VacancyRequestDB db = new VacancyRequestDB(); return(db.AddVacancyRequest(vbo)); }