Пример #1
0
        /// <summary>
        /// Gets report by its exact Id.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        ReportQueryData IReportService.GetReport(Guid id)
        {
            ReportQueryData queryData = null;
            Report          rawReport = null;

            try
            {
                rawReport = reportRepository.GetReport(id);
            }
            catch (NullResultException) // TO DO: Catch null result exceptions
            {
                throw;
            }
            finally
            {
                queryData = new ReportQueryData(rawReport);
            }

            if (queryData != null)
            {
                return(queryData);
            }
            else
            {
                throw new NullResultException("Unknown service error happened while getting report information.");
            }
        }
        public JsonResult GetStationeryUsageReportData(ReportQueryData queryData)
        {
            ReportReturnData reportData      = new ReportReturnData();
            List <string>    yearsName       = queryData.YearsName;
            List <string>    monthsName      = queryData.MonthsName;
            DateTime         startDate       = Convert.ToDateTime(queryData.StartDate);
            DateTime         endDate         = Convert.ToDateTime(queryData.EndDate);
            List <string>    departmentsCode = queryData.Departments;
            List <string>    categoriesName  = queryData.Categories;

            List <string> months = GetMonths(yearsName, monthsName, startDate, endDate);

            reportData.Xaxis = months;
            List <StationeryUsageViewModel> rawData = b.GetStationeryUsage("Completed", startDate, endDate, yearsName, monthsName, departmentsCode, categoriesName);

            reportData.Series = prepareData(departmentsCode, categoriesName, rawData);

            return(Json(reportData));
        }