Exemplo n.º 1
0
        /// <summary>
        /// Gets the reconversion document beos for job id.
        /// </summary>
        /// <param name="matterId">The matter id.</param>
        /// <param name="jobId">The job id.</param>
        /// <param name="filters">The filters.</param>
        /// <returns></returns>
        public static IEnumerable <ReconversionDocumentBEO> GetReconversionDocumentBeosForJobId(long matterId, long jobId,
                                                                                                string filters)
        {
            IDataReader dataReader = null;

            if (!string.IsNullOrEmpty(filters))
            {
                //user can filter the conversion results then do select all
                //filters has filter key : value with comma a delimiter
                var documentVaultManager = new DocumentVaultManager();
                documentVaultManager.Init(matterId);
                dataReader = documentVaultManager.GetConversionResultsDataReader(matterId, jobId, null, null, filters);
            }
            else
            {
                var          evDbManager = new EVDbManager(matterId);
                const string sqlCommand  =
                    @"SELECT dm.DocID,dm.DocTitle,dm.DocReferenceID, dm.CollectionID, ps.DCN ,T.DocText
                FROM [dbo].[DOC_ProcessSet] AS ps 
                INNER JOIN [dbo].[DOC_DocumentMaster] AS dm ON ps.[DocID] = dm.[DocID] 
                LEFT OUTER JOIN  dbo.DOC_DocumentText T ON DM.DocID = T.DocID AND T.TextTypeID = 2 
                WHERE ps.JobID = @JobID 
                ORDER BY  DM.DocTitle";
                var dbCommand = evDbManager.CreateTextCommand(sqlCommand);
                dbCommand.CommandTimeout = 0;
                evDbManager.AddInParameter(dbCommand, "JobID", DbType.Int64, jobId);
                dataReader = evDbManager.ExecuteDataReader(dbCommand);
            }

            Debug.Assert(dataReader != null);
            ReconversionDocumentBEO reconversionDocumentBeo = null;

            while (dataReader.Read())
            {
                string docRefId     = dataReader["DocReferenceID"].ToString();
                string collectionId = dataReader["CollectionID"].ToString();
                string dcn          = dataReader["DCN"].ToString();

                //new document (need to check this due to that multiple rows are returned in case of one document with multiple file path associated)
                if (reconversionDocumentBeo == null ||
                    !docRefId.Equals(reconversionDocumentBeo.DocumentId) ||
                    !collectionId.Equals(reconversionDocumentBeo.CollectionId) ||
                    !dcn.Equals(reconversionDocumentBeo.DCNNumber))
                {
                    if (reconversionDocumentBeo != null)
                    {
                        //query sorts the results in DCN order
                        //accumulate the file list of the document (DCN) then yield
                        //Example:(DCN File1),(DCN,File2) and (DCN001, File3)
                        //yield DCN,<File1,File2,File3>
                        yield return(reconversionDocumentBeo);
                    }
                    reconversionDocumentBeo = new ReconversionDocumentBEO()
                    {
                        DocumentId   = docRefId,
                        CollectionId = collectionId,
                        DCNNumber    = dcn
                    };
                }
                reconversionDocumentBeo.FileList.Add(dataReader[Constants.ColumnDocText].ToString());
                //add file path to list of file path for the document
            }
            dataReader.Close();
            if (reconversionDocumentBeo != null)
            {
                yield return(reconversionDocumentBeo);
            }
        }
        /// <summary>
        /// Gets the reconversion document beos for job id.
        /// </summary>
        /// <param name="matterId">The matter id.</param>
        /// <param name="jobId">The job id.</param>
        /// <param name="filters">The filters.</param>
        /// <returns></returns>
        public static IEnumerable<ReconversionDocumentBEO> GetReconversionDocumentBeosForJobId(long matterId, long jobId,
                                                                                               string filters)
        {

            IDataReader dataReader = null;

            if (!string.IsNullOrEmpty(filters))
            {
                //user can filter the conversion results then do select all
                //filters has filter key : value with comma a delimiter
                var documentVaultManager = new DocumentVaultManager();
                documentVaultManager.Init(matterId);
                dataReader = documentVaultManager.GetConversionResultsDataReader(matterId, jobId, null, null, filters);
            }
            else
            {
                var evDbManager = new EVDbManager(matterId);
                const string sqlCommand =
                    @"SELECT dm.DocID,dm.DocTitle,dm.DocReferenceID, dm.CollectionID, ps.DCN ,T.DocText
                FROM [dbo].[DOC_ProcessSet] AS ps 
                INNER JOIN [dbo].[DOC_DocumentMaster] AS dm ON ps.[DocID] = dm.[DocID] 
                LEFT OUTER JOIN  dbo.DOC_DocumentText T ON DM.DocID = T.DocID AND T.TextTypeID = 2 
                WHERE ps.JobID = @JobID 
                ORDER BY  DM.DocTitle";
                var dbCommand = evDbManager.CreateTextCommand(sqlCommand);
                dbCommand.CommandTimeout = 0;
                evDbManager.AddInParameter(dbCommand, "JobID", DbType.Int64, jobId);
                dataReader = evDbManager.ExecuteDataReader(dbCommand);
            }

            Debug.Assert(dataReader!=null);
            ReconversionDocumentBEO reconversionDocumentBeo = null;
            while (dataReader.Read())
            {
                string docRefId = dataReader["DocReferenceID"].ToString();
                string collectionId = dataReader["CollectionID"].ToString();
                string dcn = dataReader["DCN"].ToString();

                //new document (need to check this due to that multiple rows are returned in case of one document with multiple file path associated)
                if (reconversionDocumentBeo == null ||
                    !docRefId.Equals(reconversionDocumentBeo.DocumentId) ||
                    !collectionId.Equals(reconversionDocumentBeo.CollectionId) ||
                    !dcn.Equals(reconversionDocumentBeo.DCNNumber))
                {

                    if (reconversionDocumentBeo != null)
                    {
                        //query sorts the results in DCN order
                        //accumulate the file list of the document (DCN) then yield
                        //Example:(DCN File1),(DCN,File2) and (DCN001, File3)
                        //yield DCN,<File1,File2,File3> 
                        yield return reconversionDocumentBeo;
                    }
                    reconversionDocumentBeo = new ReconversionDocumentBEO()
                                                  {
                                                      DocumentId = docRefId,
                                                      CollectionId = collectionId,
                                                      DCNNumber = dcn
                                                  };
                }
                reconversionDocumentBeo.FileList.Add(dataReader[Constants.ColumnDocText].ToString());
                //add file path to list of file path for the document

            }
            dataReader.Close();
            if (reconversionDocumentBeo != null) yield return reconversionDocumentBeo;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets the production document list.
        /// </summary>
        /// <param name="filePath">The file path.</param>
        /// <param name="selectionMode">The selection mode.</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>
        /// <param name="filters"> </param>
        /// <returns></returns>
        public virtual IEnumerable <ReconversionProductionDocumentBEO> GetProductionDocumentList(
            string filePath, ReProcessJobSelectionMode selectionMode, long matterId,
            ProductionDetailsBEO baseJobConfig, string redactableCollectionId, int jobId, string filters = null)
        {
            switch (selectionMode)
            {
            case ReProcessJobSelectionMode.Selected:
            {
                var docidList = GetDocumentIdListFromFile(filePath, Constants.DocId);
                foreach (var v in GetProductionDocumentListForIdList(
                             docidList, Constants.DocId, matterId, baseJobConfig, redactableCollectionId, jobId))
                {
                    yield return(v);
                }
                break;
            }

            case ReProcessJobSelectionMode.Csv:
            case ReProcessJobSelectionMode.CrossReference:
            {
                var dictIds = GetDocumentIdListFromFile(filePath, Constants.DCN, Constants.DocumentSetName);

                //put all value in one list. Since there is only one production set, it should all be the same collectionId
                var ids = new List <string>();
                foreach (var dictId in dictIds)
                {
                    ids.AddRange(dictId.Value);
                }
                foreach (var v in GetProductionDocumentListForIdList(
                             ids, Constants.DCN, matterId, baseJobConfig, redactableCollectionId, jobId))
                {
                    yield return(v);
                }
                break;
            }

            case ReProcessJobSelectionMode.All:
                IEnumerable <ReconversionProductionDocumentBEO> reconversionProductionDocumentBeos = null;
                if (!string.IsNullOrEmpty(filters))
                {
                    var documentVaultManager = new DocumentVaultManager();
                    documentVaultManager.Init(matterId);

                    IEnumerable <DocumentConversionLogBeo> documentConversionLogBeos =
                        documentVaultManager.GetConversionResultsWithFilters(matterId, jobId, null, null, filters
                                                                             );
                    var docidList =
                        documentConversionLogBeos.Select(
                            documentConversionLogBeo =>
                            documentConversionLogBeo.DocId.ToString(CultureInfo.InvariantCulture)).ToList();
                    reconversionProductionDocumentBeos = GetProductionDocumentListForIdList(
                        docidList, Constants.DocId, matterId, baseJobConfig, redactableCollectionId, jobId);
                }
                else
                {
                    reconversionProductionDocumentBeos = GetProductionDocumentListForIdList
                                                         (
                        null, "ALL", matterId, baseJobConfig, redactableCollectionId, jobId);
                }
                if (reconversionProductionDocumentBeos == null)
                {
                    yield return(null);
                }
                foreach (var reConversionProductionBeo in reconversionProductionDocumentBeos)
                {
                    yield return(reConversionProductionBeo);
                }
                break;
            }
        }
        /// <summary>
        /// Gets the production document list.
        /// </summary>
        /// <param name="filePath">The file path.</param>
        /// <param name="selectionMode">The selection mode.</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>
        /// <param name="filters"> </param>
        /// <returns></returns>
        public virtual IEnumerable<ReconversionProductionDocumentBEO> GetProductionDocumentList(
            string filePath, ReProcessJobSelectionMode selectionMode, long matterId,
            ProductionDetailsBEO baseJobConfig, string redactableCollectionId, int jobId,string filters=null)
        {
            switch (selectionMode)
            {
                case ReProcessJobSelectionMode.Selected:
                    {
                        var docidList = GetDocumentIdListFromFile(filePath, Constants.DocId);
                        foreach (var v in GetProductionDocumentListForIdList(
                            docidList, Constants.DocId, matterId, baseJobConfig, redactableCollectionId, jobId))
                            yield return v;
                        break;
                    }
                case ReProcessJobSelectionMode.Csv:
                case ReProcessJobSelectionMode.CrossReference:
                    {
                        var dictIds = GetDocumentIdListFromFile(filePath, Constants.DCN, Constants.DocumentSetName);

                        //put all value in one list. Since there is only one production set, it should all be the same collectionId
                        var ids = new List<string>();
                        foreach (var dictId in dictIds)
                        {
                            ids.AddRange(dictId.Value);
                        }
                        foreach (var v in GetProductionDocumentListForIdList(
                            ids, Constants.DCN, matterId, baseJobConfig, redactableCollectionId, jobId)) yield return v;
                        break;
                    }
                case ReProcessJobSelectionMode.All:
                    IEnumerable<ReconversionProductionDocumentBEO> reconversionProductionDocumentBeos = null;
                    if (!string.IsNullOrEmpty(filters))
                    {
                        var documentVaultManager = new DocumentVaultManager();
                        documentVaultManager.Init(matterId);

                        IEnumerable<DocumentConversionLogBeo> documentConversionLogBeos =
                            documentVaultManager.GetConversionResultsWithFilters(matterId, jobId, null, null, filters
                                );
                        var docidList =
                            documentConversionLogBeos.Select(
                                documentConversionLogBeo =>
                                documentConversionLogBeo.DocId.ToString(CultureInfo.InvariantCulture)).ToList();
                        reconversionProductionDocumentBeos = GetProductionDocumentListForIdList(
                            docidList, Constants.DocId, matterId, baseJobConfig, redactableCollectionId, jobId);
                    }
                    else
                    {
                        reconversionProductionDocumentBeos = GetProductionDocumentListForIdList
                            (
                                null, "ALL", matterId, baseJobConfig, redactableCollectionId, jobId);
                    }
                    if (reconversionProductionDocumentBeos == null) yield return null;
                    foreach (var reConversionProductionBeo in reconversionProductionDocumentBeos)
                        yield return reConversionProductionBeo;
                    break;
            }
        }