Beispiel #1
0
            /// <summary>
            /// Builds a <see cref="SlipSheets"/> instance.
            /// </summary>
            /// <returns>Returns a <see cref="SlipSheets"/> instance.</returns>
            public SlipSheets Build()
            {
                SlipSheets instance = this.instance;

                this.instance = null;
                return(instance);
            }
        /// <summary>
        /// Gets all page records for the specified document.
        /// </summary>
        /// <param name="docIndex">The index of the current document in the collection.</param>
        /// <param name="slipsheets">The slipsheets for the document collection .</param>
        /// <returns>Returns all records including slipsheets for the specified document.</returns>
        protected List <string> getPageRecords(int docIndex, SlipSheets slipsheets)
        {
            Document       document    = this.docs[docIndex];
            List <string>  pageRecords = new List <string>();
            Representative imageRep    = document.Representatives
                                         .Where(r => r.Type.Equals(Representative.FileType.Image)).FirstOrDefault();
            Document previousDoc = getPreviousDoc(docIndex);
            Document nextDoc     = getNextDoc(docIndex);

            // check that a rep was found
            if (imageRep != null)
            {
                List <KeyValuePair <string, string> > imageFiles = imageRep.Files.ToList();
                // add page records
                for (int i = 0; i < imageFiles.Count; i++)
                {
                    string   imageKey         = imageFiles[i].Key;
                    string[] recordComponents = getRecordComponents(docIndex, i);
                    string   pageRecord       = String.Join(", ", recordComponents);
                    bool     hasSlipsheet     = false;

                    if (i == 0)
                    {
                        string gs          = recordComponents[GROUP_START_INDEX];
                        string cs          = recordComponents[CODE_START_INDEX];
                        string custData    = recordComponents[CUSTOMER_DATA_INDEX];
                        string namedFolder = recordComponents[NAMED_FOLDER_INDEX];
                        string namedFiles  = recordComponents[NAMED_FILES_INDEX];
                        string ssLine      = slipsheets.GetSlipSheetXrefLine(
                            document, gs, cs, custData, namedFolder, namedFiles);
                        hasSlipsheet = !String.IsNullOrEmpty(ssLine);

                        if (hasSlipsheet)
                        {
                            ssLine = getGhostBoxLine(imageKey, ssLine, docIndex, false);
                            pageRecords.Add(ssLine);
                            recordComponents[GROUP_START_INDEX] = "0";
                            recordComponents[CODE_START_INDEX]  = "0";

                            if (slipsheets.IsBindSlipsheets)
                            {
                                recordComponents[STAPLE_INDEX] = "0";
                            }

                            pageRecord = String.Join(", ", recordComponents);
                        }
                    }

                    pageRecord = getGhostBoxLine(imageKey, pageRecord, docIndex, hasSlipsheet);
                    pageRecords.Add(pageRecord);
                }
            }

            return(pageRecords);
        }
Beispiel #3
0
 private Builder()
 {
     instance = new SlipSheets();
 }
 /// <summary>
 /// Sets the <see cref="SlipSheets"/> object that controls the creation of
 /// slipsheets in the export.
 /// </summary>
 /// <param name="value">The slipsheets value.</param>
 /// <returns>Returns a <see cref="Builder"/>.</returns>
 public Builder SetSlipsheets(SlipSheets value)
 {
     instance.slipsheets = value;
     return(this);
 }