Beispiel #1
0
        /// <summary>
        /// Envia documento versionado para o content
        /// </summary>
        /// <param name="file">Arquivo a ser enviado</param>
        private void SendRevisionDocument(string file)
        {
            var vsdoc       = new VsDoc();
            var documentKey = Path.GetFileNameWithoutExtension(file).ToInt();

            ImportDatabase.Using(session =>
            {
                var sql = "select doc_code DocCode, vsdoc_revisao VsDocRevisao from vsdoc where vsdoc_code = " +
                          documentKey;

                vsdoc = session.CreateSQLQuery(sql)
                        .SetResultTransformer(CustomResultTransformer <VsDoc> .Do())
                        .UniqueResult <VsDoc>();
            });

            var ecm6DocVersionado = this.GetEcm6VersionedDocument(documentKey);

            if (ecm6DocVersionado == null)
            {
                Log.App.ErrorFormat("Documento ecm6  #{0} não foi importado", vsdoc.DocCode);
                return;
            }

            this.ImportEcm6VersionedDocumentFile(ecm6DocVersionado, file, vsdoc);
        }
Beispiel #2
0
        public virtual Dictionary <int, TEntity> Execute(string message)
        {
            Log.App.InfoFormat(message);

            IList <TEntity> entities = new List <TEntity>();

            Log.App.DebugFormat("Obtendo registros no ecm 6");

            ImportDatabase.Using(session =>
            {
                entities = this.GetEntities(session).ToList();
            });

            Log.App.DebugFormat("Encontrado {0} registros", entities.Count);
            Log.App.DebugFormat("Importando registros no Salus...");

            foreach (var entity in entities)
            {
                this.ImportEntity(entity);
            }

            return(this.itemsForReference);
        }
Beispiel #3
0
        private Dictionary <int, TEntity> InternalExecute(int startRow = 1, int endRow = ItemsPerPage)
        {
            var entities = new List <TEntity>();

            var currentStartRow = 0;
            var currentEndRow   = 0;

            try
            {
                do
                {
                    currentStartRow = startRow;
                    currentEndRow   = endRow;

                    ImportDatabase.Using(session =>
                    {
                        Log.App.InfoFormat("Obtendo do ecm6 de {0} a {1}", startRow, endRow);
                        entities = this.GetEntities(session, startRow, endRow);
                    });

                    startRow = endRow + 1;
                    endRow  += ItemsPerPage;

                    foreach (var entity in entities)
                    {
                        this.ImportEntity(entity);
                    }
                }while (entities.Count > 0);
            }
            catch (GenericADOException exception)
            {
                Thread.Sleep(TimeSpan.FromMinutes(2).Milliseconds);
                this.InternalExecute(currentStartRow, currentEndRow);
            }

            return(this.itemsAlreadyImported);
        }
Beispiel #4
0
        private Ftp2 BuildFtpClient()
        {
            Ftp2 ftp = null;

            ImportDatabase.Using(session =>
            {
                const string Sql = @"
select 
	system_serverip Host,
	system_port Port,
	SYSTEM_SERVERUSR FtpUser,
	SYSTEM_SERVERPWD Password,
	SYSTEM_FTPROOT RootPath
from system";

                var ftpSettings = session.CreateSQLQuery(Sql)
                                  .SetResultTransformer(CustomResultTransformer <FtpSettings> .Do())
                                  .UniqueResult <FtpSettings>();

                ////ftp = new Ftp2(
                ////    ftpSettings.Host,
                ////    ftpSettings.Port,
                ////    ftpSettings.FtpUser,
                ////    ftpSettings.Password,
                ////    ftpSettings.RootPath);

                ftp = new Ftp2(
                    "192.168.10.105",
                    21,
                    "anonymous",
                    "anonymous",
                    "/");
            });

            return(ftp);
        }