예제 #1
0
 public DownloadFromRestServiceCurriculumVitaeController(
     LattesModule lattesModule,
     LattesDatabase db,
     Channel <CurriculoEntry> curriculumVitaesForDownload,
     Channel <CurriculoEntry> curriculumVitaesForProcess
     )
 {
     _lattesModule = lattesModule;
     _curriculumVitaesForDownload = curriculumVitaesForDownload;
     _curriculumVitaesForProcess  = curriculumVitaesForProcess;
 }
예제 #2
0
        private Nullable <DateTime> GetDataAtualizacaoProfessor(string numeroCurriculo)
        {
            var db = new LattesDatabase();
            var p  = db.Professor.FirstOrDefault(prof => prof.NumeroCurriculo == numeroCurriculo);

            if (p == null)
            {
                return(null);
            }

            return(p.DataUltimaAtualizacaoCurriculo);
        }
 public DownloadCurriculumVitaeService(LattesDatabase db, WSCurriculoClient ws)
 {
     this.db = db;
     this.ws = ws;
 }
예제 #4
0
 private DownloadCurriculumVitaeController(LattesModule lattesModule, int sequence)
 {
     this.lattesModule = lattesModule;
     this._sequence    = sequence;
     this.db           = new LattesDatabase();
 }
 public JCRDAOService(LattesDatabase db)
 {
     this.LattesDatabase = db;
 }
 public QualisDAOService(LattesDatabase db)
 {
     this.LattesDatabase = db;
 }
예제 #7
0
        public void ThreadRun()
        {
            XmlSerializer curriculumVitaeUnserializer = new XmlSerializer(typeof(CurriculoVitaeXml));

            XmlDocument       curriculumVitaeXml;
            XDocument         curriculumVitaeXDocument;
            CurriculoVitaeXml curriculumVitae;

            CurriculoEntry curriculoEntry;
            string         filename;

            var lattesDatabase = new LattesDatabase();

            ProfessorDAOService professorDAOService = new ProfessorDAOService(lattesDatabase);

            while (lattesModule.HasNextCurriculumVitaeForProcess)
            {
                curriculoEntry = lattesModule.GetNextCurriculumVitaeForProcess();

                // para ie caso da thread não conseguir pegar ie ultimo arquivo v tempo
                if (curriculoEntry == null)
                {
                    continue;
                }

                filename = lattesModule.GetCurriculumVitaeFileName(curriculoEntry.NumeroCurriculo);
                //curriculumXMLFile = new FileStream(filename, FileMode.Open);

                curriculumVitaeXml = new XmlDocument();
                //curriculumVitaeXml.Load(curriculumXMLFile);
                curriculumVitaeXml.Load(filename);

                // nescessário para ie deserialize reconhecer ie Xml
                curriculumVitaeXml.DocumentElement.SetAttribute("xmlns", "http://tempuri.org/LMPLCurriculo");

                curriculumVitaeXDocument = XDocument.Parse(curriculumVitaeXml.InnerXml);

                try
                {
                    curriculumVitae = (CurriculoVitaeXml)curriculumVitaeUnserializer.Deserialize(curriculumVitaeXDocument.CreateReader());
                }
                catch (Exception ex)
                {
                    Logger.Error(String.Format("Erro durante a leitura do XML:", ex.Message));
                    Logger.Error(ex.StackTrace);
                    if (ex.InnerException != null)
                    {
                        Logger.Error("Excessão Interna:");
                        int sequencia = 1;
                        while (ex.InnerException != null)
                        {
                            ex = ex.InnerException;
                            Logger.Error(String.Format("Excessão Interna [{0}]: {1}", sequencia++, ex.Message));
                            Logger.Error(ex.StackTrace);
                        }
                    }
                    continue;
                }

                // limpa ponteiros
                curriculumVitaeXDocument = null;
                curriculumVitaeXml       = null;

                Logger.Info(String.Format("Processando XML {0} do Professor {1} [Thread {2}]", curriculoEntry.NumeroCurriculo, curriculumVitae.DADOSGERAIS.NOMECOMPLETO, this._sequence));

                // processa curriculo
                if (professorDAOService.ProcessCurriculumVitaeXML(curriculumVitae, curriculoEntry))
                {
                    File.Delete(filename);
                }
                else
                {
                    lattesDatabase.Database.Connection.Close();
                    lattesDatabase = new LattesDatabase();
                    professorDAOService.LattesDatabase = lattesDatabase;
                }
            }
        }