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) { 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) { //set culture to british //modify here in future if this needs to be set to us formats var cinf = new CultureInfo("en-GB"); DateTime dobsdate = Convert.ToDateTime(TextBox17.Text, cinf); string dobdate1 = dobsdate.ToString("MM/dd/yyyy"); var clog = new DlLogins(); if (Request.QueryString["CRF"] == "1") { if (clog.Checkcanusern(TextBox11.Text) != TextBox11.Text) { //add users var mpg = new DlMainpagepopulator(); var phash = new ClPwdhash(); int mxuserid = mpg.Maxuserid(); int mxcandidateid = mpg.Maxcandidateid(); string hashpwd = phash.GetMd5Hash(TextBox12.Text); //add activation id and send it in email var rands1 = new Random(); string makehashp = phash.GetMd5Hash(rands1.Next(10000, 100000).ToString(CultureInfo.InvariantCulture)); //add users mpg.Insertusers(TextBox11.Text, TextBox2.Text, 1, TextBox3.Text, hashpwd, 2, mxuserid, TextBox13.Text, mxcandidateid, makehashp); //add candidates mpg.Insertcandidates(mxcandidateid, TextBox2.Text + " " + TextBox3.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text, TextBox5.Text, TextBox6.Text, TextBox7.Text, TextBox8.Text, TextBox16.Text, TextBox9.Text, "", TextBox14.Text, TextBox15.Text, DateTime.Now.ToString("yyyy:MM:dd hh:mm:ss"), dobdate1); //send email. var emproc = new DlEmailprocessor(); //make email body string emailbod = emproc.Emailactivateusr( "https://ahrcloud.com/ActivateAccount.aspx?activationid=" + makehashp + "&usertype=2&username="******"AHRCLOUD: Account Activation!", emailbod, 3); //logg it as the entry for email emproc.Sendappemaildbupdate(TextBox11.Text, 2); Session["reasons"] = "Thank your for signing up, you are awsome! <br /> Please check your email to activate your account. <br /> "; //redirect to confirmation page Response.Redirect("~/confirm.aspx"); } else { Label26.Visible = true; } } else { //update candidates for required id //update users table var ccan = new DlCandidates(); //update candidates table ccan.Runcandidateupdate(TextBox2.Text, TextBox3.Text, TextBox4.Text, TextBox5.Text, TextBox6.Text, TextBox7.Text, TextBox8.Text, TextBox16.Text, dobdate1, TextBox9.Text, TextBox14.Text, TextBox15.Text, Session["pusername"].ToString()); } }
protected void Button2_Click(object sender, EventArgs e) { if (capts.Text == Session["capts"].ToString()) { //check if the current user exists in the database var lgeins = new DlLogins(); _fg = Convert.ToInt16(Request.QueryString["Fg"]); if (_fg == 1) { //update //update user rec information var yohrecl = new DlRecruiter(); yohrecl.Runrecuserupdate(TextBox2.Text, TextBox3.Text, Session["pusername"].ToString()); //update logo if (FileUpload1.PostedFile.FileName.Length > 1) { //get current article id for the logo. int tmpartid = yohrecl.Getarticleids(Session["pusername"].ToString()); //save to hlogo string hlogo = ConfigurationManager.AppSettings["filepth"] + tmpartid + FileUpload1.PostedFile.FileName; //update articles FileUpload1.PostedFile.SaveAs(hlogo); //update articles in db yohrecl.Runreclogoupdate(hlogo, "Recruiter Logo", Session["pusername"].ToString()); } //update recruiters own information yohrecl.Runrectableupdate(TextBox4.Text, TextBox5.Text, TextBox6.Text, TextBox7.Text, TextBox8.Text, TextBox9.Text, TextBox10.Text, TextBox15.Text, TextBox16.Text, TextBox14.Text, Session["pusername"].ToString()); } else { if (lgeins.Checkrecusern(TextBox11.Text) != TextBox11.Text) { //insert var mps = new DlMainpagepopulator(); var pwds = new ClPwdhash(); var arc = new DlArticles(); int getmaxrec = mps.RecHasRows() + 1; int getmaxrecarticles = getmaxrec + 10000000; int getmaxrecuserid = getmaxrec + 20000000; var rnd23 = new Random(); string shahsp = pwds.GetMd5Hash(rnd23.Next(10000, 100000).ToString(CultureInfo.InvariantCulture)); //set email body var emaps = new DlEmailprocessor(); string ebod1 = emaps.Emailactivateusr( "https://ahrcloud.com/ActivateAccount.aspx?activationid=" + shahsp + "&usertype=1&username="******"GB", TextBox9.Text, TextBox11.Text, TextBox15.Text, TextBox16.Text, TextBox14.Text, DateTime.Now.ToString("yyyy:MM:dd hh:mm:ss"), 1, getmaxrecarticles); //users and pwds string md5h = pwds.GetMd5Hash(TextBox12.Text); mps.Insertusers(TextBox11.Text, TextBox2.Text, 1, TextBox3.Text, md5h, 1, getmaxrecuserid, "hint", -1, shahsp); //employee logo string holdlogo = Path.GetFileName(FileUpload1.PostedFile.FileName); arc.AddArticle(getmaxrecarticles, holdlogo, ConfigurationManager.AppSettings["filepth"] + getmaxrecarticles + holdlogo); //real upload FileUpload1.PostedFile.SaveAs(ConfigurationManager.AppSettings["filepth"] + getmaxrecarticles + holdlogo); //user recruiter assignments mps.Insertrecusermapping(getmaxrecuserid, getmaxrec); //finally send out the email emaps.Clemail.Sendmailproc(TextBox11.Text, "AHRCLOUD: Account Activation!", ebod1, 4); //logg it as the entry for email emaps.Sendappemaildbupdate(TextBox11.Text, 1); } else { //user already exists Label24.Visible = true; } } } else { Label31.Text = "please retype the captcha as shown in grey box!"; } }