Exemple #1
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            connection.Open();
            string pid;

            //uid = (string)Session["uid"];
            pid = (string)Request.QueryString["pid"];
            string     sql        = "insert into notification(rid,uid,not_text,not_date,status,not_flag,user_flag)" + "values(" + Session["uid"] + "," + Request.QueryString["uid"] + ",'A Job Invitation from Recruiter',GETDATE(),'UNREAD',2,2)";
            SqlCommand sqlcommand = new SqlCommand(sql, connection);
            int        x          = sqlcommand.ExecuteNonQuery();

            sql        = "insert into invitations(rid,uid,message,status)" + "values(" + Session["uid"] + "," + Request.QueryString["uid"] + ",'" + txtMsg.Text + "','PENDING')";
            sqlcommand = new SqlCommand(sql, connection);
            x          = sqlcommand.ExecuteNonQuery();

            bool b = new NetworkCom().SendEmail(getEmailFromUid(uid), "Job Application", "You have applied to job recently");
            bool a = new NetworkCom().SendEmail(getEmailFromUidRecruiter(getRidFromPid(pid)), "Job Application", "A User has applied to your job recently");


            connection.Close();


            if (x > 0)
            {
                Response.Write("<Script>alert('Invitation sent Successfully '); window.location('ViewApplications.aspx?pid=" + Request.QueryString["pid"] + "');</Script>");
            }

            else
            {
                Response.Write("<Script>alert('Unable to Invite');</Script>");
            }
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string uid, pid;

            uid = (string)Session["uid"];
            pid = (string)Request.QueryString["pid"];

            if (isAlreadyApplied(uid, pid) > 0)
            {
                Response.Write("<Script>alert('You have already applied to this job');window.location='jobrecommended.aspx'</Script>");
            }
            else
            {
                string sql = "insert into ApplyJob(uid,pid)" +
                             "values(" + uid + "," + pid + ")";
                connection.Open();
                SqlCommand sqlcommand = new SqlCommand(sql, connection);
                int        x          = sqlcommand.ExecuteNonQuery();

                sql        = "insert into notification(rid,uid,not_text,not_date,status,not_flag,user_flag)" + "values(" + getRidFromPid(pid) + "," + uid + ",'A user has applied to job',GETDATE(),'UNREAD',1,1)";
                sqlcommand = new SqlCommand(sql, connection);
                x          = sqlcommand.ExecuteNonQuery();

                bool b = new NetworkCom().SendEmail(getEmailFromUid(uid), "Job Application", "You have applied to job recently");
                bool a = new NetworkCom().SendEmail(getEmailFromUidRecruiter(getRidFromPid(pid)), "Job Application", "A User has applied to your job recently");
                connection.Close();


                if (x > 0)
                {
                    Response.Write("<Script>alert('You have applied to this job successfully');window.location='jobrecommended.aspx'</Script>");
                }

                else
                {
                    Response.Write("<Script>alert('Unable to Apply');</Script>");
                }
            }
        }