/// <summary> /// Theoretical revenue report /// Check whether data is available for specified parameter /// </summary> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="companyId"></param> /// <param name="userId"></param> /// <returns></returns> public ActionResult IsDataAvailable(string sDate, string eDate, int companyId) { TheoreticalRevenueReportService revenueReportService = new TheoreticalRevenueReportService(); DateTime startDate = Convert.ToDateTime(sDate); DateTime endDate = Convert.ToDateTime(eDate); DateTime afterFiveYearDate = startDate.AddYears(5); afterFiveYearDate = afterFiveYearDate.AddDays(-1); if (endDate > afterFiveYearDate) { return(new HttpStatusCodeAndErrorResult(500, String.Format("Please enter valid 'End date', It should not be more than 5 years from Start Date"))); } bool isDataFound = revenueReportService.IsDataAvailable(startDate, endDate, companyId); if (isDataFound) { // If data found then send 200 OK return(new HttpStatusCodeResult(200)); } return(new HttpStatusCodeAndErrorResult(500, String.Format(Constants.DATA_NOT_FOUND))); }
/// <summary> /// Return data table of Revenue At Risk section /// </summary> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="companyId"></param> /// <returns></returns> public DataTable ExecuteRevenueAtRiskReport(DateTime startDate, DateTime endDate, int companyId) { TheoreticalRevenueReportService revenueReportService = new TheoreticalRevenueReportService(); var result = revenueReportService.ExecuteRevenueAtRiskReport(startDate, endDate, companyId); return(result); }