コード例 #1
0
        public DocumentStatus IsHistoryPresentForJob(List <long> selectedJobId)
        {
            IList <IdRefLangName> statusLookup   = CoreCache.GetIdRefLangNames("EN", 39);
            IList <ColumnSetting> columnSetting  = CoreCache.GetColumnSettingsByEntityAlias("EN", Entities.EntitiesAlias.Job);
            DocumentStatus        documentStatus = new DocumentStatus()
            {
                IsAttachmentPresent = false, IsPODPresent = false, IsHistoryPresent = false
            };
            List <Task> tasks = new List <Task>();
            List <IList <JobHistory> > jobHistory = new List <IList <JobHistory> >();

            foreach (var currentJobId in selectedJobId)
            {
                tasks.Add(Task.Factory.StartNew(() =>
                {
                    jobHistory.Add(DataAccess.Job.JobHistoryCommands.GetPagedData(ActiveUser, new PagedDataInfo()
                    {
                        RecordId = currentJobId
                    }, columnSetting, statusLookup));
                }));
            }

            if (tasks.Count > 0)
            {
                Task.WaitAll(tasks.ToArray());
            }
            if (jobHistory?.Count > 0 && jobHistory.Where(x => x?.Count > 0).Any())
            {
                documentStatus.IsHistoryPresent = true;
            }

            return(documentStatus);
        }
コード例 #2
0
        public DocumentData GetHistoryReportByJobId(long jobId)
        {
            DocumentData          documentData  = null;
            IList <IdRefLangName> statusLookup  = CoreCache.GetIdRefLangNames("EN", 39);
            IList <ColumnSetting> columnSetting = CoreCache.GetColumnSettingsByEntityAlias("EN", Entities.EntitiesAlias.Job);
            DataTable             tblResult     = _commands.GetJobHistoryDataTable(ActiveUser, jobId, columnSetting, statusLookup);

            if (tblResult != null && tblResult.Rows.Count > 0)
            {
                documentData = new DocumentData();
                using (MemoryStream memoryStream = new MemoryStream())
                {
                    using (StreamWriter writer = new StreamWriter(memoryStream))
                    {
                        WriteDataTable(tblResult, writer, true);
                    }

                    documentData.DocumentContent = memoryStream.ToArray();
                    documentData.DocumentName    = string.Format("JobHistory_{0}.csv", jobId);
                    documentData.ContentType     = "text/csv";
                }
            }

            return(documentData);
        }
コード例 #3
0
        /// <summary>
        /// Gets list of reference language names
        /// </summary>
        /// <param name="lookupId"></param>
        /// <returns></returns>

        public static IList <IdRefLangName> GetIdRefLangNames(int lookupId, bool forceUpdate = false)
        {
            return(CoreCache.GetIdRefLangNames(ActiveUser.LangCode, lookupId, forceUpdate));
        }