Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.IsPostBack == false)
     {
         TxtJobTitle.Focus();
         for (int i = 1; i <= 35; i++)
         {
             DdlExperience.Items.Add(new ListItem(i.ToString(), i.ToString()));
         }
         DdlExperience.Items.Insert(0, new ListItem("--Select--", "--Select--"));
         DdlExperience.Items.Insert(1, new ListItem("Fresher", "Fresher"));
         DdlExperience.Items.Insert(2, new ListItem("6 Months", "6 Months"));
         DdlDepartment.DataSource = Department.GetDepartmentRecords("status='Active'");
         DdlDepartment.DataBind();
         DdlDepartment.Items.Insert(0, new ListItem("--Select--", "--Select--"));
         DdlCompany.DataSource = CompanyDetails.GetCompanyDetailsRecords("status='Active'");
         DdlCompany.DataBind();
         DdlCompany.Items.Insert(0, new ListItem("--Select--", "--Select--"));
         DdlDesignation.DataSource = Designation.GetDesignationRecords("status='Active'");
         DdlDesignation.DataBind();
         DdlDesignation.Items.Insert(0, new ListItem("--Select--", "--Select--"));
         DataTable  ObjSkillTable = new DataTable();
         DataColumn ObjIdColumn   = new DataColumn("Id", typeof(int));
         ObjIdColumn.AllowDBNull   = false;
         ObjIdColumn.AutoIncrement = true;
         ObjSkillTable.Columns.Add(ObjIdColumn);
         DataColumn ObjSkillIdColumn = new DataColumn("SkillId", typeof(int));
         ObjSkillIdColumn.AllowDBNull = false;
         ObjSkillTable.Columns.Add(ObjSkillIdColumn);
         ViewState["SkillTable"] = ObjSkillTable;
     }
     LblDuplicateSkillName.Visible  = false;
     LblSelectBranchError.Visible   = false;
     LblSelectCheckBoxError.Visible = false;
 }
 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";
     }
 }