コード例 #1
0
ファイル: ReportsController.cs プロジェクト: Jaylala03/CIMS
        public JsonResult GetLocationData(string type, string startDate, string endDate)
        {
            string json = string.Empty;
            ReportsStatisticsModel        reportsModel = new ReportsStatisticsModel();
            List <ReportsStatisticsModel> reportsList  = new List <ReportsStatisticsModel>();
            ReportsStatisticsBase         reportsBase  = new ReportsStatisticsBase();

            reportsBase.Type      = type;
            reportsBase.StartDate = startDate;
            reportsBase.EndDate   = endDate;
            actionResult          = reportsAction.LocationCount_Graph(reportsBase);
            if (actionResult.IsSuccess)
            {
                json += "{\"LocationCount\":[ ";

                foreach (DataRow dr in actionResult.dtResult.Rows)
                {
                    json += "{\"results\":\"" + dr["results"].ToString() + "\",\"ShortLocation\":\"" + dr["Location"].ToString() + "\"},";
                }

                json = json.TrimEnd(',') + "]}";
            }

            return(Json(json, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
ファイル: ReportsController.cs プロジェクト: Jaylala03/CIMS
        public JsonResult EmployeeVariance_print(string type, string startDate, string endDate)
        {
            ReportsStatisticsModel reportsModel = new ReportsStatisticsModel();
            string json = string.Empty;
            List <ReportsStatisticsModel> reportsList = new List <ReportsStatisticsModel>();

            try
            {
                ReportsStatisticsBase reportsBase = new ReportsStatisticsBase();
                reportsBase.Type      = type;
                reportsBase.StartDate = startDate;
                reportsBase.EndDate   = endDate;

                actionResult = reportsAction.EmployeeVariance_print(reportsBase);

                if (actionResult.IsSuccess)
                {
                    reportsList = CommonMethods.ConvertTo <ReportsStatisticsModel>(actionResult.dtResult);
                }
                else
                {
                    json = "fail";
                }
                reportsModel.reportsStatisticsList = reportsList;
            }
            catch (Exception ex)
            {
                json = "-1";
                ErrorReporting.WebApplicationError(ex);
            }
            return(Json(reportsList, JsonRequestBehavior.AllowGet));
        }