public JsonResult GetInputReport(long keyReference) { var activity = new RFInputReportsActivity(Context); var report = activity.GetInputReport(keyReference); if (report != null) { return(Json(report.GetFirstSection().AsDataTable())); } return(null); }
public JsonResult GetInputReports(RFDate valueDate) { var activity = new RFInputReportsActivity(Context); return(Json(activity.GetInputReportsList(valueDate).Select(c => new { Key = c.Key.ToString(), KeyReference = c.KeyReference, UpdateDate = c.UpdateTime, UpdateTime = c.UpdateTime, ReportCode = c.ReportCode, ReportDescription = c.ReportDescription, NumRows = c.NumRows, ValueDate = c.ValueDate.ToJavascript(), SourceUniqueKey = c.SourceUniqueKey }))); }
public ActionResult UpdateInputReport(long keyReference, string updates) { try { var activity = new RFInputReportsActivity(Context); var report = activity.GetInputReportDocument(keyReference); if (report != null) { var section = report.GetContent <RFRawReport>().GetFirstSection(); foreach (var update in JsonConvert.DeserializeObject <List <dynamic> >(updates)) { int rowNum = update.rowNum; if (section.Rows.Count >= rowNum) { var row = section.Rows.Skip(rowNum - 1).First(); foreach (JToken token in ((JObject)update.data).Children()) { if (token is JProperty) { row.SetString((token as JProperty).Name, (token as JProperty).Value.ToString()); } } } } using (var rfService = new RFServiceClient()) { RFProcessingTrackerHandle trackerKey = null; trackerKey = rfService.RFService.SubmitAndProcess(new List <RFCatalogEntryDTO> { new RFCatalogEntryDTO(report) }, new RFUserLogEntry { Action = "Update Input Report", Description = String.Format("Manually updated report {0}", report.Key.FriendlyString()), IsUserAction = true, IsWarning = false, Processor = null, ValueDate = report.Key.GraphInstance.ValueDate.Value, Username = Username }); ProcessController.SubmitModel(new ProcessingModel { Tracker = trackerKey, ProcessingKey = trackerKey.TrackerCode, FileKey = (report.Key as RFRawReportKey).ReportCode, FileName = (report.Key as RFRawReportKey).FriendlyString(), FileSize = 0, ReturnUrl = null }); return(RedirectToAction("ProcessingStatus", "Process", new { processKey = trackerKey.TrackerCode })); } } } catch (Exception ex) { Log.Exception(this, ex, "Error updating input report {0}", keyReference); } return(null); }