Example #1
0
 public ActionResult TrackProcess(RFProcessingTrackerHandle handle, string continueAction, string continueController, object routeValues)
 {
     ProcessController.SubmitModel(new Models.IO.ProcessingModel
     {
         Tracker          = handle,
         ProcessingKey    = handle.TrackerCode,
         ReturnAction     = continueAction,
         ReturnController = continueController,
         ReturnValues     = routeValues
     });
     return(RedirectToAction("ProcessingStatus", "Process", new { area = "", processKey = handle.TrackerCode }));
 }
        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);
        }