public void generateLetterOnDesig(int travelId, TravelRequest approvedTravel) { if (approvedTravel.StatusId == 2) { string templatePath = repo.getInvitationFormat(travelId, approvedTravel); if (templatePath != null) { string text = File.ReadAllText(templatePath, Encoding.UTF8); //keeep the feilds ready for thr file feilds = repo.getFeildsForInvitationLetter(approvedTravel); if (feilds != null) { this.createFile(text, feilds); } else { throw new System.ArgumentException("the feilds to be filled in the text file is null", "feilds:null"); } } else { throw new System.ArgumentException(" NO InvitationTemplaten found for this designation check InvitationLetterFormatsTable In DB", ""); } } }