Beispiel #1
0
        private static PendingJobStatus GetPendingJobStatus(EPrintServerJobLogger log)
        {
            if (log.JobStatus == EndState && log.TransactionStatus == EndState)
            {
                return(PendingJobStatus.EndstateReached);
            }

            return(PendingJobStatus.ContinueProcessing);
        }
Beispiel #2
0
        /// <summary>
        /// Determines whether to Update or Insert the log data.
        /// </summary>
        /// <param name="log">The <see cref="EPrintServerJobLogger"/></param>
        /// <param name="update"></param>
        private static void Submit(EPrintServerJobLogger log, bool insert)
        {
            DataLogger dataLogger = new DataLogger(GlobalSettings.WcfHosts[WcfService.DataLog]);

            if (insert)
            {
                dataLogger.SubmitAsync(log);
                return;
            }

            TraceFactory.Logger.Debug("UPDATE:");
            TraceFactory.Logger.Debug(log.ToString());
            dataLogger.UpdateAsync(log);
        }
Beispiel #3
0
        /// <summary>
        /// Logs all ePrint job data using the specified <see cref="DbDataReader"/>.
        /// </summary>
        /// <param name="reader"></param>
        /// <returns>A list of all job Ids processed.</returns>
        public static List <PendingJob> LogAll(List <PendingJob> jobsToProcess, DbDataReader reader)
        {
            List <PendingJob> processedJobs = new List <PendingJob>();
            ReadResult        readResult    = ReadResult.Success;
            int pendingJobId = -1;

            while (readResult != ReadResult.EndOfResultSet)
            {
                readResult = ReadData(reader);

                switch (readResult)
                {
                case ReadResult.Success:
                    pendingJobId = (int)reader["ID"];
                    EPrintServerJobLogger log        = ValidateJobData(pendingJobId, reader);
                    PendingJob            pendingJob = jobsToProcess.Where(j => j.JobId == pendingJobId).FirstOrDefault();
                    if (log != null)
                    {
                        Submit(log, pendingJob != null ? pendingJob.IsInsert : true);
                        pendingJob.Status = GetPendingJobStatus(log);
                        if (pendingJob.Status == PendingJobStatus.EndstateReached)
                        {
                            // Add to list of processed jobs
                            processedJobs.Add(pendingJob);
                        }
                    }
                    else
                    {
                        // Not an STF Job.  Ensure it gets removed from the pending table.
                        pendingJob.Status = PendingJobStatus.NotAnSTFJob;
                        processedJobs.Add(pendingJob);
                    }
                    break;

                case ReadResult.Skip:
                    continue;

                default:
                    break;
                }
            }

            return(processedJobs);
        }
Beispiel #4
0
        /// <summary>
        /// Creates a new <see cref="EPrintServerJobLogger"/> using the provided <see cref="DbDataReader"/>.
        /// </summary>
        /// <param name="printJobId">The STF Print job Id.</param>
        /// <param name="reader">The data reader</param>
        /// <returns></returns>
        private static EPrintServerJobLogger CreateLog(Guid printJobId, DbDataReader reader)
        {
            string sessionId          = ParseSessionId(reader["Subtitle"] as string);
            EPrintServerJobLogger log = new EPrintServerJobLogger((int)reader["ID"], sessionId);

            log.PrintJobClientId      = printJobId;
            log.SessionId             = ParseSessionId(reader["Subtitle"] as string);
            log.JobName               = reader["JobName"] as string;
            log.JobStatus             = reader["JobStatus"] as string;
            log.JobStartDateTime      = (DateTime)reader["CreatedAt"];
            log.LastStatusDateTime    = (DateTime)reader["LastStatusAt"];
            log.EPrintTransactionId   = (int)reader["GroupID"];
            log.JobFolderId           = reader["JobFolderId"] as string;
            log.EmailAccount          = FormatEmail(reader["NTUserAccount"] as string);
            log.EmailReceivedDateTime = (DateTime)reader["userDateTime"];
            log.TransactionStatus     = reader["TransactionStatus"] as string;
            log.PrinterName           = reader["Printer"] as string;

            return(log);
        }