Beispiel #1
0
        /// <summary>
        /// NPrinting Task Execution
        /// </summary>
        public static string TasksExecution(string passedExecutionTaskID, Int32 reportid)
        {
            // POST TASK EXECUTION


            string nPrintingResponse = string.Empty;

            if (response.StatusCode == HttpStatusCode.OK)
            {
                string        taskExecutionUrl = ConfigurationManager.AppSettings["NPrintingPutGetTaskExecution"] + passedExecutionTaskID + "/executions";
                string        reqBody          = string.Empty;
                TaskExecution TaskExec         = new TaskExecution();
                TaskExec.type = "Qlik.NPrinting.Repo.Model.PublishReportTask";
                TaskExec.task = passedExecutionTaskID;
                reqBody       = JsonConvert.SerializeObject(TaskExec);
                listOfActions.Add(() => PostRequest(taskExecutionUrl, reqBody));
                //nPrintingResponse = PostRequest(taskExecutionUrl, reqBody);
            }
            Parallel.Invoke(listOfActions.ToArray());
            NprintingReqResRepository obj = new NprintingReqResRepository();

            // obj.WriteToFile(reportid.ToString());

            obj.InsertLog(reportid.ToString(), passedExecutionTaskID, DateTime.Now);
            result = result + "_+" + reportid.ToString();
            return(nPrintingResponse);
        }
Beispiel #2
0
        public static string excuteReportBunch(DataTable taskExecutionDetails, Int32 ReportID)
        {
            string result           = string.Empty;
            var    tasks            = new List <Task>();
            var    dtUniqueTaskList = taskExecutionDetails.AsEnumerable()
                                      .Select(row => new
            {
                TaskID   = row.Field <string>("NprintingTaskID"),
                ReportID = row.Field <Int32>("ReportID"),
            }).Where(item => item.ReportID == ReportID)
                                      .Distinct();


            foreach (var Tlist in dtUniqueTaskList.ToList())
            {
                string TaskID = Tlist.TaskID;
                // NprintingReqResRepository obj = new NprintingReqResRepository();
                //  obj.WriteToFile(ReportID.ToString(), taskExecutionDetails.Rows.Count);
                NprintingReqResRepository.TasksExecution(TaskID, ReportID);
            }
            return(result);
        }