Browse Source

validation

master
Gregory Rudolph 4 years ago
parent
commit
75f224d016
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 3
      Pages/Index.cshtml.cs
  2. 7
      Posting.cs

3
Pages/Index.cshtml.cs

@ -58,7 +58,10 @@ namespace StateJobsNYSubmit.Pages
if (vacancyID != null && !vacancyID.Trim().Equals("")) if (vacancyID != null && !vacancyID.Trim().Equals(""))
{ {
posting = new Posting(vacancyID); posting = new Posting(vacancyID);
if (!string.IsNullOrEmpty(Request.Form["SkillCheckboxes"]))
{
this.CoverLetter = posting.GenerateLetter(coverLetterFormat, userData, Request.Form["SkillCheckboxes"]); this.CoverLetter = posting.GenerateLetter(coverLetterFormat, userData, Request.Form["SkillCheckboxes"]);
}
this.Posting_ID = vacancyID; this.Posting_ID = vacancyID;
} }
else else

7
Posting.cs

@ -89,13 +89,18 @@ public class Posting
this.VacancyID = id; this.VacancyID = id;
} }
public string GenerateLetter(string s, UserData data, string skills) { public string GenerateLetter(string s, UserData data, string skills)
{
string ret = "" + s; string ret = "" + s;
ret = ret.Replace("$name", this.ContactName); ret = ret.Replace("$name", this.ContactName);
ret = ret.Replace("$vacancy", this.VacancyID); ret = ret.Replace("$vacancy", this.VacancyID);
ret = ret.Replace("$title", this.Title); ret = ret.Replace("$title", this.Title);
ret = ret.Replace("$box", this.BoxNumber); ret = ret.Replace("$box", this.BoxNumber);
if (!string.IsNullOrEmpty(data.email))
{
ret = ret.Replace("$email", data.email); ret = ret.Replace("$email", data.email);
}
string skillRet = "• " + skills.Replace(",", "• "); string skillRet = "• " + skills.Replace(",", "• ");
ret = ret.Replace("$skills", skillRet); ret = ret.Replace("$skills", skillRet);

Loading…
Cancel
Save