internal override void SetPipelineTypeSpecificParameters(ActiveJob activeJob)
        {
            base.SetPipelineTypeSpecificParameters(activeJob);

            using (var stream = new StringReader(activeJob.BootParameters.ToString()))
            {
                var xmlStream = new XmlSerializer(typeof(BulkPrintServiceRequestBEO));
                bulkPrintServiceRequestBEO = xmlStream.Deserialize(stream) as BulkPrintServiceRequestBEO;
                if (bulkPrintServiceRequestBEO != null)
                {
                    JobName = bulkPrintServiceRequestBEO.Name;
                    JobTypeName = "Print Job";
                }
            }
        }
示例#2
0
        internal override void SetPipelineTypeSpecificParameters(ActiveJob activeJob)
        {
            base.SetPipelineTypeSpecificParameters(activeJob);

            using (var stream = new StringReader(activeJob.BootParameters.ToString()))
            {
                var xmlStream = new XmlSerializer(typeof(BulkPrintServiceRequestBEO));
                bulkPrintServiceRequestBEO = xmlStream.Deserialize(stream) as BulkPrintServiceRequestBEO;
                if (bulkPrintServiceRequestBEO != null)
                {
                    JobName     = bulkPrintServiceRequestBEO.Name;
                    JobTypeName = "Print Job";
                }
            }
        }
示例#3
0
        /// <summary>
        /// InitializeForProcessing
        /// </summary>
        /// <param name="printBootParameter">Print Boot Parameter</param>
        private void InitializeForProcessing(string printBootParameter)
        {
            if (!string.IsNullOrEmpty(printBootParameter))
            {
                //Creating a stringReader stream for the bootparameter
                var stream = new StringReader(printBootParameter);

                //Ceating xmlStream for xmlserialization
                var xmlStream = new XmlSerializer(typeof(BulkPrintServiceRequestBEO));

                //De serialization of boot parameter to get BulkPrintServiceRequestBEO
                _mBootParameters = (BulkPrintServiceRequestBEO)xmlStream.Deserialize(stream);
                _mSharedLocation = _mBootParameters.FolderPath;
            }
        }
示例#4
0
        /// <summary>
        /// This method will return print details BEO out of the passed bootparamter
        /// </summary>
        /// <param name="bootParamter"></param>
        /// <returns>print details entity object</returns>
        private BulkPrintServiceRequestBEO GetPrintDetailsBusinessEntity(string bootParamter)
        {
            BulkPrintServiceRequestBEO toReturn = null;

            if (!string.IsNullOrEmpty(bootParamter))
            {
                //Creating a stringReader stream for the bootparameter
                var stream = new StringReader(bootParamter);

                //Ceating xmlStream for xmlserialization
                var xmlStream = new XmlSerializer(typeof(BulkPrintServiceRequestBEO));

                //Deserialization of bootparameter to get BulkPrintServiceRequestBEO
                toReturn = (BulkPrintServiceRequestBEO)xmlStream.Deserialize(stream);
            }
            return(toReturn);
        }
        protected override void BeginWork()
        {
            base.BeginWork();
            //Creating a stringReader stream for the bootparameter
            var stream = new StringReader(BootParameters);

            //Ceating xmlStream for xmlserialization
            var xmlStream = new XmlSerializer(typeof(BulkPrintServiceRequestBEO));

            //Deserialization of bootparameter to get BulkPrintServiceRequestBEO
            bulkPrintServiceRequestBEO = (BulkPrintServiceRequestBEO)xmlStream.Deserialize(stream);
            sharedLocation             = bulkPrintServiceRequestBEO.FolderPath;
            mappedPrinter  = PrinterManagementBusiness.GetMappedPrinter(new MappedPrinterIdentifierBEO(bulkPrintServiceRequestBEO.Printer.UniqueIdentifier.Split(Constants.Split).Last(), true));
            sourceLocation = Path.Combine(Path.Combine(sharedLocation, bulkPrintServiceRequestBEO.Name), Constants.SourceDirectoryPath);
            jobRunId       = (!String.IsNullOrEmpty(PipelineId)) ? Convert.ToInt32(PipelineId) : 0;
            //Get Dataset details for a given Collection Id
            _mDataSet = DataSetBO.GetDataSetDetailForCollectionId(bulkPrintServiceRequestBEO.DataSet.CollectionId);
        }
        protected override void BeginWork()
        {
            base.BeginWork();
            //Creating a stringReader stream for the bootparameter
            var stream = new StringReader(BootParameters);

            //Ceating xmlStream for xmlserialization
            var xmlStream = new XmlSerializer(typeof(BulkPrintServiceRequestBEO));

            //Deserialization of bootparameter to get BulkPrintServiceRequestBEO
            bulkPrintServiceRequestBEO = (BulkPrintServiceRequestBEO)xmlStream.Deserialize(stream);
            sharedLocation = bulkPrintServiceRequestBEO.FolderPath;
            mappedPrinter = PrinterManagementBusiness.GetMappedPrinter(new MappedPrinterIdentifierBEO(bulkPrintServiceRequestBEO.Printer.UniqueIdentifier.Split(Constants.Split).Last(), true));
            sourceLocation = Path.Combine(Path.Combine(sharedLocation, bulkPrintServiceRequestBEO.Name), Constants.SourceDirectoryPath);
            jobRunId = (!String.IsNullOrEmpty(PipelineId)) ? Convert.ToInt32(PipelineId) : 0;
            //Get Dataset details for a given Collection Id
            _mDataSet = DataSetBO.GetDataSetDetailForCollectionId(bulkPrintServiceRequestBEO.DataSet.CollectionId);
        }
示例#7
0
        /// <summary>
        /// Begins the work.
        /// </summary>
        protected override void BeginWork()
        {
            base.BeginWork();

            #region Assertion

            //Pre Condition
            BootParameters.ShouldNotBe(null);
            BootParameters.ShouldBeTypeOf <string>();
            PipelineId.ShouldNotBeEmpty();

            #endregion

            // Get values from boot parameters....
            _mBootParameters = GetPrintDetailsBusinessEntity(BootParameters);
            _mCollectionId   = _mBootParameters.DataSet.CollectionId;
            _mCreatedBy      = _mBootParameters.RequestedBy.UserId;
            // Mock session
            MockSession();
        }
        /// <summary>
        /// Begins the work.
        /// </summary>
        protected override void BeginWork()
        {
            base.BeginWork();

            #region Assertion

            //Pre Condition
            BootParameters.ShouldNotBe(null);
            BootParameters.ShouldBeTypeOf<string>();
            PipelineId.ShouldNotBeEmpty();

            #endregion

            // Get values from boot parameters....
            _mBootParameters = GetPrintDetailsBusinessEntity(BootParameters);
            _mCollectionId = _mBootParameters.DataSet.CollectionId;
            _mCreatedBy = _mBootParameters.RequestedBy.UserId;
            // Mock session
            MockSession();
        }
示例#9
0
        /// <summary>
        /// Print the document
        /// </summary>
        /// <param name="jobId"></param>
        /// <param name="request"></param>
        /// <param name="document"></param>
        /// <param name="separatorSheet"></param>
        /// <param name="errorCode"></param>
        /// <returns></returns>
        private bool PrintDocumentSet(string jobId, BulkPrintServiceRequestBEO request, DocumentResult document,
                                      string separatorSheet, out string errorCode)
        {
            var toReturn   = false;
            var title      = string.Empty;
            var fieldValue = string.Empty;
            var binaryType = NativeSetBinaryType;
            var sb         = new StringBuilder(string.Empty);

            //Get the binary types for the images
            switch (request.BulkPrintOptions.ImageType.ImageType)
            {
            case DocumentImageTypeBEO.Native:
                binaryType = NativeSetBinaryType;
                break;

            case DocumentImageTypeBEO.ImageSet:
                binaryType = ImageSetBinaryType;
                break;

            case DocumentImageTypeBEO.ProductionSet:
                binaryType = ProductionSetBinaryType;
                break;
            }
            //Get the document binary
            var documentData = DocumentBO.GetDocumentBinaryData(long.Parse(request.DataSet.MatterId),
                                                                request.BulkPrintOptions.ImageType.
                                                                ImageIdentifier.CollectionId,
                                                                document.DocumentID, binaryType,
                                                                string.Empty);

            #region Assertion

            documentData.ShouldNotBe(null);
            documentData.DocumentBinary.ShouldNotBe(null);

            #endregion

            var isFileExists = documentData.DocumentBinary.FileList.Count > 0;
            errorCode = string.Empty;
            foreach (var fileInfo in documentData.DocumentBinary.FileList)
            {
                if (!File.Exists(fileInfo.Path))
                {
                    isFileExists = false;
                    break;
                }
            }
            m_UserDetails = UserBO.GetUserUsingGuid(request.RequestedBy.UserId);
            userContext   = CreateUserContext(request.RequestedBy.UserId);
            EVHttpContext.CurrentContext = userContext;
            //Construct Query string
            if (!isFileExists)
            {
                errorCode = "Bulk print Invalid file";
                toReturn  = true;
            }
            else
            {
                fieldValue = document.DocumentControlNumber;
                if (document.Fields != null && document.Fields.Any())
                {
                    fieldValue = document.DocumentControlNumber;
                    title      = Constants.TitleNotAvailable;
                    foreach (var field in document.Fields)
                    {
                        if (field == null)
                        {
                            continue;
                        }
                        if (field.DataTypeId == Constants.TitleFieldType)
                        {
                            title = !string.IsNullOrEmpty(field.Value) ? fieldValue.Trim() : title;
                        }
                        if (String.IsNullOrEmpty(field.Name))
                        {
                            continue;
                        }
                        if (field.Name.Equals(_mBootParameters.FieldName))
                        {
                            fieldValue = !string.IsNullOrEmpty(field.Value) ? field.Value.Trim() : fieldValue;
                        }
                    }
                }
                var specialChars = new List <string> {
                    "<", ">", ":", "\"", "\\", "|", "?", "*", "."
                };
                if (specialChars.Exists(x => fieldValue.Contains(x)))
                {
                    // Log documents with special characters or empty values...
                    toReturn  = false;
                    errorCode = "Special characters in the field value and hence cannot be printed";
                }
                else
                {
                    ConstructQueryString(jobId, document, title, separatorSheet, sb, documentData, fieldValue);
                    try
                    {
                        toReturn = CreatePostWebRequestForCreatingPdf(jobId, sb.ToString());
                    }
                    catch (WebException webException)
                    {
                        webException.Trace().Swallow();
                    }
                    catch (Exception ex)
                    {
                        ex.Trace().Swallow();
                        errorCode = "Error in Conversion and hence cannot be printed";
                    }
                }
            }
            return(toReturn);
        }
        /// <summary>
        /// InitializeForProcessing
        /// </summary>
        /// <param name="printBootParameter">Print Boot Parameter</param>
        private void InitializeForProcessing(string printBootParameter)
        {
            if (!string.IsNullOrEmpty(printBootParameter))
            {
                //Creating a stringReader stream for the bootparameter
                var stream = new StringReader(printBootParameter);

                //Ceating xmlStream for xmlserialization
                var xmlStream = new XmlSerializer(typeof (BulkPrintServiceRequestBEO));

                //De serialization of boot parameter to get BulkPrintServiceRequestBEO
                _mBootParameters = (BulkPrintServiceRequestBEO) xmlStream.Deserialize(stream);
                _mSharedLocation = _mBootParameters.FolderPath;
            }
        }
        /// <summary>
        /// Print the document
        /// </summary>
        /// <param name="jobId"></param>
        /// <param name="request"></param>
        /// <param name="document"></param>       
        /// <param name="separatorSheet"></param>
        /// <param name="errorCode"></param>
        /// <returns></returns>
        private bool PrintDocumentSet(string jobId, BulkPrintServiceRequestBEO request, DocumentResult document,
            string separatorSheet, out string errorCode)
        {
            var toReturn = false;
            var title = string.Empty;
            var fieldValue = string.Empty;
            var binaryType = NativeSetBinaryType;
            var sb = new StringBuilder(string.Empty);
            //Get the binary types for the images
            switch (request.BulkPrintOptions.ImageType.ImageType)
            {
                case DocumentImageTypeBEO.Native:
                    binaryType = NativeSetBinaryType;
                    break;
                case DocumentImageTypeBEO.ImageSet:
                    binaryType = ImageSetBinaryType;
                    break;
                case DocumentImageTypeBEO.ProductionSet:
                    binaryType = ProductionSetBinaryType;
                    break;
            }
            //Get the document binary            
            var documentData = DocumentBO.GetDocumentBinaryData(long.Parse(request.DataSet.MatterId),
                request.BulkPrintOptions.ImageType.
                    ImageIdentifier.CollectionId,
                document.DocumentID, binaryType,
                string.Empty);

            #region Assertion

            documentData.ShouldNotBe(null);
            documentData.DocumentBinary.ShouldNotBe(null);

            #endregion

            var isFileExists = documentData.DocumentBinary.FileList.Count > 0;
            errorCode = string.Empty;
            foreach (var fileInfo in documentData.DocumentBinary.FileList)
            {
                if (!File.Exists(fileInfo.Path))
                {
                    isFileExists = false;
                    break;
                }
            }
            m_UserDetails = UserBO.GetUserUsingGuid(request.RequestedBy.UserId);
            userContext = CreateUserContext(request.RequestedBy.UserId);
            EVHttpContext.CurrentContext = userContext;
            //Construct Query string                       
            if (!isFileExists)
            {
                errorCode = "Bulk print Invalid file";
                toReturn = true;
            }
            else
            {
                fieldValue = document.DocumentControlNumber;
                if (document.Fields != null && document.Fields.Any())
                {
                    fieldValue = document.DocumentControlNumber;
                    title = Constants.TitleNotAvailable;
                    foreach (var field in document.Fields)
                    {
                        if (field == null) continue;
                        if (field.DataTypeId == Constants.TitleFieldType)
                            title = !string.IsNullOrEmpty(field.Value) ? fieldValue.Trim() : title;
                        if (String.IsNullOrEmpty(field.Name)) continue;
                        if (field.Name.Equals(_mBootParameters.FieldName))
                            fieldValue = !string.IsNullOrEmpty(field.Value) ? field.Value.Trim() : fieldValue;
                    }
                }
                var specialChars = new List<string> {"<", ">", ":", "\"", "\\", "|", "?", "*", "."};
                if (specialChars.Exists(x => fieldValue.Contains(x)))
                {
                    // Log documents with special characters or empty values...
                    toReturn = false;
                    errorCode = "Special characters in the field value and hence cannot be printed";
                }
                else
                {
                    ConstructQueryString(jobId, document, title, separatorSheet, sb, documentData, fieldValue);
                    try
                    {
                        toReturn = CreatePostWebRequestForCreatingPdf(jobId, sb.ToString());
                    }
                    catch (WebException webException)
                    {
                        webException.Trace().Swallow();
                    }
                    catch (Exception ex)
                    {
                        ex.Trace().Swallow();
                        errorCode = "Error in Conversion and hence cannot be printed";
                    }
                }
            }
            return toReturn;
        }