// GET: Report public ActionResult Index(string key = "", int currentPage = 1) { int cacheTime = (24 - DateTime.Now.Hour) * 60; ReportItemModel model = XmlReader.DeserializeXMLFileToObject <ReportItemModel>(Server.MapPath("/Files/Xml/" + key + ".xml")); model.data = CachingHelper.GetObjectFromCache <DataTable>(key.Replace("-", "_") + "_" + SEmployee.EmployeeCode, cacheTime); if (model.data == null) { model.data = CachingHelper.SetObjectFromCache <DataTable>(key.Replace("-", "_") + "_" + SEmployee.EmployeeCode, cacheTime, DataFunction.GetDataReportFromService(ServiceUrl, "", MapFilterParams(model.filter), "RPT1902-00001")); } return(View(model)); }
public IHttpActionResult GetReportData(ReportRequest request) { GetDataResponse response = new GetDataResponse(); try { ServiceMethods sMethods = XmlReader.DeserializeXMLFileToObject <ServiceMethods>(System.Web.Hosting.HostingEnvironment.MapPath("/Files/Xml/RPT.xml")); ServiceMethod method = sMethods.Methods.Where(m => m.key == request.Key).FirstOrDefault(); if (method != null) { response.Content = new SqlDynamicDao <Dynamic>().GetDataTable(request.Params.ToArray(), method.datasource); response.Message = Extension.ResponseMessage.Success; response.Status = (int)ResponseStatus.Success; } return(Ok(response)); } catch (Exception ex) { response = Mapper.SetResponseResult((int)ResponseStatus.UnknowError, Extension.ResponseMessage.UnknowError, ex.Message); } return(Ok(response)); }