]> git.somenet.org - pub/jan/aic18.git/blob - service-reporting/Utility/TemplateGenerator.cs
Merge branch 'angabe' into 'master'
[pub/jan/aic18.git] / service-reporting / Utility / TemplateGenerator.cs
1 using System.Text;
2 using PdfService.Models;
3
4 namespace PdfService.Utility
5 {
6     public static class TemplateGenerator
7     {
8         public static string GetHTMLString(Tweet[] tweets)
9         {
10             var sb = new StringBuilder();
11             sb.Append(@"
12                         <html>
13                             <head>
14                             </head>
15                             <body>
16                                 <section class='hero is-info'>
17                                 <div class='hero-body' style='padding-left:3em'>
18                                     <div class='container'>
19                                     <h1 class='title'>
20                                         Tweet Sentiment Analysis
21                                     </h1>
22                                     <h2 class='subtitle'>
23                                         Results for the terms
24                                     </h2>
25                                     </div>
26                                 </div>
27                                 </section>
28                                 <div class='notification'>
29                                     Generated report only contains mocked data. Will be changed later.
30                                 </div> 
31                                 <div class='container' style='margin-left:3em'>
32
33                                 ");
34  
35             foreach (var tweet in tweets)
36             {
37                 sb.AppendFormat(@"<div class='container' style='margin-top:3em;'>  
38                             <p class='title is-5'>{0}</p>
39                     <div class='content'>
40                     {1}
41                     </div>
42                 </div>", tweet.Name, tweet.Sentiment);
43             }
44  
45             sb.Append(@" </div>
46                             </body>
47                         </html>");
48  
49             return sb.ToString();
50         }
51     }
52 }