static void Main() { InitModules.PopulateProducts(); Console.WriteLine("Parsing excel reports..."); var excelReports = ExcelParser.ParseExcel(path); Console.WriteLine("Inserting sales reports..."); foreach (var report in excelReports) { DBManager.InsertSalesReports(report); } Console.WriteLine("Generating pdf aggregated sales report."); DatabaseToPdfWriter pdfWriter = new DatabaseToPdfWriter(); var reports = DBManager.RetrieveReports(); pdfWriter.GeneratePDFAggregatedSalesReports(reports, "..\\..\\Report.pdf"); Console.WriteLine("Generating sales by vendor XML file..."); DatabaseToXmlWriter xmlWriter = new DatabaseToXmlWriter(); xmlWriter.GenerateSalesReportByVendor(DBManager.RetrieveReportByVendors(), "..\\..\\Sales-by-Vendors-report.xml"); XmlParser xmlParser = new XmlParser(); DBManager.InsertVendorExpenses(xmlParser.ParseFile("..\\..\\Vendors-Expenses.xml")); Console.WriteLine("Inserting data in MongoDb..."); Manager mongoManager = new Manager("mongodb://localhost"); mongoManager.AddProducts(DBManager.GetMonthlyProducts()); Console.WriteLine("Generating .xls file..."); DBManager.RetrieveProductReport(); DatabaseToExcelWriter.CreateExcelTable(DBManager.RetrieveTotalReport(DateTime.Now)); }
public static Dictionary<DateTime, Dictionary<int, DBManager.MongoEntry>> RetrieveTotalReport() { var result = new Dictionary<DateTime, Dictionary<int, DBManager.MongoEntry>>(); var now = DateTime.Now; var mgr = new Manager(); var products = mgr.GetProducts(); result.Add(now, new Dictionary<int, DBManager.MongoEntry>()); foreach (var prod in products.AsQueryable().ToList()) { result[now].Add(prod.ProductId, new DBManager.MongoEntry() { ProductName = prod.Name, QuantitySold = prod.QuantitySold, TotatIncome = prod.Income, VendorName = prod.Vendor }); } return result; }