| Server IP : 104.21.93.206  /  Your IP : 108.162.241.225 Web Server : Microsoft-IIS/10.0 System : Windows NT WAVE 10.0 build 20348 (Windows Server 2016) AMD64 User : IWPD_458(indias) ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : D:/inetpub/vhosts/indiasmartbazaar.com/pimsharyana.in/ | 
| Upload File : | 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Net.Mail;
using System.Net;
using System.IO;
public partial class applynow : System.Web.UI.Page
{
    SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString);
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Getdetails();
        }
    }
    private void Getdetails()
    {
        if (Request.QueryString.ToString() != "" && Request.QueryString.ToString() != null)
        {
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString);
            SqlCommand SqlCmd = new SqlCommand("SP_Get_Job", conn);
            SqlCmd.CommandType = CommandType.StoredProcedure;
            SqlCmd.Parameters.Add("@ID", SqlDbType.Int).Value = Request.QueryString["ID"].ToString();
            conn.Open();
            SqlDataAdapter Da = new SqlDataAdapter(SqlCmd);
            DataTable Dt = new DataTable();
            Da.Fill(Dt);
            conn.Close();
            if (Dt.Rows.Count > 0)
            {
                lblhead.Text = Dt.Rows[0]["jobpost"].ToString();
            }
        }
    }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        if (fileUploader.HasFile)
        {
            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;
            MailMessage mail = new MailMessage();
            mail.From = new MailAddress("[email protected]"); //IMPORTANT: This must be same as your smtp authentication address.
            mail.To.Add("[email protected]");
            mail.IsBodyHtml = true;
            //set the content 
            mail.Subject = "Job Resume " + txtname.Text;
            mail.Body = "Job Resume from " + txtname.Text + " <br> Name : " + txtname.Text;
            if (fileUploader.HasFile)
            {
                string fileName = Path.GetFileName(fileUploader.PostedFile.FileName);
                mail.Attachments.Add(new Attachment(fileUploader.PostedFile.InputStream, fileName));
            }
            //send the message 
            SmtpClient smtp = new SmtpClient("Mail5008.site4now.net", 25);
            //IMPORANT:  Your smtp login email MUST be same as your FROM address. 
            NetworkCredential Credentials = new NetworkCredential("[email protected]", "Urmylifeak@123");
            smtp.Credentials = Credentials;
            try
            {
                smtp.Send(mail);
            }
            catch (Exception ex)
            {
                Exception ex2 = ex;
                string errorMessage = string.Empty;
                while (ex2 != null)
                {
                    errorMessage += ex2.ToString();
                    ex2 = ex2.InnerException;
                }
                //Page.RegisterStartupScript("UserMsg", "<script>alert('Sending Failed...');if(alert){ window.location='SendMail.aspx';}</script>");
            }
            ///////////////////////////
            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;
            MailMessage mail2 = new MailMessage();
            mail2.From = new MailAddress("[email protected]"); //IMPORTANT: This must be same as your smtp authentication address.
            mail2.To.Add(txtEmail.Text);
            mail2.IsBodyHtml = true;
            //set the content 
            mail2.Subject = "Reply from PIMS";
            mail2.Body = "Thanks for contact Us! We will contact you As soon as Possible";
            //send the message 
            SmtpClient smtp2 = new SmtpClient("Mail5008.site4now.net", 25);
            //IMPORANT:  Your smtp login email MUST be same as your FROM address. 
            NetworkCredential Credentials2 = new NetworkCredential("[email protected]", "Urmylifeak@123");
            smtp2.Credentials = Credentials2;
            try
            {
                smtp2.Send(mail2);
            }
            catch (Exception ex)
            {
                Exception ex2 = ex;
                string errorMessage = string.Empty;
                while (ex2 != null)
                {
                    errorMessage += ex2.ToString();
                    ex2 = ex2.InnerException;
                }
                //Page.RegisterStartupScript("UserMsg", "<script>alert('Sending Failed...');if(alert){ window.location='SendMail.aspx';}</script>");
            }
            SqlCommand cmd = new SqlCommand("SP_Apply", con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@job_title", SqlDbType.NVarChar).Value = lblhead.Text;
            cmd.Parameters.Add("@name", SqlDbType.NVarChar).Value = txtname.Text;
            cmd.Parameters.Add("@phone", SqlDbType.NVarChar).Value = txtPhone.Text;
            cmd.Parameters.Add("@email", SqlDbType.NVarChar).Value = txtEmail.Text;
            cmd.Parameters.Add("@qualfication", SqlDbType.NVarChar).Value = txtQalifcation.Text;
            cmd.Parameters.Add("@experince", SqlDbType.NVarChar).Value = txtExperince.Text;
            cmd.Parameters.Add("@address", SqlDbType.NVarChar).Value = txtAddress.Text;
            cmd.Parameters.Add("@resume", SqlDbType.NVarChar).Value = string.Empty;
            con.Open();
            int RA = cmd.ExecuteNonQuery();
            con.Close();
            if (RA > 0)
            {
                lblsucess.Visible = true;
                txtname.Text = string.Empty;
                txtPhone.Text = string.Empty;
                txtEmail.Text = string.Empty;
                txtQalifcation.Text = string.Empty;
                txtExperince.Text = string.Empty;
                txtAddress.Text = string.Empty;
                txtAddress.Text = string.Empty;
            }
            else
            {
                lblfailed.Visible = true;
            }
        }
        else
        {
            lblchoose.Visible = true;
        }
          
    }
}