protected void BtnApply_Click(object sender, EventArgs e)
    {
        if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated == true)
        {
            if (Applied_Jobs.GetApplied_JobsRecords("JobPostId=" + Request.QueryString["Id"] + " and JobSeekerId=" + this.Page.User.Identity.Name).Rows.Count > 0)
            {
                LblMessage.Text     = "You have already applied for this Job";
                LblMessage.CssClass = "text-danger" + " h4";
                return;
            }
            else
            {
                Applied_Jobs.AddApplied_Jobs(int.Parse(this.Page.User.Identity.Name), int.Parse(Request.QueryString["Id"]));
                LblMessage.Text     = "Applied Successfully";
                LblMessage.CssClass = "text-success";
                Person  ObjPerson  = new Person(int.Parse(this.Page.User.Identity.Name));
                JobPost ObjJobPost = new JobPost(int.Parse(Request.QueryString["Id"]));

                if (ObjPerson.EnableEmail == true)
                {
                    //throw new Exception("hiii");
                    MailMessage ObjMailMessage = new MailMessage();
                    ObjMailMessage.Subject = "You have successfully applied for a Job From Online Job Portal";
                    ObjMailMessage.Body    = "Job Title:" + ObjJobPost.JobTitle + "\nCompany: " + CompanyDetails.GetCompanyDetailsRecords("Id=" + ObjJobPost.CompanyId).Rows[0]["CompanyName"] + "\nDesignation:" + Designation.GetDesignationRecords("Id=" + ObjJobPost.DesignationId).Rows[0]["DesignationName"] + "\nDepartment :" + Department.GetDepartmentRecords("Id=" + ObjJobPost.DepartmentId).Rows[0]["DepartmentName"];
                    ObjMailMessage.From    = new MailAddress("*****@*****.**");
                    //ObjMailMessage.To.Add(new MailAddress("*****@*****.**"));
                    ObjMailMessage.To.Add(new MailAddress(ObjPerson.EmailId));
                    //ObjMailMessage.To.Add(new MailAddress("*****@*****.**"));
                    SmtpClient ObjSmtpClient = new SmtpClient();
                    ObjSmtpClient.Host        = "smtp.gmail.com";
                    ObjSmtpClient.Port        = 587;
                    ObjSmtpClient.EnableSsl   = true;
                    ObjSmtpClient.Credentials = new NetworkCredential("*****@*****.**", "Gigabyte786#");
                    try
                    {
                        ObjSmtpClient.Send(ObjMailMessage);
                    }
                    catch (Exception Ex)
                    {
                    }
                }
            }
        }
        else
        {
            LblMessage.Text     = "Please Login To Apply";
            LblMessage.CssClass = "text-danger";
        }
    }
 public void ShowGridView()
 {
     GridViewAppliedJobs.DataSource = Applied_Jobs.GetApplied_JobsRecords("JobSeekerId=" + this.Page.User.Identity.Name);
     GridViewAppliedJobs.DataBind();
     LblNumberOfRecords.Text = GridViewAppliedJobs.Rows.Count.ToString();
 }