private string GetPathToHtmlFile(string folder) { // BL-4160 don't put an asterisk after the .htm. It is unnecessary as this search pattern // already returns both *.htm and *.html, but NOT *.htm.xyz [returns *.html only for Windows] // For both, "*.htm?" should work, but it doesn't return *.htm on Linux [Mono4 bug?]. var candidates = from x in Directory.GetFiles(folder, "*.htm") where !(Path.GetFileName(x).ToLowerInvariant().StartsWith("configuration.htm") || IsPathToReadMeHtm(x)) select x; if (!candidates.Any()) { candidates = from x in Directory.GetFiles(folder, "*.html") where !(Path.GetFileName(x).ToLowerInvariant().StartsWith("configuration.html")) select x; } if (candidates.Count() == 1) { return(candidates.First()); } else { var msg = new System.Text.StringBuilder(); msg.AppendLineFormat("There should only be a single htm(l) file in each folder ({0}). [not counting configuration.html or ReadMe-*.htm]:", folder); foreach (var f in candidates) { msg.AppendLineFormat(" {0}", f); } SIL.Reporting.ErrorReport.NotifyUserOfProblem(msg.ToString()); throw new ApplicationException(); } }
private static string CreateMailBody(Models.PersonalDetailsModel personalDetails, Models.CoverDetailsModel coverDetails) { //Gonna do a lot of append stuff for building a text email, // so totally not gonna do "string += string" var sb = new System.Text.StringBuilder(); sb.AppendLineFormat("New submission from \"{0} {1}\"", personalDetails.FirstName, personalDetails.LastName); sb.AppendLine(); sb.AppendLineFormat("Email address: {0}", personalDetails.EmailAddress); sb.AppendLineFormat("Primary phone Number: {0}", personalDetails.PrimaryPhoneNumber); sb.AppendLine(); sb.AppendLine("Reason for applying:"); sb.AppendLine(coverDetails.ReasonForApplying); sb.AppendLine(); sb.AppendLine("Why should we hire you:"); sb.AppendLine(coverDetails.ReasonForAcceptance); return(sb.ToString()); }
private static string CreateMailBody(Models.PersonalDetailsModel personalDetails, Models.CoverDetailsModel coverDetails) { //Gonna do a lot of append stuff for building a text email, // so totally not gonna do "string += string" var sb = new System.Text.StringBuilder(); sb.AppendLineFormat("New submission from \"{0} {1}\"", personalDetails.FirstName, personalDetails.LastName); sb.AppendLine(); sb.AppendLineFormat("Email address: {0}", personalDetails.EmailAddress); sb.AppendLineFormat("Primary phone Number: {0}", personalDetails.PrimaryPhoneNumber); sb.AppendLine(); sb.AppendLine("Reason for applying:"); sb.AppendLine(coverDetails.ReasonForApplying); sb.AppendLine(); sb.AppendLine("Why should we hire you:"); sb.AppendLine(coverDetails.ReasonForAcceptance); return sb.ToString(); }