Ejemplo n.º 1
0
        public IList <SourceDTO> GetSourceDTOsByHash(string hash)
        {
            string sql = @"
                SELECT s.SourceID, s.SourceName, s.FullReference, s.SourcePath, s.SourceDate, s.FileExtension, s.IsRestricted, s.FileDateTimeStamp, s.Archive, 
                    s.IsReadOnly, s.Notes, s.IsPublic, DATALENGTH(s.FileData) AS FileSize, j.CaseNumber AS JhroCaseNumber, j.JhroCaseID,
                    (CASE WHEN s.OriginalFileData IS NULL THEN CAST(0 AS BIT) ELSE CAST(1 AS BIT) END) AS HasOcrText
                FROM PRF_Source s LEFT JOIN PRF_JhroCase j ON s.JhroCaseID = j.JhroCaseID
                WHERE s.Archive = 0
                AND s.Hash = :hash
            ";

            return(Session.CreateSQLQuery(sql)
                   .SetParameter("hash", HexUtil.GetHexToBytes(hash), NHibernateUtil.Binary)
                   .SetResultTransformer(Transformers.AliasToBean(typeof(SourceDTO)))
                   .List <SourceDTO>());
        }