public ACJE.JobOutcome Execute(ACJE.IJobProcessorServices context, ACJE.IJob job)
        {
            long fileMasterId = Convert.ToInt64(job.Params["FileMasterId"]);

            try
            {
                // Retrieve the file object from the server
                //
                ACW.File file = context.Connection.WebServiceManager.DocumentService.GetLatestFileByMasterId(fileMasterId);
                VDF.Vault.Currency.Entities.FileIteration fileIter =
                    context.Connection.FileManager.GetFilesByIterationIds(new long[] { file.Id }).First().Value;

                // Download and publish the file
                //
                Publish(fileIter, context.Connection);

                return(ACJE.JobOutcome.Success);
            }
            catch
            {
                return(ACJE.JobOutcome.Failure);
            }
        }
        public ACJE.JobOutcome Execute(ACJE.IJobProcessorServices context, ACJE.IJob job)
        {
            long   EntityId = Convert.ToInt64(job.Params["EntityId"]);
            string logText  = "";
            string errText  = "";

            ACJE.JobOutcome jobOutComeStatus = ACJE.JobOutcome.Success;
            try
            {
                // Retrieve the file object from the server
                //
                ACW.File[] fileArray = new ACW.File[10];    // I hope there's never more than 11 files returned :(
                long[]     EntityIDArray = new long[1];
                string     logString = "", errString = "";

                EntityIDArray[0] = EntityId;
                try
                {
                    fileArray = context.Connection.WebServiceManager.DocumentService.GetLatestFilesByIds(EntityIDArray);
                }
                catch (Exception)
                {
                    // if the above call fails, we know the vault file that we want to process doesn't exist anymore
                    // so we don't worry about it and call it a success!
                    context.Log("No vault file found", ACJE.MessageType.eInformation);
                    return(ACJE.JobOutcome.Success);
                }
                context.Log("number of items in array: " + fileArray.Length + "\n\r", ACJE.MessageType.eInformation);


                VDF.Vault.Currency.Entities.FileIteration fileIter =
                    context.Connection.FileManager.GetFilesByIterationIds(new long[] { fileArray[0].Id }).First().Value;

                if (GetVaultCheckOutComment(fileIter, context.Connection) != "IM")
                {
                    // check for PDF files
                    if (PDFfileUpdate(fileIter, context.Connection, ref logString, ref errString))
                    {
                        logText += "Processing PDF File for " + fileIter.ToString() + "...\n";
                        logText += logString + "\n";  // information returned from FileUpdate
                        context.Log(logText, ACJE.MessageType.eInformation);
                        jobOutComeStatus = ACJE.JobOutcome.Success;
                    }
                    else
                    {
                        errText  = "Error in processing PDF File for " + fileIter.ToString();
                        errText += errString + "\n";  // information returned from FileUpdate
                        context.Log(errText, ACJE.MessageType.eError);
                        jobOutComeStatus = ACJE.JobOutcome.Failure;
                    }

                    // check for sym files
                    int symUpdateVal = processRadanFile(fileIter, false);
                    if (symUpdateVal == 1)
                    {
                        logText += "Moved Radan File for " + fileIter.ToString() + "...\n";
                        context.Log(logText, ACJE.MessageType.eInformation);
                        if (jobOutComeStatus != ACJE.JobOutcome.Failure)
                        {
                            jobOutComeStatus = ACJE.JobOutcome.Success;
                        }
                    }
                    else if (symUpdateVal == 0)
                    {
                        logText = "No Radan File moved for " + fileIter.ToString() + "...\n";
                        context.Log(logText, ACJE.MessageType.eInformation);
                        if (jobOutComeStatus != ACJE.JobOutcome.Failure)
                        {
                            jobOutComeStatus = ACJE.JobOutcome.Success;
                        }
                    }
                    else if (symUpdateVal == -1)
                    {
                        errText = "Error in processing Radan File for " + fileIter.ToString();
                        context.Log(errText, ACJE.MessageType.eError);
                        jobOutComeStatus = ACJE.JobOutcome.Failure;
                    }

                    return(jobOutComeStatus);
                }
                else
                {
                    logText = "Skipping over " + fileIter.ToString() + "because only item master properties were changed";
                    context.Log(logText, ACJE.MessageType.eInformation);
                    return(ACJE.JobOutcome.Success);
                }
            }
            catch
            {
                context.Log(logText, ACJE.MessageType.eError);
                return(ACJE.JobOutcome.Failure);
            }
        }
        public ACJE.JobOutcome Execute(ACJE.IJobProcessorServices context, ACJE.IJob job)
        {
            string errorMessage = "";
            string logMessage   = "";

            try
            {
                long   EntityId   = Convert.ToInt64(job.Params["EntityId"]);
                string fileString = "";


                ACW.File file = null;
                VDF.Vault.Currency.Entities.FileIteration fileIter = null;

                if (job.Description.Contains("USER-REQUESTED"))  // process was started manually by user
                {
                    file       = context.Connection.WebServiceManager.DocumentService.GetLatestFileByMasterId(EntityId);
                    fileIter   = context.Connection.FileManager.GetFilesByIterationIds(new long[] { file.Id }).First().Value;
                    fileString = file.Name;
                }
                else                                             // process was triggered by an event change
                {
                    ACW.File[] fileArray     = new ACW.File[10]; // I hope there's never more than 11 files returned :(
                    long[]     EntityIDArray = new long[1];
                    EntityIDArray[0] = EntityId;
                    try
                    {
                        fileArray  = context.Connection.WebServiceManager.DocumentService.GetLatestFilesByIds(EntityIDArray);
                        fileIter   = context.Connection.FileManager.GetFilesByIterationIds(new long[] { fileArray[0].Id }).First().Value;
                        fileString = fileIter.ToString();
                    }
                    catch (Exception)
                    {
                        context.Log("No Vault File Found ", ACJE.MessageType.eInformation);
                        context.Log(logMessage, ACJE.MessageType.eInformation);

                        return(ACJE.JobOutcome.Success);
                    }
                }

                // Download and print the file
                //
                if (PrintPDF(fileIter, context.Connection, ref errorMessage, ref logMessage))
                {
                    context.Log("Successfully printed " + fileString + " to PDF\n\r", ACJE.MessageType.eInformation);
                    context.Log(logMessage, ACJE.MessageType.eInformation);

                    return(ACJE.JobOutcome.Success);
                }
                else
                {
                    context.Log("Error printing " + fileString + " to PDF. \n\r" + errorMessage, ACJE.MessageType.eError);
                    context.Log(logMessage, ACJE.MessageType.eInformation);
                    return(ACJE.JobOutcome.Failure);
                }
            }
            catch (Exception ex)
            {
                context.Log("Unknown Error in PDF Handler\n\r", ACJE.MessageType.eError);
                return(ACJE.JobOutcome.Failure);
            }
        }