protected void PreviewBtn_Click(object sender, EventArgs e) { SaveBtn_Click(sender, e); if (SelectedStudentId != -1) { //Response.Redirect((new CommentLetter(LoadedCommentId)).Publish()); WebhostMySQLConnection.EVOPublishing.CommentLetter letter = new WebhostMySQLConnection.EVOPublishing.CommentLetter(LoadedCommentId); String path = Server.MapPath(String.Format("~/Temp/{0}/{1}{2}/comments/", user.UserName, TermDDL.SelectedItem.Text, DateRange.GetCurrentAcademicYear())); String filename = letter.Publish(path).Split('\\').Last(); Response.Redirect(String.Format("~/Temp/{0}/{1}{2}/comments/{3}", user.UserName, TermDDL.SelectedItem.Text, DateRange.GetCurrentAcademicYear(), filename)); } }
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"); }