protected void Page_Load(object sender, EventArgs e) { string[] queryString = Request.QueryString.GetValues("id"); link = queryString[0]; if (queryString == null) { Response.Redirect("PageNotFound.aspx"); } rta = new RecoTableAdapter(); status = bool.Parse(rta.GetRecoStatusByLink(queryString[0]).ToString()); appID = rta.GetAppIDByLink(queryString[0]).ToString(); name = rta.GetRecoNameByLink(queryString[0]).ToString(); recoID = rta.GetRecoIDByLink(queryString[0]).ToString(); //It means recommendation has been received and link is Invalid now if (status == true) { Response.Redirect("PageNotFound.aspx"); } recoPath = Server.MapPath("App_Data\\Applications\\" + appID); if (!Directory.Exists(recoPath)) { Directory.CreateDirectory("App_Data\\Applications\\" + appID); } recoPath = Server.MapPath("App_Data\\Applications\\" + appID + "\\" + recoID + "_" + name + ".txt"); }
protected void ApplicationWizard_NextButtonClick(object sender, WizardNavigationEventArgs e) { try { StudentTableAdapter sta = new StudentTableAdapter(); newAppID = Convert.ToInt32(sta.NextAppID()) + 1; string ext = Path.GetExtension(Resume.PostedFile.FileName).ToLower(); resumePath = Server.MapPath("App_Data\\Applications\\" + newAppID.ToString()); System.IO.Directory.CreateDirectory(resumePath); resumePath += "\\" + LastName.Text + "_" + FirstName.Text + ext; Resume.SaveAs(resumePath); if (Resume.HasFile) { bool isValid = false; if (Resume.PostedFile.ContentLength / 1024 < 500) { switch (ext) { case ".pdf": isValid = IsPDF(resumePath); break; case ".doc": isValid = IsDoc(resumePath); break; case ".docx": isValid = IsDoc(resumePath); break; } if (isValid) { //resumePath += "\\" + LastName.Text + "_" + FirstName.Text + ext; //Resume.SaveAs(resumePath); } else { Response.Write("<script>alert('The file entered is not in valid format. Please try again!!!')</script>"); return; } } else { Response.Write("<script>alert('The file entered is not in valid format. Please try again!!!')</script>"); return; } } else { Response.Write("<script>alert('The file entered is not in valid format. Please try again!!!')</script>"); return; } sta.InsertQuery(USCID.Text, FirstName.Text, LastName.Text, Email.Text, resumePath, Major.SelectedValue.ToString()); string randomString = System.Guid.NewGuid().ToString().Replace("-", string.Empty); RecoTableAdapter rta = new RecoTableAdapter(); rta.InsertQuery(R1Name.Text, R1Email.Text, randomString, false, newAppID); SendEmail(R1Email.Text, "Scholarship Application Recommendation Request", "Dear Mr. " + R1Name.Text + "," + System.Environment.NewLine + "We are contacting you because Mr. " + FirstName.Text + " " + LastName.Text + " has applied for scholarship to our department and you have been indicated as a recommender." + System.Environment.NewLine + "You are requested to recommend the applicant using the following link: " + Request.Url.GetLeftPart(UriPartial.Authority) + Page.ResolveUrl("recommend.aspx?id=" + randomString) + System.Environment.NewLine + "Thank you" + System.Environment.NewLine + Major.SelectedItem.Text + " Department"); randomString = System.Guid.NewGuid().ToString().Replace("-", string.Empty); rta.InsertQuery(R2Name.Text, R2Email.Text, randomString, false, newAppID); SendEmail(R2Email.Text, "Scholarship Application Recommendation Request", "Dear Mr. " + R2Name.Text + "," + System.Environment.NewLine + "We are contacting you because Mr. " + FirstName.Text + " " + LastName.Text + " has applied for scholarship to our department and you have been indicated as a recommender." + System.Environment.NewLine + "You are requested to recommend the applicant using the following link: " + Request.Url.GetLeftPart(UriPartial.Authority) + Page.ResolveUrl("recommend.aspx?id=" + randomString) + System.Environment.NewLine + "Thank you" + System.Environment.NewLine + Major.SelectedItem.Text + " Department"); SendEmail(Email.Text, "Scholarship Application Submitted", "Dear Mr. " + LastName.Text + "," + System.Environment.NewLine + "You have successfully applied for scholarship to " + Major.SelectedItem.Text + " Department" + System.Environment.NewLine + "Your application is under review. You will be notified once final decision is made." + System.Environment.NewLine + "You can check your status at " + Request.Url.GetLeftPart(UriPartial.Authority) + Page.ResolveUrl("trackStatus.aspx") + ". " + "Your ApplicationID is: " + newAppID + System.Environment.NewLine + System.Environment.NewLine + "Thank you" + System.Environment.NewLine + Major.SelectedItem.Text + " Department"); } catch (Exception exception) { Response.Write(exception.ToString()); //Response.Write("<script>alert('Error saving data. Try again.')</script>"); //Response.Redirect(Page.Request.Url.ToString(), true); } }