Beispiel #1
0
        internal static IDMObjects.IFnFolderDual getRootFolder(IDMObjects.Library oLibrary)
        {
            //string pathName = ConfigurationManager.AppSettings["FNET_pathRootFolder"];
            string folderKey = checkFolderCompliance(oLibrary);

            //return(IDMObjects.IFnFolderDual) oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeFolder,"/"+folderCompliance[3]+"/"+folderCompliance[1],"",null,null);
            //devi passare la co_key corretta di anno/mese
            return((IDMObjects.IFnFolderDual)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeFolder, folderKey, "", null, null));
        }
Beispiel #2
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);
            }
        }
Beispiel #3
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);
        }
Beispiel #4
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);
            }
        }
Beispiel #5
0
        internal void unlock(DocsPaVO.documento.FileRequest fileReq, string idamministrazione)
        {
            int numVersione = getNumVers(fileReq.versionId);

            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, fileReq.docNumber, oLibrary, null, null);
            bool canCheckin = docFNET.GetState(IDMObjects.idmDocState.idmDocCanCheckin);

            if (canCheckin)
            {
                docFNET.Version.CancelCheckout(IDMObjects.idmCancelCheckout.idmCancelCheckoutNoKeep);
            }
        }
Beispiel #6
0
        private static string checkMonthFolder(IDMObjects.Library oLibrary, string yearFolderKey)
        {
            string infoFolder = "";

            DocsPaDB.DBProvider dbProvider = new DocsPaDB.DBProvider();
            try
            {
                DocsPaUtils.Query query = DocsPaUtils.InitQuery.getInstance().getQuery("S_FN_GET_MONTH_FOLDER_CUSTOM");
                query.setParam("yearFolderKey", yearFolderKey);
                string commandText = query.getSQL();
                System.Diagnostics.Debug.WriteLine("SQL - checkMonthFolderFN - QUERY : " + commandText);
                DataSet ds = new DataSet();
                dbProvider.ExecuteQuery(ds, commandText);
                if (ds.Tables[0].Rows.Count != 0)
                {
                    //co_key anno
                    infoFolder = ds.Tables[0].Rows[0][0].ToString();
                }
                else
                {
                    //la devo creare
                    string month = DateTime.Now.Month.ToString();
                    //padre
                    IDMObjects.IFnFolderDual folderParent;
                    //figlio
                    IDMObjects.IFnFolderDual folder;
                    //prelevo il folder del padre
                    folderParent = (IDMObjects.IFnFolderDual)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeFolder, yearFolderKey, "", null, null);
                    // creo il subfolder partendo dal padre
                    folder = folderParent.CreateSubFolder(month, System.Reflection.Missing.Value);
                    folder.SaveNew(IDMObjects.idmSaveNewOptions.idmDocSaveNewNoKeep);
                    infoFolder = folder.ID.ToString();
                }
                return(infoFolder);
            }

            catch (Exception ex)
            {
                logger.Debug("Errore Verifica esistenza Folder Mese:", ex);
                return(infoFolder);
            }
            finally
            {
                dbProvider.Dispose();
            }
        }
Beispiel #7
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);
     }
 }
Beispiel #8
0
 internal static IDMObjects.ClassDescription getClassFolder(IDMObjects.Library oLibrary)
 {
     return((IDMObjects.ClassDescription)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeClassDesc, "", IDMObjects.idmObjectType.idmObjTypeFolder, "", ""));
 }
Beispiel #9
0
 internal static IDMObjects.ClassDescription getClassDocument(IDMObjects.Library oLibrary)
 {
     return((IDMObjects.ClassDescription)oLibrary.GetObject(IDMObjects.idmObjectType.idmObjTypeClassDesc, "General", IDMObjects.idmObjectType.idmObjTypeDocument, null, null));
 }