Ejemplo n.º 1
0
        /// <summary>
        /// Gets the production document list for ID list.
        /// </summary>
        /// <param name="idList">The id list.</param>
        /// <param name="idType">Type of the id.</param>
        /// <param name="matterId">The matter id.</param>
        /// <param name="baseJobConfig">The base job config.</param>
        /// <param name="redactableCollectionId">The redactable collection id.</param>
        /// <param name="jobId"> </param>
        /// <returns></returns>
        public static IEnumerable <ReconversionProductionDocumentBEO> GetProductionDocumentListForIdList(
            List <string> idList, string idType, long matterId,
            ProductionDetailsBEO baseJobConfig, string redactableCollectionId, int jobId)
        {
            //init field id value
            int batesFieldId      = -1;
            int batesBeginFieldId = -1;
            int batesEndFieldId   = -1;
            int dpnFieldId        = -1;

            //bates field: 3004
            var batesField = baseJobConfig.Profile.ProductionFields.FirstOrDefault(f => f.FieldType.DataTypeId == 3004);

            if (batesField != null)
            {
                batesFieldId = batesField.ID;
            }

            //bates begin: 3005
            var batesBeginField =
                baseJobConfig.Profile.ProductionFields.FirstOrDefault(f => f.FieldType.DataTypeId == 3005);

            if (batesBeginField != null)
            {
                batesBeginFieldId = batesBeginField.ID;
            }

            //bates end: 3006
            var batesEndField =
                baseJobConfig.Profile.ProductionFields.FirstOrDefault(f => f.FieldType.DataTypeId == 3006);

            if (batesEndField != null)
            {
                batesEndFieldId = batesEndField.ID;
            }

            //dpn field: 3008
            var dpnField = baseJobConfig.Profile.ProductionFields.FirstOrDefault(f => f.FieldType.DataTypeId == 3008);

            if (dpnField != null)
            {
                dpnFieldId = dpnField.ID;
            }


            //get the collection id for the native collection
            string nativeCollectionId = baseJobConfig.OriginalCollectionId;


            //find the production collection id at the time of the original production
            string productionCollectionId = baseJobConfig.CollectionId;

            //Get the list of production documents for reprocessing
            var docList = new List <ReconversionProductionDocumentBEO>();

            var vault = VaultRepository.CreateRepository(matterId);

            DataSet dsResult = vault.GetProductionReprocessDocumentList(idList, idType, redactableCollectionId,
                                                                        nativeCollectionId, productionCollectionId,
                                                                        dpnFieldId, batesFieldId, batesBeginFieldId,
                                                                        batesEndFieldId, jobId);

            ReconversionProductionDocumentBEO doc = null;

            //process returned records
            if (dsResult != null && dsResult.Tables.Count > 0)
            {
                foreach (DataRow dr in dsResult.Tables[0].Rows)
                {
                    string docReferenceId = dr[Constants.ColumnDocReferenceId].ToString();

                    if (doc == null || !docReferenceId.Equals(doc.DocumentId))
                    //new document (need to check this due to that multiple rows are returned, one row for each field)
                    {
                        doc                = new ReconversionProductionDocumentBEO();
                        doc.DocumentId     = docReferenceId;
                        doc.DCNNumber      = dr[Constants.DCN].ToString();
                        doc.ProductionPath = dr[Constants.ProductionPath].ToString();
                        docList.Add(doc);
                    }

                    int fieldId = dr[Constants.ColumnFieldId] != DBNull.Value
                                      ? Convert.ToInt32(dr[Constants.ColumnFieldId].ToString())
                                      : -1;
                    string fieldValue = dr[Constants.ColumnFieldvalue] != DBNull.Value
                                            ? dr[Constants.ColumnFieldvalue].ToString()
                                            : "";

                    if (dpnFieldId > 0 && dpnFieldId == fieldId)
                    {
                        doc.DocumentProductionNumber = fieldValue;
                    }
                    if (batesFieldId > 0 && batesFieldId == fieldId)
                    {
                        doc.AllBates = fieldValue;
                    }
                    if (batesBeginFieldId > 0 && batesBeginFieldId == fieldId)
                    {
                        doc.StartingBatesNumber = fieldValue;
                    }
                    if (batesEndFieldId > 0 && batesEndFieldId == fieldId)
                    {
                        doc.EndingBatesNumber = fieldValue;
                    }
                }


                //if any of the bates or dpn contain comma,  ie, contain multiple bates or dpn
                string bates = docList[0].StartingBatesNumber;
                string dpn   = docList[0].DocumentProductionNumber;

                //extrac the correct dpn if dpn contain concatenated ids, which could happen because multiple productions done on
                //the same collection, with same dpn field name
                //sample dpn sequence: "dd003, dd103, k45k005, k45k105, dd203, kkk001, ddd002, dd303, k45k205"
                if (dpn != null && dpn.Contains(","))
                {
                    RecalculateCorrectDpnNumbers(docList, baseJobConfig,
                                                 vault.GetDocumentCountForCollection(new Guid(productionCollectionId)));
                }

                //extrac the correct bates info if bates contain concatenated ids, which could happen because multiple productions done on
                //the same collection, with same bates field name
                //if bates is configures, the file name for the production contain the beginBates number.
                if ((bates != null && bates.Contains(",")))
                {
                    RecalculateCorrectBatesNumbers(docList);
                }
            }

            return(docList);
        }
        /// <summary>
        /// Gets the production document list for ID list.
        /// </summary>
        /// <param name="idList">The id list.</param>
        /// <param name="idType">Type of the id.</param>
        /// <param name="matterId">The matter id.</param>
        /// <param name="baseJobConfig">The base job config.</param>
        /// <param name="redactableCollectionId">The redactable collection id.</param>
        /// <param name="jobId"> </param>
        /// <returns></returns>
        public static IEnumerable<ReconversionProductionDocumentBEO> GetProductionDocumentListForIdList(
            List<string> idList, string idType, long matterId,
            ProductionDetailsBEO baseJobConfig, string redactableCollectionId, int jobId)
        {

            //init field id value
            int batesFieldId = -1;
            int batesBeginFieldId = -1;
            int batesEndFieldId = -1;
            int dpnFieldId = -1;

            //bates field: 3004
            var batesField = baseJobConfig.Profile.ProductionFields.FirstOrDefault(f => f.FieldType.DataTypeId == 3004);
            if (batesField != null) batesFieldId = batesField.ID;

            //bates begin: 3005
            var batesBeginField =
                baseJobConfig.Profile.ProductionFields.FirstOrDefault(f => f.FieldType.DataTypeId == 3005);
            if (batesBeginField != null) batesBeginFieldId = batesBeginField.ID;

            //bates end: 3006
            var batesEndField =
                baseJobConfig.Profile.ProductionFields.FirstOrDefault(f => f.FieldType.DataTypeId == 3006);
            if (batesEndField != null) batesEndFieldId = batesEndField.ID;

            //dpn field: 3008
            var dpnField = baseJobConfig.Profile.ProductionFields.FirstOrDefault(f => f.FieldType.DataTypeId == 3008);
            if (dpnField != null) dpnFieldId = dpnField.ID;


            //get the collection id for the native collection
            string nativeCollectionId = baseJobConfig.OriginalCollectionId;


            //find the production collection id at the time of the original production
            string productionCollectionId = baseJobConfig.CollectionId;

            //Get the list of production documents for reprocessing
            var docList = new List<ReconversionProductionDocumentBEO>();

            var vault = VaultRepository.CreateRepository(matterId);

            DataSet dsResult = vault.GetProductionReprocessDocumentList(idList, idType, redactableCollectionId,
                                                                        nativeCollectionId, productionCollectionId,
                                                                        dpnFieldId, batesFieldId, batesBeginFieldId,
                                                                        batesEndFieldId, jobId);

            ReconversionProductionDocumentBEO doc = null;

            //process returned records
            if (dsResult != null && dsResult.Tables.Count > 0)
            {
                foreach (DataRow dr in dsResult.Tables[0].Rows)
                {
                    string docReferenceId = dr[Constants.ColumnDocReferenceId].ToString();

                    if (doc == null || !docReferenceId.Equals(doc.DocumentId))
                    //new document (need to check this due to that multiple rows are returned, one row for each field)
                    {
                        doc = new ReconversionProductionDocumentBEO();
                        doc.DocumentId = docReferenceId;
                        doc.DCNNumber = dr[Constants.DCN].ToString();
                        doc.ProductionPath = dr[Constants.ProductionPath].ToString();
                        docList.Add(doc);
                    }

                    int fieldId = dr[Constants.ColumnFieldId] != DBNull.Value
                                      ? Convert.ToInt32(dr[Constants.ColumnFieldId].ToString())
                                      : -1;
                    string fieldValue = dr[Constants.ColumnFieldvalue] != DBNull.Value
                                            ? dr[Constants.ColumnFieldvalue].ToString()
                                            : "";

                    if (dpnFieldId > 0 && dpnFieldId == fieldId) doc.DocumentProductionNumber = fieldValue;
                    if (batesFieldId > 0 && batesFieldId == fieldId) doc.AllBates = fieldValue;
                    if (batesBeginFieldId > 0 && batesBeginFieldId == fieldId) doc.StartingBatesNumber = fieldValue;
                    if (batesEndFieldId > 0 && batesEndFieldId == fieldId) doc.EndingBatesNumber = fieldValue;
                }


                //if any of the bates or dpn contain comma,  ie, contain multiple bates or dpn
                string bates = docList[0].StartingBatesNumber;
                string dpn = docList[0].DocumentProductionNumber;

                //extrac the correct dpn if dpn contain concatenated ids, which could happen because multiple productions done on 
                //the same collection, with same dpn field name
                //sample dpn sequence: "dd003, dd103, k45k005, k45k105, dd203, kkk001, ddd002, dd303, k45k205"
                if (dpn != null && dpn.Contains(","))
                {
                    RecalculateCorrectDpnNumbers(docList, baseJobConfig,
                                                 vault.GetDocumentCountForCollection(new Guid(productionCollectionId)));
                }

                //extrac the correct bates info if bates contain concatenated ids, which could happen because multiple productions done on 
                //the same collection, with same bates field name
                //if bates is configures, the file name for the production contain the beginBates number. 
                if ((bates != null && bates.Contains(",")))
                {
                    RecalculateCorrectBatesNumbers(docList);
                }

            }

            return docList;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Convert the document to the ProductionDocumentDetail that can be used by ProductionNearNativeConversionHelper class
        /// </summary>
        /// <param name="document">The document</param>
        /// <param name="modelDoc">The model document</param>
        private static ProductionDocumentDetail ConvertToProductionDocumentDetail(
            ReconversionProductionDocumentBEO document, ProductionDocumentDetail modelDoc)
        {
            var pDoc = new ProductionDocumentDetail
            {
                MatterId  = modelDoc.MatterId,
                CreatedBy = modelDoc.CreatedBy,
                DocumentSelectionContext = modelDoc.DocumentSelectionContext,
                DatasetCollectionId      = modelDoc.DatasetCollectionId,
                OriginalCollectionId     = modelDoc.OriginalCollectionId,
                DocumentExclusionContext = modelDoc.DocumentExclusionContext,
                ProductionCollectionId   = modelDoc.ProductionCollectionId,
                Profile             = modelDoc.Profile,
                ArchivePath         = modelDoc.ArchivePath,
                OriginalDatasetId   = modelDoc.OriginalDatasetId,
                OriginalDatasetName = modelDoc.OriginalDatasetName,
                GetText             = modelDoc.GetText,
                lstProductionFields = modelDoc.lstProductionFields,
                dataSetBeo          = modelDoc.dataSetBeo,
                lstDsFieldsBeo      = modelDoc.lstDsFieldsBeo,
                matterBeo           = modelDoc.matterBeo,
                SearchServerDetails = modelDoc.SearchServerDetails
            };

            //same info for all docs
            //pDoc.ManageShareRootPath = modelDoc.ManageShareRootPath;
            pDoc.GetText = modelDoc.GetText;

            //pupulate from document



            pDoc.DocumentId = document.DocumentId;
            pDoc.OriginalDocumentReferenceId = document.DocumentId;
            pDoc.DCNNumber = document.DCNNumber;

            //populdate bates
            pDoc.StartingBatesNumber = document.StartingBatesNumber;
            pDoc.EndingBatesNumber   = document.EndingBatesNumber;

            //comma seperated list of bates numbers
            pDoc.AllBates = document.AllBates;

            //get the number of pages by counting all bates
            if (document.AllBates != null)
            {
                pDoc.NumberOfPages = (document.AllBates.Split(new char[] { ',' })).Length;
            }

            //popudate DPN
            pDoc.DocumentProductionNumber = document.DocumentProductionNumber;

            //set NearNativeConversionPriority
            pDoc.NearNativeConversionPriority = document.NearNativeConversionPriority;
            //get the directory for the production location; ProductionPath contain the full path, including the file name
            if (String.IsNullOrEmpty(document.ProductionPath))
            {
                return(pDoc);
            }
            pDoc.ExtractionLocation = Path.GetDirectoryName(document.ProductionPath);
            return(pDoc);
        }
        /// <summary>
        /// Convert the document to the ProductionDocumentDetail that can be used by ProductionNearNativeConversionHelper class
        /// </summary>
        /// <param name="document">The document</param>
        /// <param name="modelDoc">The model document</param>
        private static ProductionDocumentDetail ConvertToProductionDocumentDetail(
            ReconversionProductionDocumentBEO document, ProductionDocumentDetail modelDoc)
        {
            var pDoc = new ProductionDocumentDetail
            {
                MatterId = modelDoc.MatterId,
                CreatedBy = modelDoc.CreatedBy,
                DocumentSelectionContext = modelDoc.DocumentSelectionContext,
                DatasetCollectionId = modelDoc.DatasetCollectionId,
                OriginalCollectionId = modelDoc.OriginalCollectionId,
                DocumentExclusionContext = modelDoc.DocumentExclusionContext,
                ProductionCollectionId = modelDoc.ProductionCollectionId,
                Profile = modelDoc.Profile,
                ArchivePath = modelDoc.ArchivePath,
                OriginalDatasetId = modelDoc.OriginalDatasetId,
                OriginalDatasetName = modelDoc.OriginalDatasetName,
                GetText = modelDoc.GetText,
                lstProductionFields = modelDoc.lstProductionFields,
                dataSetBeo = modelDoc.dataSetBeo,
                lstDsFieldsBeo = modelDoc.lstDsFieldsBeo,
                matterBeo = modelDoc.matterBeo,
                SearchServerDetails = modelDoc.SearchServerDetails
            };

            //same info for all docs
            //pDoc.ManageShareRootPath = modelDoc.ManageShareRootPath;
            pDoc.GetText = modelDoc.GetText;

            //pupulate from document



            pDoc.DocumentId = document.DocumentId;
            pDoc.OriginalDocumentReferenceId = document.DocumentId;
            pDoc.DCNNumber = document.DCNNumber;

            //populdate bates
            pDoc.StartingBatesNumber = document.StartingBatesNumber;
            pDoc.EndingBatesNumber = document.EndingBatesNumber;

            //comma seperated list of bates numbers
            pDoc.AllBates = document.AllBates;

            //get the number of pages by counting all bates
            if (document.AllBates != null)
                pDoc.NumberOfPages = (document.AllBates.Split(new char[] {','})).Length;

            //popudate DPN
            pDoc.DocumentProductionNumber = document.DocumentProductionNumber;

            //set NearNativeConversionPriority
            pDoc.NearNativeConversionPriority = document.NearNativeConversionPriority;
            //get the directory for the production location; ProductionPath contain the full path, including the file name
            if (String.IsNullOrEmpty(document.ProductionPath)) return pDoc;
            pDoc.ExtractionLocation = Path.GetDirectoryName(document.ProductionPath);
            return pDoc;
        }