protected void CancelBtn_Click(object sender, EventArgs e) { string connetionString; SqlConnection cnn; connetionString = @"Data Source=DESKTOP-NCLVKS1;Initial Catalog=E-Employment ;User ID=sa;Password=allohomora"; String sql; cnn = new SqlConnection(connetionString); SqlCommand command, command1; cnn.Open(); sql = "Delete Application where ApplicationId=@appid"; command = new SqlCommand(sql, cnn); HiddenField appid = (HiddenField)VAJFormView.FindControl("ApplicationId"); command.Parameters.AddWithValue("@appid", appid.Value); command.ExecuteNonQuery(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Application Cancelled')", true); cnn.Close(); Response.Redirect("JobsSeeker.aspx"); }
protected void BindVAJForm() { string connetionString; SqlConnection cnn; connetionString = @"Data Source=DESKTOP-NCLVKS1;Initial Catalog=E-Employment ;User ID=sa;Password=allohomora"; String sql; cnn = new SqlConnection(connetionString); SqlCommand command; cnn.Open(); sql = "Select Application.Status,Application.ApplicationId,Job.[Job Id],Job.[Job Name],Job.[Category],Job.[Salary],Job.[Description],Job.[Job Provider Id],[Job Provider].[Company Name],[Job Provider].[Phone] from Application INNER JOIN Job ON Job.[Job Id] = Application.JobId INNER JOIN [Job Provider] ON Job.[Job Provider Id] = [Job Provider].[username] where Application.SeekerId=@seekerid and Application.Status !='Rejected'"; command = new SqlCommand(sql, cnn); command.Parameters.AddWithValue("@seekerid", Session["username"]); SqlDataAdapter sda = new SqlDataAdapter(command); DataTable dt = new DataTable(); sda.Fill(dt); VAJFormView.DataSource = dt; VAJFormView.DataBind(); cnn.Close(); }