static void Main(string[] args) { LetterGenerator letter = new LetterGenerator(); Console.WriteLine("Generating the letters...."); try { letter.GenerateRenewalFiles(); Console.WriteLine("Generating letter completed."); } catch (Exception) { Console.WriteLine("Generating letter failed."); } finally { Console.ReadLine(); } }
// GET: GenerateLetter /// <summary> /// Controller to generate the letter /// </summary> /// //Action method to generate the letter and display the count public ActionResult GenerateRenewalLetter() { LetterGenerator letter = new LetterGenerator(); int filecount = letter.GenerateRenewalFiles(); if (filecount > 0) { ViewBag.message = "No of Letter generated : " + filecount; } else if (filecount == 0) { ViewBag.message = "No new Letter generated."; } else { ViewBag.message = "Letter generation failed. Kindly check the logs"; } return(View()); }