public ActionResult GetAllMediaRecords(DateTime? StartDate, DateTime? EndDate, int? Portfolio, string Responsibility, string Account, string GUID) { var dataQueries = new DataQueries(); string _portfolioowner = null; RProductCodeRepository rProdCodeRepo = new RProductCodeRepository(); if (Portfolio != null) { _portfolioowner = rProdCodeRepo.Get(x => x.ProductID == Portfolio).PRODUCT_CODE; } if (Responsibility == "undefined") { Responsibility = null; } if (GUID == "") { GUID = null; } if (Account == "") { Account = null; } IEnumerable<MediaViewEditResult> results = dataQueries.GetMediaViewEditRecords(StartDate, EndDate, _portfolioowner, Responsibility, Account, GUID); #region Store selected Criteria in the VieBag for Export to Excel use if (StartDate != null && EndDate != null) { ViewBag.StartDate = StartDate.ToString(); ViewBag.EndDate = EndDate.ToString(); } else { ViewBag.StartDate = null; ViewBag.EndDate = null; } if (_portfolioowner != null) { ViewBag.PortfolioOwner = _portfolioowner; } else { ViewBag.PortfolioOwner = null; } if (Responsibility != null) { ViewBag.Responsibility = Responsibility; } else { ViewBag.Responsibility = null; } if (Account != null) { ViewBag.Account = Account; } else { ViewBag.Account = null; } if (GUID != null) { ViewBag.GUID = GUID; } else { ViewBag.GUID = null; } #endregion return PartialView("_mediaRecords", results.ToList()); }
public ActionResult GetReportData(DateTime? StartDate, DateTime? EndDate, int? Company, string ToRange, string FromRange, string ReportType) { //Get Bockett Company Repository if (Company == null) { //We are just setting it up// This report does not require Company Company = 1; } //BockettCompanyRepository bockettCompRepo = new BockettCompanyRepository(); //Find out Company Name //var _companyName = bockettCompRepo.GetAll().Where(x => x.Id == Company).SingleOrDefault().Company; var _companyName = ""; RProductCodeRepository rProdCodeRepo = new RProductCodeRepository(); if (Company == 1) { _companyName = rProdCodeRepo.GetAll().Where(x => x.ProductID == 1 || x.ProductID == 330).SingleOrDefault().PRODUCT_CODE; } else { _companyName = rProdCodeRepo.GetAll().Where(x => x.ProductID == Company).SingleOrDefault().PRODUCT_CODE; } var dataQueries = new DataQueries(); //For Report based on Report Type selection switch (ReportType) { case "CashFlow": //Get the View Repository PortCashFlowRepository portCashFlowRepo = new PortCashFlowRepository(); //Get the Report Data var _cashFlowreportData = from cashFlow in portCashFlowRepo.GetAll().Distinct() where cashFlow.Company == _companyName && cashFlow.ClosingDate >= StartDate && cashFlow.ClosingDate <= EndDate select cashFlow; //return the data return PartialView("_portfolioCashFlow", _cashFlowreportData.ToList()); case "CashPosition": //Get the View Repository PortCashPositionRepository portCashPositionRepo = new PortCashPositionRepository(); //Get the Report Data var _cashPositionreportData = portCashPositionRepo.GetAll().Distinct().Where(p => p.Company == _companyName); return PartialView("_portfolioCashPosition", _cashPositionreportData.ToList()); case "Purchases": IEnumerable<Purchases> results = dataQueries.GetPurchases(StartDate, EndDate, _companyName); return PartialView("_purchases", results); case "Sales": IEnumerable<Sales> salesresults = dataQueries.GetSales(StartDate, EndDate, _companyName); return PartialView("_sales", salesresults); case "CollectionsRecon": //Get the View Repository CollectionsReconRepository collectionsReconRepo = new CollectionsReconRepository(); //Get the Report Data var _collectionsReconData = from collectionRecon in collectionsReconRepo.GetAll().Distinct() where collectionRecon.Company == _companyName && collectionRecon.ClosingDate >= StartDate && collectionRecon.ClosingDate <= EndDate select collectionRecon; //return the data return PartialView("_collectionsRecon", _collectionsReconData.ToList()); case "PortfolioSummary": IEnumerable<PortfolioSummary> portSummaryresults = dataQueries.GetPortfolioSummaryReports(_companyName); return PartialView("_portfolioSummary", portSummaryresults); case "PortTransactions": IEnumerable<PortfolioTransactions> portTransactionsresults = dataQueries.GetPortfolioTransactionsReports(_companyName); return PartialView("_portfolioTransactions", portTransactionsresults); case "AddDPSCheck": //Get the View Repository AddDPSCheckRepository portDPSRepo = new AddDPSCheckRepository(); //Get the Report Data var _portDPSAddCheckData = from addCheckData in portDPSRepo.GetAll().Distinct() where addCheckData.Company == _companyName select addCheckData; //return the data return PartialView("_portDPSAddCheck", _portDPSAddCheckData.ToList()); default: return PartialView(); } }