public static void GeneratePdfReport(DateTime startDate, DateTime endDate, SupermarketChainData data)
        {
            var htmlContent = new StringBuilder();

            htmlContent.Append(
                @"<!DOCTYPE html>
                <html lang=""en"" xmlns=""http://www.w3.org/1999/xhtml"">
                <head>
                    <meta charset=""utf-8"" />
                    <title>Aggregated Sales Report</title>
                    <style>
                        table, td {
                            border: 1px solid black;
                        }
                        tr td:nth-child(1) {
                            width: 250px;
                        }

                        tr td:nth-child(2) {
                            width: 150px;
                            text-align: center;
                        }

                        tr td:nth-child(3) {
                            width: 150px;
                            text-align: center;
                        }

                        tr td:nth-child(4) {
                            width: 300px;
                        }

                        tr td:nth-child(5) {
                            width: 150px;
                            text-align: right;
                        }

                        .dateFormat {
                            background-color: lightgray;
                        }

                        tr.DailyReportHeader td {
                            background-color: grey;
                            text-align: center;
                            font-weight: bold;
                        }

                        tr.subtotal td:nth-child(1) {
                            text-align: right;
                        }

                        tr.subtotal td:nth-child(2) {
                            font-weight: bold;
                            text-align: right;
                        }

                        tfoot {
                            background-color: lightblue;
                        }

                        tfoot td:nth-child(1) {
                            text-align: right;
                        }

                        tfoot td:nth-child(2) {
                            text-align: right;
                            font-weight: bold;
                        }
                    </style>
                </head>
                <body>
                    <table>
                        <thead>
                            <tr><th colspan=""5"">Aggregated Sales Report</th></tr>
                        </thead>
                        <tbody>");

            var currentDate = startDate;
            decimal totalSum = 0;

            while (currentDate <= endDate)
            {
                decimal subTotalSum = 0;
                var currentDateSales = data.Sales.All().Where(s => s.Date == currentDate)
                        .Include(s => s.Product).Include(s => s.Product.Measure).Include(s => s.Supermarket.Name);

                if (currentDateSales.Any())
                {
                    htmlContent.AppendLine(@"<tr><td class=""dateFormat"" colspan=""5"">Date: " + currentDate.ToString("dd-MMM-yyyy") + "</td></tr>"
                                                           + @"<tr class=""DailyReportHeader"">
                                        <td>Product</td>
                                        <td>Quantity</td>
                                        <td>Unit Price</td>
                                        <td>Location</td>
                                        <td>Sum</td>
                                        </tr>");

                    foreach (var sale in currentDateSales)
                    {
                        htmlContent.AppendLine(@"<tr class=""ProductList"">")
                            .AppendLine("<td>" + sale.Product.Name + "</td>")
                            .AppendLine("<td>" + sale.Quantity + " " + sale.Product.Measure.Name + "</td>")
                            .AppendLine("<td>" + sale.UnitPrice + "</td>")
                            .AppendLine("<td>" + sale.Supermarket.Name + "</td>")
                            .AppendLine("<td>" + sale.Sum + "</td>");

                        subTotalSum += sale.Sum;

                    }

                    htmlContent.AppendLine(@"<tr class=""subtotal"">
                        <td colspan=""4"">Total sum for " + currentDate.ToString("dd-MMM-yyyy") + @":</td>
                        <td colspan=""1"">" + subTotalSum + "</td></tr>");
                }

                currentDate = currentDate.AddDays(1);
                totalSum += subTotalSum;
            }

            htmlContent.AppendLine(@"</tbody>
                <tfoot>
                    <tr>
                    <td colspan=""4"">Grand total:</td>
                    <td colspan=""1"">" + totalSum + @"</td>
                    </tr>
                    </tfoot>
                </table>
            </body>
            </html>");

            var pdfBytes = new NReco.PdfGenerator.HtmlToPdfConverter().GeneratePdf(htmlContent.ToString());
            File.WriteAllBytes(Path.GetFullPath(@".\..\..\..\..\..\Sales Report from " + startDate.ToString("dd-MMM-yyyy") + " to " + endDate.ToString("dd-MMM-yyyy") + ".pdf"), pdfBytes);

            Console.WriteLine("PDF Report Successfully generated!");
        }
        public static void Main(string[] args)
        {
            //// Testing SupermarketChainDbContext
            var dbContext = new SupermarketChainDbContext();
            Console.WriteLine(dbContext.Vendors.First(v => v.Name == "Kamenitza").Name);
            //Console.WriteLine(dbContext.Vendors.Count());

            //// Testing repository
            //var dbVendors = new Repository<Vendor>();
            //dbVendors.Add(new Vendor { Name = "Zagorka" });
            //dbVendors.SaveChanges();

            //// Testing unit of work
             var data = new SupermarketChainData();
            //Console.WriteLine(data.Vendors.All().FirstOrDefault(v => v.Name == "Zagorka").Name);
            //Console.WriteLine(data.Supermarkets.All().FirstOrDefault(v => v.Name == "Supermarket “Bourgas – Plaza”").Name);

            //PDFReportGenerator.GeneratePdfReport(DateTime.ParseExact("20-Jul-2014", "dd-MMM-yyyy", CultureInfo.InvariantCulture), DateTime.ParseExact("23-Jul-2014", "dd-MMM-yyyy", CultureInfo.InvariantCulture), data);
            //JsonReportsToMongoDB.Export();
            //XMLReportSalesByVendor.GenerateReport(DateTime.ParseExact("20-Jul-2014", "dd-MMM-yyyy", CultureInfo.InvariantCulture), DateTime.ParseExact("23-Jul-2014", "dd-MMM-yyyy", CultureInfo.InvariantCulture), dbContext);
            //ImportExpensesFromXML.Import();
            ExportDataToMySQL.Export();
        }