示例#1
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            //get max size from web.config
            int __maxuploadsz = Convert.ToInt32(ConfigurationManager.AppSettings["maxfilesize"]);

            var    emp    = new DlEmailprocessor();
            string embody = emp.Emaildirapps(1, TextBox3.Text + " " + TextBox4.Text).ToString();
            string fname  = FileUpload1.FileName;
            string ext    = string.Empty;

            ext = Getextension(fname);

            if (FileUpload1.HasFile)
            {
                if (ext != "none")
                {
                    if (FileUpload1.FileContent.Length < __maxuploadsz)
                    {
                        string subjects =
                            emp.Dbemailgenerator(Convert.ToInt16(Request.QueryString["JobID"])).ToString();

                        Adddata(fname);

                        //you can remove try catch blocks they were in place in case you
                        //dont have email server running smoothly

                        try
                        {
                            emp.Clemail.Sendmailproc(TextBox6.Text, "Application Confirmation: " + subjects, embody, 1);
                            emp.Sendappemaildbupdate(TextBox6.Text, 0);
                        }

                        catch (Exception)
                        {
                            //error in email
                        }

                        //send user confirmation, this should ideally be in try block
                        Session["reasons"] = "Thank you for applying, we wish you best of luck with your application!!!";
                        Response.Redirect("~/confirm.aspx");
                    }

                    else
                    {
                        //error file size
                    }
                }

                else
                {
                    //error file extension
                }
            }

            else
            {
                //error no file
            }
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            //get max size from web.config
            int __maxuploadsz = Convert.ToInt32(ConfigurationManager.AppSettings["maxfilesize"]);

            var emp = new DlEmailprocessor();
            string embody = emp.Emaildirapps(1, TextBox3.Text + " " + TextBox4.Text).ToString();
            string fname = FileUpload1.FileName;
            string ext = string.Empty;
            ext = Getextension(fname);

            if (FileUpload1.HasFile)
            {
                if (ext != "none")
                {
                    if (FileUpload1.FileContent.Length < __maxuploadsz)
                    {
                        string subjects =
                            emp.Dbemailgenerator(Convert.ToInt16(Request.QueryString["JobID"])).ToString();

                        Adddata(fname);

                        //you can remove try catch blocks they were in place in case you
                        //dont have email server running smoothly

                        try
                        {
                            emp.Clemail.Sendmailproc(TextBox6.Text, "Application Confirmation: " + subjects, embody, 1);
                            emp.Sendappemaildbupdate(TextBox6.Text, 0);
                        }

                        catch (Exception)
                        {
                            //error in email
                        }

                        //send user confirmation, this should ideally be in try block
                        Session["reasons"] = "Thank you for applying, we wish you best of luck with your application!!!";
                        Response.Redirect("~/confirm.aspx");
                    }

                    else
                    {
                        //error file size
                    }
                }

                else
                {
                    //error file extension
                }
            }

            else
            {
                //error no file
            }
        }
示例#3
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            int __maxuploadsz = Convert.ToInt32(ConfigurationManager.AppSettings["maxfilesize"]);

            var emp = new DlEmailprocessor();

            string embody = emp.Emaildirapps(1, "").ToString();
            string fname  = FileUpload1.FileName;
            string __ext  = string.Empty;

            __ext = Getextension(fname);

            if (FileUpload1.HasFile)
            {
                if (__ext != "none")
                {
                    if (FileUpload1.FileContent.Length < __maxuploadsz)
                    {
                        adddata(fname);
                        try
                        {
                            emp.Clemail.Sendmailproc(Session["pusername"].ToString(),
                                                     "Application Confirmation: Recruiter Name/Job Name", embody, 2);
                            emp.Sendappemaildbupdate(Session["pusername"].ToString(), 1);
                        }
                        catch (Exception)
                        {
                        }

                        //for production move this to try/catch block
                        Session["reasons"] = "Thank you for applying, we wish you best of luck with your application!!!";
                        Response.Redirect("~/confirm.aspx");
                    }

                    else
                    {
                        //error too large size permitted is approx 2mb
                    }
                }
                else
                {
                    //error not valid extension
                }
            }

            else
            {
                //no file error
            }
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            int __maxuploadsz = Convert.ToInt32(ConfigurationManager.AppSettings["maxfilesize"]);

            var emp = new DlEmailprocessor();

            string embody = emp.Emaildirapps(1, "").ToString();
            string fname = FileUpload1.FileName;
            string __ext = string.Empty;
            __ext = Getextension(fname);

            if (FileUpload1.HasFile)
            {
                if (__ext != "none")
                {
                    if (FileUpload1.FileContent.Length < __maxuploadsz)
                    {
                        adddata(fname);
                        try
                        {
                            emp.Clemail.Sendmailproc(Session["pusername"].ToString(),
                                             "Application Confirmation: Recruiter Name/Job Name", embody, 2);
                            emp.Sendappemaildbupdate(Session["pusername"].ToString(), 1);
                        }
                        catch (Exception)
                        {
                        }

                        //for production move this to try/catch block
                        Session["reasons"] = "Thank you for applying, we wish you best of luck with your application!!!";
                        Response.Redirect("~/confirm.aspx");
                    }

                    else
                    {
                        //error too large size permitted is approx 2mb
                    }
                }
                else
                {
                    //error not valid extension
                }
            }

            else
            {
                //no file error
            }
        }