diff --git a/Pages/Index.cshtml.cs b/Pages/Index.cshtml.cs
index 1e70143..3f90ab6 100644
--- a/Pages/Index.cshtml.cs
+++ b/Pages/Index.cshtml.cs
@@ -58,7 +58,10 @@ namespace StateJobsNYSubmit.Pages
if (vacancyID != null && !vacancyID.Trim().Equals(""))
{
posting = new Posting(vacancyID);
- this.CoverLetter = posting.GenerateLetter(coverLetterFormat, userData, Request.Form["SkillCheckboxes"]);
+ if (!string.IsNullOrEmpty(Request.Form["SkillCheckboxes"]))
+ {
+ this.CoverLetter = posting.GenerateLetter(coverLetterFormat, userData, Request.Form["SkillCheckboxes"]);
+ }
this.Posting_ID = vacancyID;
}
else
diff --git a/Posting.cs b/Posting.cs
index 7429ac3..195998d 100644
--- a/Posting.cs
+++ b/Posting.cs
@@ -54,14 +54,14 @@ public class Posting
{
switch (i)
{
- case 0: this.Agency = link.InnerHtml.Trim(); break;
+ case 0: this.Agency = link.InnerHtml.Trim(); break;
case 1: this.Title = link.InnerHtml.Trim(); break;
case 2: this.OccupationalCategory = link.InnerHtml.Trim(); break;
case 3: this.SalaryGrade = link.InnerHtml.Trim(); break;
case 4: this.BargainingUnit = link.InnerHtml.Trim(); break;
- case 5: this.SalaryRange = link.InnerHtml.Trim(); break;
- case 6: this.EmploymentType = link.InnerHtml.Trim(); break;
- case 7: this.AppointmentType = link.InnerHtml.Trim(); break;
+ case 5: this.SalaryRange = link.InnerHtml.Trim(); break;
+ case 6: this.EmploymentType = link.InnerHtml.Trim(); break;
+ case 7: this.AppointmentType = link.InnerHtml.Trim(); break;
case 8: this.JurisdictionalClass = link.InnerHtml.Trim(); break;
case 9: this.TravelPercentage = link.InnerHtml.Trim(); break;
case 19: this.LocationAddress.Street = link.InnerHtml.Trim(); break;
@@ -89,13 +89,18 @@ public class Posting
this.VacancyID = id;
}
- public string GenerateLetter(string s, UserData data, string skills) {
+ public string GenerateLetter(string s, UserData data, string skills)
+ {
string ret = "" + s;
ret = ret.Replace("$name", this.ContactName);
ret = ret.Replace("$vacancy", this.VacancyID);
ret = ret.Replace("$title", this.Title);
ret = ret.Replace("$box", this.BoxNumber);
- ret = ret.Replace("$email", data.email);
+ if (!string.IsNullOrEmpty(data.email))
+ {
+
+ ret = ret.Replace("$email", data.email);
+ }
string skillRet = "• " + skills.Replace(",", "• ");
ret = ret.Replace("$skills", skillRet);