Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="testo"></param>
        /// <param name="idReg"></param>
        /// <param name="numPage"></param>
        /// <param name="numTotPage"></param>
        /// <param name="nRec"></param>
        /// <returns></returns>
        public ArrayList FullTextSearch(string testo, string idReg, int numPage, out int numTotPage, out int nRec)
        {
            numTotPage = 0;
            nRec       = 0;
            string    dst      = this.InfoUtente.dst;
            ArrayList listaDoc = null;

            try
            {
                listaDoc = FilenetLib.DocumentManagement.RicercaFT(testo, idReg, this.InfoUtente, numPage, dst, out numTotPage, out nRec);
                if (listaDoc == null)
                {
                    listaDoc = new ArrayList(1);
                }
                return(listaDoc);
            }
            catch (Exception ex)
            {
                IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager();
                logger.Debug(ex.Message);
                string msg = ex.Message;
                for (int i = 0; i < idmErrorManager.Errors.Count; i++)
                {
                    msg += " " + idmErrorManager.Errors[i].Description;
                }
                logger.Debug(msg);
                logger.Debug("Errore durante la ricerca Full Text - Filenet.", ex);
                throw ex;
            }
        }
Esempio n. 2
0
        internal static IDMObjects.IFnDocumentDual getDocument(string id, string idamministrazione, string dst)
        {
            IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager();
            DocsPaDocumentale_FILENET.Documentale.UserManager userManager = new DocsPaDocumentale_FILENET.Documentale.UserManager();
            IDMObjects.Library oLibrary = userManager.getFileNETLib(idamministrazione);
            oLibrary.LogonId = dst;

            IDMObjects.IFnDocumentDual docFNET = (IDMObjects.IFnDocumentDual)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeDocument, id, oLibrary, null, null);
            return(docFNET);
        }
Esempio n. 3
0
        internal static string createVersionFNET(string nomeFile, ref DocsPaVO.documento.FileRequest fileRequest, string idamministrazione, string dst)
        {
            IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager();
            try
            {
                string path = ConfigurationManager.AppSettings["FNET_pathServer"];

                DocsPaDocumentale_FILENET.Documentale.UserManager userManager = new DocsPaDocumentale_FILENET.Documentale.UserManager();
                IDMObjects.Library oLibrary = userManager.getFileNETLib(idamministrazione);

                oLibrary.LogonId = dst;
                IDMObjects.IFnFolderDual   folder  = DocumentManagement.getRootFolder(oLibrary);
                IDMObjects.IFnDocumentDual docFNET = (IDMObjects.IFnDocumentDual)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeDocument, fileRequest.docNumber, oLibrary, null, null);
                bool canCheckout = docFNET.GetState(IDMObjects.idmDocState.idmDocCanCheckout);

                if (canCheckout)
                {
                    docFNET.Version.CheckoutNoCopy();
                }
                else
                {
                    throw new Exception("Il file è utilizzato da un altro processo");
                }

                bool canCheckin = docFNET.GetState(IDMObjects.idmDocState.idmDocCanCheckin);

                docFNET.Version.Checkin(path, nomeFile, IDMObjects.idmCheckin.idmCheckinKeep);

                IDMObjects.Version vers = docFNET.Version;
                bool canIndex           = docFNET.GetState(IDMObjects.idmDocState.idmDocCanIndex);
                if (canIndex)
                {
                    vers.IndexContent(IDMObjects.idmIndex.idmIndexContent);
                }



                string numVers = getFNETnumVers(docFNET.Version.Number);
                //OLD: fileRequest.versionId =  numVers +	getFNETename(fileRequest.docNumber);
                fileRequest.fNversionId = numVers + getFNETename(fileRequest.docNumber);
                return(numVers);
            }
            catch (Exception e)
            {
                string msg = e.Message;
                for (int i = 0; i < idmErrorManager.Errors.Count; i++)
                {
                    msg += " " + idmErrorManager.Errors[i].Description;
                }
                throw new Exception(msg);
            }
        }
Esempio n. 4
0
        internal void remove(DocsPaVO.documento.FileRequest fileReq, string idamministrazione, string versFNET, string dst)
        {
            // int numVersione = getNumVers(fileReq.versionId);
            int numVersione = getNumVers(versFNET);


            string strNumVersione = getFNETnumVers(numVersione.ToString());

            IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager();
            DocsPaDocumentale_FILENET.Documentale.UserManager userManager = new DocsPaDocumentale_FILENET.Documentale.UserManager();
            IDMObjects.Library oLibrary = userManager.getFileNETLib(idamministrazione);
            oLibrary.LogonId = dst;
            IDMObjects.IFnDocumentDual docFNET = (IDMObjects.IFnDocumentDual)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeDocument, fileReq.docNumber, oLibrary, null, null);
            IDMObjects.IFnDocumentDual verFNET = (IDMObjects.IFnDocumentDual)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeDocument, fileReq.docNumber + ":" + strNumVersione, oLibrary, null, null);
            try
            {
                //TODO: 04/06/2007  (A.B.)
                //attualmente viene de-indicizzato il file acquisito sulla versione e/o allegato
                // non viene ne eliminata la versione Filenet ne eliminato il file vero è proprio
                //in quanto se rimosso viene messo off line la versione e nascono problemi
                //per eventuali versioni successive.
                docFNET.Version.IndexContent(IDMObjects.idmIndex.idmIndexContentDeindex);

                #region testing filenet
                //docFNET.Version.Series.Remove(numVersione);
                //docFNET.Version.Archive(IDMObjects.idmArchive.idmArchiveDispose);
                //string ArchivioFile = DocsPaDocumentale_FILENET.FilenetLib.DocumentManagement.checkFolderCompliance(oLibrary);
                //verFNET.Version.ArchiveEx(String.Empty);
                //removeVers(fileReq.versionId);
                //removeVers(versFNET);
                //docFNET.Version.Archive(IDMObjects.idmArchive.idmArchiveDispose);
                #endregion
            }
            catch (Exception e)
            {
                string msg = e.Message;
                for (int i = 0; i < idmErrorManager.Errors.Count; i++)
                {
                    msg += " " + idmErrorManager.Errors[i].Description;
                }
                throw new Exception(msg);
            }
        }
Esempio n. 5
0
 public void logoutToFilenet(string dst)
 {
     IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager();
     try
     {
         IDMObjects.Library oLibrary = getLibrary(dst);
         oLibrary.Logoff();
     }
     catch (Exception e)
     {
         string msg = e.Message;
         logger.Debug("msg errore in logout = " + msg);
         for (int i = 1; i < idmErrorManager.Errors.Count; i++)
         {
             msg += " " + idmErrorManager.Errors[i].Description;
         }
         throw new Exception(msg);
     }
 }
Esempio n. 6
0
        public bool AddUserFilenet(string userID, string userPwd,
                                   string idAmministrazione, string userFullName, string userDefaultGroup)
        {
            string      dst         = "";
            UserManager userManager = null;

            IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager();

            try
            {
                userManager = new UserManager();
                IDMObjects.Library             oLibrary     = userManager.getFileNETLib(idAmministrazione);
                string                         ArchivioFile = DocsPaDocumentale_FILENET.FilenetLib.DocumentManagement.checkFolderCompliance(oLibrary);
                DocsPaDB.Query_DocsPAWS.Utenti userFilenet  = new DocsPaDB.Query_DocsPAWS.Utenti();
                if (!userFilenet.AddUserFilenet(userID, userDefaultGroup, ArchivioFile, userFullName))
                {
                    throw new Exception("Errore durante l'inserimento utente Filenet: " + userID);
                }
                bool result = oLibrary.Logon(userID, "", "Administrators", IDMObjects.idmLibraryLogon.idmLogonOptNoUI);

                oLibrary.ChangePassword("", userPwd, IDMObjects.idmPasswordOptions.idmPasswordNoUI, userID);
                dst = oLibrary.LogonId.ToString();
                return(true);
            }
            catch (Exception e)
            {
                string msg = e.Message;
                logger.Debug("msg errore in AddUserFilenet = " + msg);
                for (int i = 1; i < idmErrorManager.Errors.Count; i++)
                {
                    msg += " " + idmErrorManager.Errors[i].Description;
                }
                throw new Exception(msg);
            }
            finally
            {
                if (dst.Length > 0)
                {
                    userManager.logoutToFilenet(dst);
                }
            }
        }
Esempio n. 7
0
        public string LoginToFileNet(DocsPaVO.utente.UserLogin userLogin, string gruppoFilenet)
        {
            logger.Debug("init login");

            string password = userLogin.Password;

            if (userLogin.Dominio != null && userLogin.Dominio.Length > 0)
            {
                DocsPaDB.Query_DocsPAWS.Utenti utenti = new DocsPaDB.Query_DocsPAWS.Utenti();
                password = utenti.GetPasswordUserFilenet(userLogin.SystemID, true);
            }

            string dst = "";

            IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager();

            try
            {
                IDMObjects.Library oLibrary;
                oLibrary = getFileNETLib(userLogin);
                logger.Debug("Library name=" + oLibrary.Name);
                if (oLibrary.Logon(userLogin.UserName, password, gruppoFilenet,
                                   IDMObjects.idmLibraryLogon.idmLogonOptNoUI
                                   //IDMObjects.idmLibraryLogon.idmLogonOptUseNetworkNoUI
                                   ))
                {
                    dst = oLibrary.LogonId.ToString();
                }
            }
            catch (Exception e)
            {
                string msg = e.Message;
                logger.Debug("msg errore in fileNetLogon = " + msg);
                for (int i = 1; i < idmErrorManager.Errors.Count; i++)
                {
                    msg += " " + idmErrorManager.Errors[i].Description;
                }
                throw new Exception(msg);
            }

            return(dst);
        }
Esempio n. 8
0
 public static bool RemoveDocument(string docnumber, string idamministrazione)
 {
     try
     {
         IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager();
         DocsPaDocumentale_FILENET.Documentale.UserManager userManager = new DocsPaDocumentale_FILENET.Documentale.UserManager();
         IDMObjects.Library         oLibrary = userManager.getFileNETLib(idamministrazione);
         IDMObjects.IFnDocumentDual docFNET  = (IDMObjects.IFnDocumentDual)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeDocument, docnumber, oLibrary, null, null);
         if (docFNET != null)
         {
             docFNET.Delete();
         }
         return(true);
     }
     catch (Exception exception)
     {
         logger.Debug("Errore durante la rimozione del documento.", exception);
         return(false);
     }
 }
Esempio n. 9
0
        public bool ChangeUserFilenetPassword(string username, string oldpwd, string newPwd, string idAmministrazione)
        {
            bool   changed = false;
            string dst     = string.Empty;

            IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager();

            try
            {
                IDMObjects.Library oLibrary = this.getFileNETLib(idAmministrazione);

                DocsPaDB.Query_DocsPAWS.Utenti userFilenet = new DocsPaDB.Query_DocsPAWS.Utenti();

                bool result = oLibrary.Logon(username, oldpwd, "Administrators", IDMObjects.idmLibraryLogon.idmLogonOptNoUI);
                oLibrary.ChangePassword(oldpwd, newPwd, IDMObjects.idmPasswordOptions.idmPasswordNoUI, username);
                dst = oLibrary.LogonId.ToString();

                changed = true;
            }
            catch (Exception e)
            {
                string msg = e.Message;
                logger.Debug("msg errore in UpdateUserFilenet = " + msg);

                for (int i = 1; i < idmErrorManager.Errors.Count; i++)
                {
                    msg += " " + idmErrorManager.Errors[i].Description;
                }

                throw new Exception(msg);
            }
            finally
            {
                if (!string.IsNullOrEmpty(dst))
                {
                    this.logoutToFilenet(dst);
                }
            }

            return(changed);
        }
Esempio n. 10
0
        public bool UpdateUserFilenet(string username, string oldpwd, string newPwd, string userfullname, string idamministrazione)
        {
            string      dst         = "";
            UserManager userManager = null;

            IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager();

            try
            {
                userManager = new UserManager();
                IDMObjects.Library             oLibrary    = userManager.getFileNETLib(idamministrazione);
                DocsPaDB.Query_DocsPAWS.Utenti userFilenet = new DocsPaDB.Query_DocsPAWS.Utenti();
                if (!userFilenet.UpdateUserFilenet(username, userfullname))
                {
                    throw new Exception("Errore durante la modifica dell'utente Filenet: " + username);
                }
                bool result = oLibrary.Logon(username, oldpwd, "Administrators", IDMObjects.idmLibraryLogon.idmLogonOptNoUI);
                oLibrary.ChangePassword(oldpwd, newPwd, IDMObjects.idmPasswordOptions.idmPasswordNoUI, username);
                dst = oLibrary.LogonId.ToString();
                return(true);
            }
            catch (Exception e)
            {
                string msg = e.Message;
                logger.Debug("msg errore in UpdateUserFilenet = " + msg);
                for (int i = 1; i < idmErrorManager.Errors.Count; i++)
                {
                    msg += " " + idmErrorManager.Errors[i].Description;
                }
                throw new Exception(msg);
            }
            finally
            {
                if (dst.Length > 0)
                {
                    userManager.logoutToFilenet(dst);
                }
            }
        }
Esempio n. 11
0
        internal static DocsPaVO.documento.SchedaDocumento addFirstVersione(DocsPaVO.documento.SchedaDocumento schedaDocumento, IDMObjects.IFnDocumentDual IDMdoc)
        {
            DocsPaVO.documento.Documento versione = null;
            logger.Debug("sono in add first versione");
            if (schedaDocumento.documenti == null)
            {
                schedaDocumento.documenti = new ArrayList();
            }

            if (schedaDocumento.documenti.Count == 0)
            {
                versione = new DocsPaVO.documento.Documento();
            }
            else
            {
                versione = (DocsPaVO.documento.Documento)schedaDocumento.documenti[0];
            }

            versione.docNumber = schedaDocumento.docNumber;

            // gestione dei firmatari
            setFirmatari(versione);

            versione.fileSize = "0";
            if (versione.daInviare != null && versione.daInviare.Length > 0)
            {
                versione.daInviare = "1";
            }

            //string nomeFile = ConfigurationManager.AppSettings["FNET_pathServer"] + ConfigurationManager.AppSettings["FNET_nomeFileTemp"];


            logger.Debug("prima di SaveNew ");
            // logger.Debug("chiamata saveNew con file in path: " + nomeFile);

            //file tmp dinamico costruito on line su percorso standard
            string nomeFile = ConfigurationManager.AppSettings["FNET_pathServer"] + schedaDocumento.idPeople + "_void.tmp";

            try
            {
                // verifico preesistenza
                if (System.IO.File.Exists(nomeFile))
                {
                    System.IO.File.Delete(nomeFile);
                }

                using (System.IO.StreamWriter writer = new System.IO.StreamWriter(nomeFile))
                {
                    writer.WriteLine("  ");
                    writer.Flush();
                    writer.Close();
                }

                IDMdoc.SaveNew(nomeFile,
                               IDMObjects.idmSaveNewOptions.idmDocSaveNewKeep | IDMObjects.idmSaveNewOptions.idmDocSaveNewIndexContent);


                logger.Debug("chiamata saveNew con file in path: " + nomeFile + " esisto OK");
                bool canCheckout = IDMdoc.GetState(IDMObjects.idmDocState.idmDocCanCheckout);
                logger.Debug("dopo di GetState canCheckout su doc di saveNew id:" + IDMdoc.ID);
                bool canCheckin = IDMdoc.GetState(IDMObjects.idmDocState.idmDocCanCheckin);
                logger.Debug("dopo di GetState canCheckin su doc di saveNew id:" + IDMdoc.ID);
                versione.versionId = getFNETnumVers("1") + schedaDocumento.docNumber;
                logger.Debug("dopo di versionID creata: " + versione.versionId);
                if (schedaDocumento.documenti.Count == 0)
                {
                    schedaDocumento.documenti.Add(versione);
                }
                else
                {
                    schedaDocumento.documenti[0] = versione;
                }

                updateVers(versione);

                return(schedaDocumento);
            }
            catch (Exception ex)
            {
                IDMError.ErrorManager idmErrorManager = new IDMError.ErrorManager();
                logger.Debug(ex.Message);
                string msg = ex.Message;
                for (int i = 0; i < idmErrorManager.Errors.Count; i++)
                {
                    msg += " " + idmErrorManager.Errors[i].Description;
                }
                logger.Debug(msg);
                return(null);
            }
            finally
            {
                // verifico preesistenza
                if (System.IO.File.Exists(nomeFile))
                {
                    System.IO.File.Delete(nomeFile);
                }
            }
        }