protected void VSABtn_Click(object sender, EventArgs e)
        {
            HiddenField jobid = (HiddenField)VJFormView.FindControl("JobId");

            Session["currentjob"] = jobid.Value;
            Response.Redirect("ViewSelectedApplicant.aspx");
        }
        protected void DeleteBtn_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;

            cnn.Open();

            sql     = "Update Job set Status='Deleted' where [Job Id] = @jobid";
            command = new SqlCommand(sql, cnn);
            HiddenField jobid = (HiddenField)VJFormView.FindControl("JobId");

            command.Parameters.AddWithValue("jobid", jobid.Value);
            command.ExecuteNonQuery();
            sql     = "Update Application set Status='Rejected' where [JobId]=@jobid";
            command = new SqlCommand(sql, cnn);
            command.Parameters.AddWithValue("jobid", jobid.Value);
            command.ExecuteNonQuery();
            cnn.Close();
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Job Deleted Successfully')", true);
            Response.Redirect("Jobs.aspx");
        }
        protected void ApplyBtn_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     = "Insert into Application (JobId,SeekerId,Status) values(@jobid,@seekerid,@status) ";
            command = new SqlCommand(sql, cnn);
            HiddenField jobid = (HiddenField)VJFormView.FindControl("JobId");

            command.Parameters.AddWithValue("@jobid", jobid.Value);
            command.Parameters.AddWithValue("@seekerid", Session["Username"]);
            command.Parameters.AddWithValue("@status", "Pending");

            sql      = "Select * from Application where SeekerId=@seekerid and JobId=@jobid";
            command1 = new SqlCommand(sql, cnn);
            command1.Parameters.AddWithValue("@seekerid", Session["Username"]);
            command1.Parameters.AddWithValue("@jobid", jobid.Value);
            SqlDataAdapter sda1 = new SqlDataAdapter(command1);
            DataTable      dt1  = new DataTable();

            sda1.Fill(dt1);
            if (dt1.Rows.Count > 0)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Failed : Already applied')", true);
            }
            else
            {
                sql      = "Update Job set [Application Count]=[Application Count]+1 where [Job Id]=@jobid";
                command1 = new SqlCommand(sql, cnn);
                command1.Parameters.AddWithValue("@jobid", jobid.Value);
                SqlDataAdapter sda2 = new SqlDataAdapter(command1);
                DataTable      dt2  = new DataTable();
                sda2.Fill(dt2);
                command.ExecuteNonQuery();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Applied Successfully')", true);
            }
            cnn.Close();
        }
        protected void BindVJForm()
        {
            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 Job.[Job Id],Job.[Job Name],Job.[Category],Job.[Salary],Job.[Description],Job.[Job Provider Id],[Job Provider].[Company Name],[Job Provider].[Phone] from Job INNER JOIN [Job Provider] ON Job.[Job Provider Id] = [Job Provider].[username] where Job.[Status]='Available'";
            command = new SqlCommand(sql, cnn);
            SqlDataAdapter sda = new SqlDataAdapter(command);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            VJFormView.DataSource = dt;
            VJFormView.DataBind();
            cnn.Close();
        }
        protected void BindVJForm()
        {
            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 * from Job where Status !='Deleted' and [Job Provider Id]=@jpid";
            command = new SqlCommand(sql, cnn);
            command.Parameters.AddWithValue("@jpid", Session["Username"]);
            SqlDataAdapter sda = new SqlDataAdapter(command);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            VJFormView.DataSource = dt;
            VJFormView.DataBind();
            cnn.Close();
        }