/// <summary>
        /// Get default heartbeat file path, which is HearbeatFilePath+DCNNumber_heartbeat.txt
        /// </summary>
        /// <remarks></remarks>
        public string GetDefaultHeartbeatFileFullPath(ReconversionDocumentBEO document)
        {
            if (document == null || document.DCNNumber == null) return "";


            
            if (string.IsNullOrEmpty(HeartbeatFilePath))
                throw new EVException().AddUsrMsg("Must specified root path for heartbeat files");

            //everything is good. push for conversion
            if (HeartbeatFilePath.EndsWith(@"\"))
            {
                return HeartbeatFilePath + document.DCNNumber +  "_heartbeat.txt";
            }

            return HeartbeatFilePath +@"\" +document.DCNNumber + "_heartbeat.txt";

            
        }
Example #2
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;
        }
        /// <summary>
        /// Convert the document to the ProductionDocumentDetail that can be used by ProductionNearNativeConversionHelper class
        /// </summary>
        /// <param name="idList">idList</param>
        /// <param name="idType">id type</param>
        /// <param name="collectionId">collection id</param>
        /// <param name="matterId">matter id</param>

        public static IEnumerable<ReconversionDocumentBEO> GetImportDocumentListForIDList(List<string> idList,
                                                                                          string idType,
                                                                                          string collectionId,
                                                                                          long matterId)
        {
            //Convert the list of DCN to list of documentId
            var vault = VaultRepository.CreateRepository(matterId);

            var dsResult = vault.GetImportReprocessDocumentList(idList, idType, collectionId);

            ReconversionDocumentBEO doc = null;
            List<ReconversionDocumentBEO> documents = new List<ReconversionDocumentBEO>();

            if (dsResult != null && dsResult.Tables.Count > 0)
            {
                foreach (DataRow dr in dsResult.Tables[0].Rows)
                {
                    string docRefId = dr[Constants.ColumnDocReferenceId].ToString();
                    string docSetId = dr[Constants.ColumnCollectionId].ToString();
                    string dcn = dr[Constants.ColumnDocTitle].ToString();

                    if (documents.Any(f => f.CollectionId == docSetId && f.DocumentId == docRefId))
                    //new document (need to check this due to that multiple rows are returned in case of one document with multiple file path associated)
                    {
                        //add file path to list of file path for the document
                        documents.FirstOrDefault(f => f.CollectionId == docSetId && f.DocumentId == docRefId).FileList.Add(dr[Constants.ColumnDocText].ToString());
                    }
                    else
                    {
                        doc = new ReconversionDocumentBEO { DocumentId = docRefId, CollectionId = docSetId, DCNNumber = dcn };
                        doc.FileList.Add(dr[Constants.ColumnDocText].ToString());//add file path to list of file path for the document
                        documents.Add(doc);
                    }
                    
                }
            }
            return documents.AsEnumerable();
        }