private string getRuta(string referencia)
        {
            string ruta = "SIN RUTA EN LF";

            try
            {
                LFSearch busqueda = this.db.CreateSearch();
                string   queryLF  = "{LF:ParentName=\"" + referencia + "\"}";
                busqueda.Command = queryLF;
                busqueda.BeginSearch(true);
                ILFCollection archivos = busqueda.GetSearchHits();
                if (archivos.Count > 0)
                {
                    LFSearchHit hit    = (LFSearchHit)archivos[1];
                    ILFEntry    entry  = (ILFEntry)hit.Entry;
                    LFFolder    folder = entry.ParentFolder;
                    ruta = folder.FullPath + @"\";
                }
                busqueda.Dispose();
                return(ruta);
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(ruta);
            }
        }
Exemple #2
0
        private static void ExtraerDocumentos(List <DocumentoRepositorio> resultado, string referencia, LFFolder documentoLaserfiches)
        {
            //LFDocument documentoLaserfiche = searchHitLF.Entry as LFDocument;
            //LFDirectoryEntry documentoLaserfiches = searchHitLF.Entry as LFDirectoryEntry;
            //ILFEntry documentoLaserfichevs = searchHitLF.Entry as ILFEntry;
            //documentoLaserfichevs.EntryType == Entry_Type.ENTRY_TYPE_DOCUMENT;


            ILFCollection coleccionLaserfiche = documentoLaserfiches.GetChildren();

            foreach (ILFEntry entrada in coleccionLaserfiche)
            {
                if (entrada.EntryType == Entry_Type.ENTRY_TYPE_DOCUMENT)
                {
                    LFDocument documentoLaserfiche  = entrada as LFDocument;
                    var        documentoRepositorio = new DocumentoRepositorio();
                    documentoRepositorio.Referencia        = referencia;
                    documentoRepositorio.DocumentoAsociado = entrada;
                    documentoRepositorio.IdDocumento       = documentoLaserfiche.ID.ToString();
                    documentoRepositorio.Nombre            = documentoLaserfiche.Name;
                    documentoRepositorio.Ruta = documentoLaserfiche.FullPath;

                    if (documentoLaserfiche.ElectFile != null)
                    {
                        documentoRepositorio.TipoMime = documentoLaserfiche.ElectFile.MimeType;
                    }

                    if (documentoLaserfiche.Template != null)
                    {
                        documentoRepositorio.Plantilla = documentoLaserfiche.Template.Name;
                    }

                    resultado.Add(documentoRepositorio);
                }
                else if (entrada.EntryType == Entry_Type.ENTRY_TYPE_FOLDER)
                {
                    ExtraerDocumentos(resultado, referencia, entrada as LFFolder);
                }
            }
        }