protected void BtnSave_Click(object sender, EventArgs e)
 {
     if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated == true)
     {
         if (JobPost_Save.GetJobPost_SaveRecords("JobPostId=" + Request.QueryString["Id"] + " and JobSeekerId=" + this.Page.User.Identity.Name).Rows.Count > 0)
         {
             LblMessage.Text     = "You have already saved this Job";
             LblMessage.CssClass = "text-danger";
             return;
         }
         else
         {
             JobPost_Save.AddJobPost_Save(int.Parse(this.Page.User.Identity.Name), int.Parse(Request.QueryString["Id"]));
             LblMessage.Text     = "Saved 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)
             {
                 MailMessage ObjMailMessage = new MailMessage();
                 ObjMailMessage.Subject = "You have successfully saved 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 Save";
         LblMessage.CssClass = "text-danger";
     }
 }
Ejemplo n.º 2
0
 public void ShowGridView()
 {
     GridViewSavedJobs.DataSource = JobPost_Save.GetJobPost_SaveRecords("JobSeekerId=" + this.Page.User.Identity.Name);
     GridViewSavedJobs.DataBind();
     LblNumberOfRecords.Text = GridViewSavedJobs.Rows.Count.ToString();
 }