示例#1
0
        private string PrepareDocument()
        {
            var document = new StringBuilder();

            document.Append(@"
                        <html>
                            <head>
                            </head>
                            <body>
                                <div class='header'><h1>Raport z regionów</h1></div>
                                <table class='table' align='center'>
                                    <tr>
                                        <th>Typ atrakcji</th>
                                        <th>Nazwa atrakcji</th>
                                        <th>Opis atrakcji</th>
                                        <th>Region</th>
                                    </tr>");

            foreach (var attraction in _attractionRepository.GetAllAttractionToUser())
            {
                document.AppendFormat(@"<tr>
                                    <td>{0}</td>
                                    <td>{1}</td>
                                    <td>{2}</td>
                                    <td>{3}</td>
                                  </tr>",
                                      attraction.AttractionType,
                                      attraction.Name,
                                      attraction.Description,
                                      attraction.Region.Name);
            }

            document.Append(@"
                                </table>
                            <table align='center'>
                                    <tr>
                                        <th>Nazwa imprezy</th>
                                        <th>Lokalizacja</th>
                                        <th>Opis</th>
                                        <th>Aktualna</th>
                                        <th>Region</th>
                                    </tr>");

            foreach (var party in _partyRepository.GetAllPartyToUser())
            {
                document.AppendFormat(@"<tr>
                                    <td>{0}</td>
                                    <td>{1}</td>
                                    <td>{2}</td>
                                    <td>{3}</td>
                                    <td>{4}</td>
                                  </tr>",
                                      party.Name,
                                      party.PlaceDescription,
                                      party.Description,
                                      party.UpToDate,
                                      party.Region.Name);
            }

            document.Append(@"
                                </table>
                            <table class='table' align='center'>
                                    <tr>
                                        <th>Nazwa schroniska</th>
                                        <th>Maksymalna ilość miejsc</th>
                                        <th>Wolne miejsca</th>
                                        <th>Otwarte</th>
                                        <th>Numer telefonu</th>
                                        <th>Opis</th>
                                        <th>Region</th>
                                    </tr>");

            foreach (var shelter in _shelterRepository.GetAllShelterToUser())
            {
                document.AppendFormat(@"<tr>
                                    <td>{0}</td>
                                    <td>{1}</td>
                                    <td>{2}</td>
                                    <td>{3}</td>
                                    <td>{4}</td>
                                    <td>{5}</td>
                                    <td>{6}</td>
                                  </tr>",
                                      shelter.Name,
                                      shelter.MaxPlaces,
                                      shelter.Places,
                                      shelter.IsOpen,
                                      shelter.PhoneNumber,
                                      shelter.Description,
                                      shelter.Region.Name);
            }

            document.Append(@"
                                </table>
                            <table class='table' align='center'>
                                    <tr>
                                        <th>Nazwa szlaku</th>
                                        <th>Kolor</th>
                                        <th>Otwarty</th>
                                        <th>Przyczyna zamknięcia</th>
                                        <th>Długość szlaku (m)</th>
                                        <th>Trudność</th>
                                        <th>Opis</th>
                                    </tr>");

            foreach (var trail in _trailRepository.GetAllTrailToUser())
            {
                document.AppendFormat(@"<tr>
                                    <td>{0}</td>
                                    <td>{1}</td>
                                    <td>{2}</td>
                                    <td>{3}</td>
                                    <td>{4}</td>
                                    <td>{5}</td>
                                    <td>{6}</td>
                                  </tr>",
                                      trail.Name,
                                      trail.Colour,
                                      trail.Open,
                                      trail.Feedback,
                                      trail.Length,
                                      trail.Difficulty,
                                      trail.Description);
            }

            document.Append(@"
                                </table>
                            </body>
                        </html>");

            return(document.ToString());
        }