/// <summary> /// /// </summary> /// <param name="sectionId"></param> /// <param name="termId"></param> public CommentReviewPDF(int sectionId, int termId) : base() { using (WebhostEntities db = new WebhostEntities()) { studentParagraphs = new List <SmallComment>(); Section section = db.Sections.Where(sec => sec.id == sectionId).Single(); className = String.Format("[{0}] {1}", section.Block.LongName, section.Course.Name); if (section.CommentHeaders.Where(h => h.TermIndex == termId).Count() > 0) { CommentHeader header = section.CommentHeaders.Where(h => h.TermIndex == termId).Single(); headerHTML = CommentLetter.CleanTags(header.HTML); foreach (StudentComment comment in header.StudentComments) { SmallComment smc = new SmallComment() { studentName = String.Format("{0} {1}", comment.Student.FirstName, comment.Student.LastName), html = CommentLetter.CleanTags(comment.HTML), finalGrade = comment.FinalGrade.Name, effortGrade = comment.EffortGrade.Name, termGrade = comment.TermGrade.Name, examGrade = comment.ExamGrade.Name }; studentParagraphs.Add(smc); } } else { throw new CommentException(String.Format("No Header Paragraph for {0}", className)); } } }
protected static void ExecuteStudentRequest(XMLTree xml, String saveDir) { int termId = Convert.ToInt32(xml.Attributes["termid"]); List <int> studentIds = new List <int>(); foreach (XMLTree studentTree in xml.ChildTrees.Where(tree => tree.TagName.Equals("student")).ToList()) { int studentId = Convert.ToInt32(studentTree.Attributes["studentid"]); studentIds.Add(studentId); } String fileName = CommentLetter.PublishTermByStudent(termId, studentIds, saveDir); MailControler.MailToUser("Comments Published Successfully", String.Format("Click the Link to download the comments you requested:{0}{1}", Environment.NewLine, fileName.Replace("W:", "https://webhost.dublinschool.org").Replace("\\", "/")), String.Format("{0}@dublinschool.org", xml.Attributes["username"]), xml.Attributes["name"], "*****@*****.**", "Comment Bot"); }
protected static void ExecuteClassRequest(XMLTree xml, String saveDir) { int termId = Convert.ToInt32(xml.Attributes["termid"]); List <int> studentIds = new List <int>(); List <String> filenames = new List <string>(); foreach (XMLTree studentTree in xml.ChildTrees.Where(tree => tree.TagName.Equals("section")).ToList()) { int headerId = Convert.ToInt32(studentTree.Attributes["headerid"]); filenames.Add(CommentLetter.PublishClass(headerId, saveDir)); } String zipFile = MailControler.PackForDownloading(filenames, String.Format("{0}\\classes_{1}.zip", saveDir, DateTime.Now.Ticks)); MailControler.MailToUser("Comments Published Successfully", String.Format("Click the Link to download the comments you requested:{0}{1}", Environment.NewLine, zipFile.Replace("W:", "https://webhost.dublinschool.org").Replace("\\", "/")), String.Format("{0}@dublinschool.org", xml.Attributes["username"]), xml.Attributes["name"].Replace('_', ' '), "*****@*****.**", "Comment Bot"); }