public async Task GetROMTest()
        {
            Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
            DatabaseServices database = new DatabaseServices("ConsoleDB.db");


            DateTime date = new DateTime(2017, 12, 13);

            List <RunOfMine> ROMList = await database.GetRunOfMine(date);

            RunOfMine ROM = new RunOfMine("2017-12-12", 1, "03N_46_J16", null, null, "03S_46_F25", null, null, "03S_46_J19"
                                          , "13_36_J17", null, null);

            RunOfMine ROM1 = new RunOfMine("2017-12-12", 2, "12_34_F54", "13_36_J17", "15N_25_G253", "03S_46_F25", null, null, "16S_23_G53"
                                           , "16N_22_F253", "16N_22_F253", null);

            RunOfMine ROM2 = new RunOfMine("2017-12-12", 2, "03S_46_J19", "13_34_F23", null, "03S_46_F25", "05N_46_F25",
                                           "13_36_J17", "16S_23_G53"
                                           , "16N_22_F253", "12_34_F25", "13_36_J17");

            Assert.True(ROMList.Contains(ROM));
            Assert.True(ROMList.Contains(ROM1));
            Assert.True(ROMList.Contains(ROM2));
            Assert.True(ROMList.Count == 3);
        }
示例#2
0
        public IActionResult Index()
        {
            //var tempOrgUnit = _db.OrgUnit.ToList();
            var person             = _db.Person_Identifier.FirstOrDefault(x => x.Value.Equals(iupi /*Session.IUPI.ToString()*/));
            var personId           = 0;
            var associatedOrgUnits = new List <Person_OrgUnit>();

            if (person != null)
            {
                personId = person.PersonID;
                var tempOrgUnits = _db.Person_OrgUnit.ToList();
                foreach (var a in tempOrgUnits)
                {
                    if (a.PersonID == personId)
                    {
                        associatedOrgUnits.Add(a);
                    }
                }
            }
            var listOrgUnit   = new List <UnidadeInvestigacao>();
            var listAddresses = DatabaseServices.getAddresses(_db);

            foreach (var temp in associatedOrgUnits)
            {
                listOrgUnit.Add(DatabaseServices.retrieveInfoUI(_db, temp.OrgUnitId));
            }
            ViewBag.OrgUnits = listOrgUnit.ToList();
            ViewBag.Adresses = listAddresses;
            return(View());
        }
示例#3
0
        public void init()
        {
            _salesQueryable = _salesList.AsQueryable();

            _salesMock = new Mock <DbSet <Sale> >();
            _salesMock.As <IQueryable <Sale> >().Setup(m => m.Provider).Returns(_salesQueryable.Provider);
            _salesMock.As <IQueryable <Sale> >().Setup(m => m.Expression).Returns(_salesQueryable.Expression);
            _salesMock.As <IQueryable <Sale> >().Setup(m => m.ElementType).Returns(_salesQueryable.ElementType);
            _salesMock.As <IQueryable <Sale> >().Setup(m => m.GetEnumerator()).Returns(_salesQueryable.GetEnumerator());

            _employees = new List <Employee>()
            {
                _employee
            }.AsQueryable();
            _employeesMock = new Mock <DbSet <Employee> >();
            _employeesMock.As <IQueryable <Employee> >().Setup(m => m.Provider).Returns(_employees.Provider);
            _employeesMock.As <IQueryable <Employee> >().Setup(m => m.Expression).Returns(_employees.Expression);
            _employeesMock.As <IQueryable <Employee> >().Setup(m => m.ElementType).Returns(_employees.ElementType);
            _employeesMock.As <IQueryable <Employee> >().Setup(m => m.GetEnumerator()).Returns(_employees.GetEnumerator());


            _contextMock = new Mock <Entities>();
            _contextMock.Setup(m => m.Sales).Returns(_salesMock.Object);
            _contextMock.Setup(m => m.Employees).Returns(_employeesMock.Object);
            _services = new DatabaseServices(_contextMock.Object);
        }
        public async Task <ActionResult <InfoPortal> > Iupi(string iupi)
        {
            var dataset = _context.Set <Person_Identifier>()
                          .Where(x => x.Value.Equals(iupi))
                          .Select(x => new Person_Identifier
            {
                PersonID     = x.PersonID,
                Value        = x.Value,
                IdentifierId = x.IdentifierId
            }).ToList();

            var person_id = 0;

            foreach (Person_Identifier person in dataset)
            {
                person_id = person.PersonID;
            }

            var person_Publication = await _context.Person_Publication.Where(i => i.PersonId == person_id).ToListAsync();

            if (person_Publication == null)
            {
                return(NotFound());
            }
            InfoPortal info = new InfoPortal();

            info = DatabaseServices.getInfoPortalUA(_context, person_Publication);


            return(info);
        }
        [HttpGet("GetDocumentos")] // GET api/Documento/GetDocumentos
        public ActionResult GetDocumentos([FromQuery(Name = "PageNumber")] int PageNumber,
                                          [FromQuery(Name = "Rows")] int Rows)
        {
            DocumentoServices    documentoServices = new DocumentoServices();
            List <InfoDocumento> documentos        = documentoServices.returnDocumentos(PageNumber, Rows);
            int total = 0;

            string query = "SELECT COUNT(*) AS 'TOTAL' FROM [adpruebas_de_timbrado].[dbo].[admDocumentos];";

            string connString = DatabaseServices.GetConnString();

            using (SqlConnection sqlConnection = new SqlConnection(connString))
            {
                SqlCommand cmd = new SqlCommand(query, sqlConnection);
                sqlConnection.Open();
                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        total = reader.GetInt32(0);
                    }
                }
            }

            ListOfDocuments listOfDocuments = new ListOfDocuments(documentos, PageNumber, total);
            string          jsonString;

            jsonString = JsonSerializer.Serialize(listOfDocuments);

            return(Ok(jsonString));
        }
示例#6
0
        public async Task <IEnumerable <UnidadeInvestigacao> > Post(IFormFile file)
        {
            // full path to file in temp location
            var content = new StringBuilder();

            content.AppendLine("tipo: " + Path.GetExtension(file.FileName));

            List <UnidadeInvestigacao> lista = new List <UnidadeInvestigacao>();

            using (var reader = new StreamReader(file.OpenReadStream()))
                using (var csv = new CsvReader(reader,
                                               System.Globalization.CultureInfo.CreateSpecificCulture("PT")))
                {
                    var records = csv.GetRecords <UnidadeInvestigacao>();
                    //Encoding iso = Encoding.GetEncoding("ISO-8859-6");
                    lista = records.ToList();
                    //return lista;
                }

            foreach (UnidadeInvestigacao ui in lista)
            {
                var morada = _context.PAddress.FirstOrDefault(x => x.PAddressId == ui.PAddressId);
                DatabaseServices.insertOrgUnit(_context, ui.Acronym, ui.URI, ui.ClassStartDate, ui.ClassEndDate, ui.Fraction, ui.Value, ui.OrgUnitId2, morada.Line1, morada.PostCode, ui.ActLanguageId, ui.Text, ui.Keywords, ui.Name);
            }

            return(lista);
        }
示例#7
0
 public AccountController(IConfiguration configuration, RedisRepository redisRepository)
 {
     _securityServices = new SecurityServices(configuration);
     _databaseServices = new DatabaseServices(configuration);
     _dataServices     = new DataServices();
     _redisRepository  = redisRepository;
 }
示例#8
0
 public IActionResult UI_Details(String obj)
 {
     ViewBag.Address = DatabaseServices.getAddresses(_db).Find(x => x.PAddressId == @Newtonsoft.Json.JsonConvert.DeserializeObject <UnidadeInvestigacao>(obj).PAddressId);
     ViewBag.Pessoas = DatabaseServices.getPeople(_db);
     ViewBag.dados   = @Newtonsoft.Json.JsonConvert.DeserializeObject(obj);
     return(View());
 }
示例#9
0
        public IActionResult PublicationMetaData2(string works, string submit_next, string submit_cancel, string submit_prev, string submit_jump_2_1,
                                                  string dc_subject_1 /*palavra chave*/, string dc_description_abstract_1 /*resumo*/, string dc_relation_authority,   /*prof financiado*/
                                                  string dc_description_sponsorship /*patrocinadores*/, string dc_rights /*acesso*/, string dc_date_embargo_day,
                                                  string dc_date_embargo_month, string dc_date_embargo_year, string dc_rights_uri /*licensa*/, string pubID)
        {
            Hashtable dados = publicationMeta2ToHash(dc_subject_1 /*palavra chave*/, dc_description_abstract_1 /*resumo*/, dc_relation_authority, /*prof financiado*/
                                                     dc_description_sponsorship /*patrocinadores*/, dc_rights /*acesso*/, dc_date_embargo_day, dc_date_embargo_month,
                                                     dc_date_embargo_year, dc_rights_uri /*licensa*/, pubID);

            DatabaseServices.updateAsTable2(_db, dados);
            Hashtable work   = @Newtonsoft.Json.JsonConvert.DeserializeObject <Hashtable>(works);
            Hashtable info   = DatabaseServices.retrieveAllInfo(_db, work["titulo"].ToString(), Session.IUPI.ToString());
            string    works2 = JsonConvert.SerializeObject(info);

            if (submit_jump_2_1 == "Describe" || submit_prev == "Previous")
            {
                return(RedirectToAction("PublicationMetaData1", "Home", new { works = works2 }));
            }
            if (submit_next == "Next")
            {
                return(RedirectToAction("PublicationMetaData3", "Home", new { works = works2 }));
            }
            if (submit_cancel == "Cancel/Save")
            {
                return(RedirectToAction("PublicacoesSalvas", "Home"));
            }

            return(RedirectToAction("PublicationMetaData2", "Home", new { works = works2 }));
        }
 private ActiveRecordSession(IDbProvider dbProvider)
 {
     DbProvider           = dbProvider;
     DatabaseServices     = new DatabaseServices(DbProvider);
     ActiveRecordMapCache = new Dictionary <Type, ActiveRecordMap>();
     ActiveRecordCache    = new Dictionary <Type, Dictionary <object, object> >();
 }
示例#11
0
    public IHttpActionResult CreateDBF(IncomingDbfModel postParam)
    {
        DatabaseServices dbServices = new DatabaseServices();
        bool             success    = dbServices.InsertDataIntoDBF(postParam);

        return(Ok(success));
    }
        public async Task GetBlendsTest()
        {
            Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
            DatabaseServices database = new DatabaseServices("ConsoleDB.db");


            DateTime date = new DateTime(2017, 12, 13);



            Console.WriteLine(Directory.GetCurrentDirectory());


            List <Blend> listOfBlends = await database.GetBlends(date);

            Blend blend1 = new Blend("2017-12-13", 1, "03N_46_J16", "03S_46_F25", "05N_46_F25", "03S_46_J19",
                                     "13_36_J17", "13_34_F23", "13_38_J16", null, null, null);

            Blend blend2 = new Blend("2017-12-13", 2, "12_34_F54", "12_34_F54", "05N_46_F25", "03S_46_F25",
                                     "13_36_J17", "03S_46_F25", "13_38_J16", null, null, null);

            Blend blend3 = new Blend("2017-12-13", 3, "05N_46_F25", "13_36_J17", "05N_46_F25", "03S_46_F25",
                                     "13_36_J17", "03S_46_F25", "13_36_J17", "03S_46_J19", "03S_46_J19", null);

            Blend blend4 = new Blend("2017-12-13", 4, "05N_46_F25", "13_36_J17", "05N_46_F25", "03S_46_F25",
                                     "13_36_J17", "03S_46_F25", "13_36_J17", "03S_46_J19", "03S_46_J19", null);



            Assert.True(listOfBlends.Count == 3);
            Assert.True(listOfBlends.Contains(blend1));
            Assert.True(listOfBlends.Contains(blend2));
            Assert.True(listOfBlends.Contains(blend3));
            Assert.False(listOfBlends.Contains(blend4));
        }
示例#13
0
        public static bool LoadFromDatabase()
        {
            bool returnValue = false;

            try
            {
                //Initialize DatabaseServices
                DatabaseServices = new DatabaseServices();

                LatestCurrencyExchangeRatesList = new List <CurrencyExchangeRates>();
                LatestCurrencyExchangeRatesList = DatabaseServices.GetLatestCurrencyExchangeRatesFromDatabase();

                HistoricCurrencyExchangeRatesList = new List <CurrencyExchangeRates>();
                HistoricCurrencyExchangeRatesList = DatabaseServices.GetHistoricCurrencyExchangeRatesFromDatabase();

                //Success
                returnValue = true;
            }
            catch (Exception ex)
            {
                //Error
                returnValue = false;
                throw ex;
            }

            return(returnValue);
        }
示例#14
0
        public void init()
        {
            deliveries    = _deliveries.Select(x => new Delivery(x)).AsQueryable();
            _deliveryMock = new Mock <DbSet <Delivery> >();
            _deliveryMock.As <IQueryable <Delivery> >().Setup(m => m.Provider).Returns(deliveries.Provider);
            _deliveryMock.As <IQueryable <Delivery> >().Setup(m => m.Expression).Returns(deliveries.Expression);
            _deliveryMock.As <IQueryable <Delivery> >().Setup(m => m.ElementType).Returns(deliveries.ElementType);
            _deliveryMock.As <IQueryable <Delivery> >().Setup(m => m.GetEnumerator()).Returns(deliveries.GetEnumerator());

            changes      = _changes.AsQueryable();
            _changesMock = new Mock <DbSet <DeliveriesChanges> >();
            _changesMock.As <IQueryable <DeliveriesChanges> >().Setup(m => m.Provider).Returns(changes.Provider);
            _changesMock.As <IQueryable <DeliveriesChanges> >().Setup(m => m.Expression).Returns(changes.Expression);
            _changesMock.As <IQueryable <DeliveriesChanges> >().Setup(m => m.ElementType).Returns(changes.ElementType);
            _changesMock.As <IQueryable <DeliveriesChanges> >().Setup(m => m.GetEnumerator()).Returns(changes.GetEnumerator());

            _employees = new List <Employee>()
            {
                _employee
            }.AsQueryable();
            _employeesMock = new Mock <DbSet <Employee> >();
            _employeesMock.As <IQueryable <Employee> >().Setup(m => m.Provider).Returns(_employees.Provider);
            _employeesMock.As <IQueryable <Employee> >().Setup(m => m.Expression).Returns(_employees.Expression);
            _employeesMock.As <IQueryable <Employee> >().Setup(m => m.ElementType).Returns(_employees.ElementType);
            _employeesMock.As <IQueryable <Employee> >().Setup(m => m.GetEnumerator()).Returns(_employees.GetEnumerator());



            _contextMock = new Mock <Entities>();
            _contextMock.Setup(m => m.Deliveries).Returns(_deliveryMock.Object);
            _contextMock.Setup(m => m.DeliveriesChanges).Returns(_changesMock.Object);
            _contextMock.Setup(m => m.Employees).Returns(_employeesMock.Object);
            _services = new DatabaseServices(_contextMock.Object);
        }
示例#15
0
        public async Task <ActionResult <IEnumerable <Publicacao> > > Iupi(string iupi)
        {
            var dataset = _context.Set <Person_Identifier>()
                          .Where(x => x.Value.Equals(iupi))
                          .Select(x => new Person_Identifier
            {
                PersonID     = x.PersonID,
                Value        = x.Value,
                IdentifierId = x.IdentifierId
            }).ToList();

            var person_id = 0;

            foreach (Person_Identifier person in dataset)
            {
                person_id = person.PersonID;
            }

            var person_Publication = await _context.Person_Publication.Where(i => i.PersonId == person_id).ToListAsync();

            if (person_Publication == null)
            {
                return(NotFound());
            }
            List <Publicacao> pubs = new List <Publicacao>();

            foreach (var p in person_Publication)
            {
                pubs.Add(DatabaseServices.retrieveInfoPublicacao(_context, p.PublicationId));
            }

            return(pubs);
        }
示例#16
0
        public static void Run()
        {
            User usr = services.getUser();

            while (true)
            {
                Console.WriteLine("What do you want to do?");
                string           command          = Console.ReadLine();
                DatabaseServices databaseServices = new DatabaseServices();
                switch (command)
                {
                case "showCars":

                    databaseServices.GetCars();

                    break;

                case "showUsers":

                    if (usr.usergroup != 2)
                    {
                        Console.WriteLine("you don't have permission to run this command!");
                        break;
                    }

                    databaseServices.GetUsers();

                    break;
                }
            }
        }
示例#17
0
        public IActionResult Perfil(String OrcidID)
        {
            DatabaseServices.insertLoginPerson(_db, nome, OrcidID, iupi);//);Session.IUPI.ToString());

            //MVC_2020_Business.Services.DatabaseServices.setOrcid(_db, Session.IUPI.ToString(), OrcidID); //meter o OrcidID na BD
            //ViewBag.OrcidID = "0000-0002-3488-6570";
            ViewBag.OrcidID = MVC_2020_Business.Services.DatabaseServices.getOrcid(_db, iupi);//Session.IUPI.ToString());
            return(View());
        }
示例#18
0
        public static void CreateRepositoriesTest(NpgsqlConnection conn)
        {
            var serviceCollection = new ServiceCollection();

            DatabaseServices.AddServicePostgre(serviceCollection, conn);

            _vendaCervejaRepository = serviceCollection.BuildServiceProvider()
                                      .GetService <IVendaCervejaRepository>();
        }
示例#19
0
        public IActionResult Add_Researchers_To_UI(string ui, string adicionar_bt, string cancelar_bt, int org_id, int person_id, DateTime data_ini, DateTime data_fim)
        {
            if (adicionar_bt == "add")
            {
                DatabaseServices.AssociatePersonOrgUnit(_db, org_id, data_ini, data_fim, person_id);
            }

            return(RedirectToAction("UI_Details", "Home", new { obj = ui }));
        }
示例#20
0
        public NetworkServices(ServerMW windowForm)
        {
            this.serverMW = windowForm;
            startListening();
            STCB = new ServerToClientBridge(this);
            DS = new DatabaseServices(this);

            DS.executeQuery();
        }
示例#21
0
        public MainWindow()
        {
            InitializeComponent();
            Services = Factory.GetServices();

            LoginControl.InitMainWindow(this);
            LoginControl.LoginSuccessful += OnLogin;
            LoginControl.Visibility       = Visibility.Visible;
        }
        public void limpar_dados_de_teste_da_tabela_de_venda()
        {
            using var conn = DatabaseServices.OpenConnection();

            using var command = new NpgsqlCommand("DELETE FROM vendas_cerveja", conn);
            command.ExecuteNonQuery();

            conn.Close();
        }
示例#23
0
        public IActionResult PublicationMetaData1(string works, string submit_next, string submit_cancel, string dc_contributor_author, string dc_title,
                                                  string dc_title_alternative, string degois_publication_title /*revista*/, string dc_date_issued_day,
                                                  string dc_date_issued_month, string dc_date_issued_year, string degois_publication_volume, string degois_publication_issue,
                                                  string degois_publication_firstPage, string degois_publication_lastPage, string dc_publisher, string dc_identifier_issn,
                                                  string dc_identifier_essn, string dc_identifier_doi, string dc_peerreviewed, string dc_relation_publisherversion,
                                                  string dc_type, string dc_description_version, string dc_language_iso, IFormCollection fc, string submit_dc_contributor_author_add,
                                                  string pubID)
        {
            Hashtable work = @Newtonsoft.Json.JsonConvert.DeserializeObject <Hashtable>(works);

            if (submit_dc_contributor_author_add == "Add More" && dc_contributor_author != null)
            {
                JArray aut = (JArray)work["Autores"];
                aut.Add(dc_contributor_author);
                work.Remove("Autores");
                work.Add("Autores", aut);
                string works2 = JsonConvert.SerializeObject(work);
                return(RedirectToAction("PublicationMetaData1", "Home", new { works = works2 }));
            }
            Hashtable dados = publicationMeta1ToHash(fc["dc_contributor_author_1"].ToList(), dc_title, dc_title_alternative, degois_publication_title /*revista*/, dc_date_issued_day,
                                                     dc_date_issued_month, dc_date_issued_year, degois_publication_volume, degois_publication_issue,
                                                     degois_publication_firstPage, degois_publication_lastPage, dc_publisher, dc_identifier_issn,
                                                     dc_identifier_essn, dc_identifier_doi, dc_peerreviewed, dc_relation_publisherversion,
                                                     dc_type, dc_description_version, dc_language_iso, pubID);

            DatabaseServices.updateAsTable1(_db, dados);
            //var teste = fc["dc_contributor_author_1"].ToList();
            //Console.WriteLine("TESTE: ");
            //teste.ForEach(x => Console.WriteLine("\t"+x));


            if (submit_next == "Next")
            {
                //Console.WriteLine("Titulo: " + dc_title);
                //Console.WriteLine("Autores: " + dc_contributor_author);

                work.Remove("Autores");
                work.Add("Autores", fc["dc_contributor_author_1"].ToList());
                //string works2 = JsonConvert.SerializeObject(work);
                MVC_2020_Business.Services.DatabaseServices.updateState(_db, Int32.Parse(pubID), 3);
                Hashtable info = DatabaseServices.retrieveAllInfo(_db, work["titulo"].ToString(), Session.IUPI.ToString());
                info["Autores"] = work["Autores"];
                string works2 = JsonConvert.SerializeObject(info);
                return(RedirectToAction("PublicationMetaData2", "Home", new { works = works2 }));
            }
            if (submit_cancel == "Cancel/Save")
            {
                Hashtable info   = DatabaseServices.retrieveAllInfo(_db, work["titulo"].ToString(), Session.IUPI.ToString());
                string    works2 = JsonConvert.SerializeObject(info);
                MVC_2020_Business.Services.DatabaseServices.updateState(_db, Int32.Parse(pubID), 3);
                return(RedirectToAction("PublicacoesSalvas", "Home"));
            }


            return(RedirectToAction("PublicationMetaData1", "Home", new { works = works }));
        }
示例#24
0
        public void DeleteUI_Helper(string org)

        {
            //chamar funcao delete da ui
            var id = Int32.Parse(@Newtonsoft.Json.JsonConvert.DeserializeObject(org).ToString());

            DatabaseServices.deleteOrgUnit(_db, id);
            Console.WriteLine(org);
            //return RedirectToAction("Admin", "Home");
        }
示例#25
0
        private const string iupi2 = "83b90544-a39d-4073-81cb-0ad094c1ec71"; // rosalino

        //public static IEnumerable<Product> GetProducts()
        //{
        //    var client = new RestClient("https://ria.ua.pt/");
        //    var request = new RestRequest("rest/items/find-by-metadata-field", Method.POST);
        //    request.AddJsonBody(new Person("ua.dados.iupi", "66c74f1f-8c45-4f43-9a85-be4975eecc09", "pt_PT")); //50ca9826-f8c9-46aa-a9b7-10d03dc63f39
        //    var queryResult = client.Execute(request);
        //    if (!queryResult.IsSuccessful || queryResult.Content == null) { return new List<Product>(); }
        //    return JsonConvert.DeserializeObject<List<Product>>(queryResult.Content);
        //}

        public static List <Product> GetProducts(MyDbContext _db, string IUPI, string nome)
        {
            //Save<jobs>(new jobs() { job_desc = "Renato2 Artigo", min_lvl = 12, max_lvl = 22 });

            /*var per = _db.Person
             *  //.Where(b => b.GenderId > 2)
             *  //.OrderBy(b => b.GenderId)
             *  .ToList();*/
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("https://ria.ua.pt/RESTRia-1.0/publications/");
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", "Y3Jpczo4ZjNqRXhnUXdoUmNmc2x5NkZyLg==");

            var queryResult = client.GetAsync(IUPI).Result;//"7f8b8645-515e-48bf-bf58-613ab7a6244d" dg

            if (!queryResult.IsSuccessStatusCode || queryResult.Content == null)
            {
                return(new List <Product>());
            }

            //DatabaseServices.deleteOrgUnit(_db, "Teste criacao na edicao");
            var listaPubs  = allResearchersPubsAuthenticus("R-000-8N5");
            var listaAUsar = new List <publication>();

            foreach (var p in listaPubs)
            {
                listaAUsar.Add(getPubDataAuthenticus(p.id).Result);
            }

            var desPub = JsonConvert.DeserializeObject <List <Product> >(queryResult.Content.ReadAsStringAsync().Result);

            DatabaseServices.insertPublicationsRIA(_db, desPub, nome);// ------ INSERIR PUBLICAÇÕES DO RIA NA BD



            //var dois = _db.Publication_Identifier.Select(x => x.Value).ToList();
            //var pubs = new List<Publication>();
            //var pubsId = new List<Publication_Identifier>();
            //var contador = 2;
            //foreach (var pub in desPub)
            //{
            //    if ( !dois.Contains(pub.Doi) && !String.IsNullOrWhiteSpace(pub.Doi))
            //    {
            //        pubs.Add(new Publication() { LanguageId = 1, Date = DateTime.Now, Source = "RIA", Synced = true }); //parametros mal dados
            //        //pubsId.Add(new Publication_Identifier() { PublicationId=pubs.First().PublicationId, IdentifierId=1, StartDate= DateTime.Now, EndDate= DateTime.Now, Value=pub.Doi });

            //    }
            //}
            //_db.Set<Publication>().AddRange(pubs);
            ////_db.Set<Publication_Identifier>().AddRange(pubsId);
            //_db.SaveChanges();
            return(desPub);
        }
示例#26
0
        public async Task <ActionResult <UnidadeInvestigacao> > GetOrgUnit(int id)
        {
            var orgUnit = DatabaseServices.retrieveInfoUI(_context, id);

            if (orgUnit == null)
            {
                return(NotFound());
            }

            return(orgUnit);
        }
        private void bWDatabaseUpdate_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            //We must create a databaseService here, otherwise we can't invoking the event
            DatabaseServices databaseServices = DatabaseServices;

            databaseServices.UpdateDatabaseEvent += new DatabaseServices.ExecuteUpgradeSqlDatabaseFile(FrmDatabaseSettings_UpdateDatabaseEvent);

            var sqlDatabaseSettings = (SqlDatabaseSettings)e.Argument;

            e.Result = databaseServices.UpdateDatabase(TechnicalSettings.SoftwareVersion, sqlDatabaseSettings.Name, UserSettings.GetUpdatePath);
        }
        private bool DbExists(string dbName)
        {
            string dbDefaultPath    = DatabaseServices.GetDatabaseDefaultPath();
            string attachmentDbName = dbName + "_attachments";

            return
                (FileExists(dbDefaultPath, dbName + ".mdf") ||
                 FileExists(dbDefaultPath, dbName + "_log.ldf") ||
                 FileExists(dbDefaultPath, attachmentDbName + ".mdf") ||
                 FileExists(dbDefaultPath, attachmentDbName + "_log.ldf"));
        }
示例#29
0
 public void EqualsFalse()
 {
     Assert.IsFalse(_employee.Equals(new Employee()
     {
         Id       = 2,
         Login    = "******",
         Name     = "Carl Colossus",
         Password = DatabaseServices.GetMd5Hash("CArlOs01"),
         Role     = 1
     }));
 }
示例#30
0
        public async Task <IEnumerable <Autor> > Post(IFormFile file)
        {
            // full path to file in temp location
            var content = new StringBuilder();

            content.AppendLine("tipo: " + Path.GetExtension(file.FileName));

            List <Autor> lista = new List <Autor>();

            using (var reader = new StreamReader(file.OpenReadStream()))
                using (var csv = new CsvReader(reader,
                                               System.Globalization.CultureInfo.CreateSpecificCulture("PT")))
                {
                    var records = csv.GetRecords <Autor>();
                    //Encoding iso = Encoding.GetEncoding("ISO-8859-6");
                    lista = records.ToList();
                    //return lista;
                }

            foreach (Autor autor in lista)
            {
                if (autor.Name == null || !Regex.IsMatch(autor.Iupi, "[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}") || !Regex.IsMatch(autor.OrcidId, "[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{4}"))
                {
                    return(null);//BadRequest();
                }

                if (autor.Name != "" || autor.OrcidId != "" || autor.Iupi != "")
                {
                    DatabaseServices.insertLoginPerson(_context, autor.Name, autor.OrcidId, autor.Iupi);
                    PublicacoesService.GetDifWorks(_context, autor.Name,
                                                   PublicacoesService.ConvertProductToWork(
                                                       PublicacoesService.GetProducts(_context, autor.Iupi, autor.Name)), autor.Iupi, MVC_2020_Business.Services.DatabaseServices.getOrcid(_context, autor.Iupi));
                }
            }

            //string text;
            //using (TextReader textReader = new StreamReader(file.OpenReadStream()))
            //    text = textReader.ReadToEnd();

            return(lista);

            //CsvReader csv;
            //using (var ms = new MemoryStream())
            //{
            //    file.CopyTo(ms);
            //    var fileBytes = ms.ToArray();
            //    string s = Convert.ToBase64String(fileBytes);
            //    // act on the Base64 data
            //    using (var textReader2 = new StreamReader(s))
            //        csv = new CsvReader(textReader2, System.Globalization.CultureInfo.CreateSpecificCulture("PT"));
            //    var records = csv.GetRecords<Autor>().ToList();
            //    return records;
            //}
        }
示例#31
0
        public Home_Setting()
        {
            InitializeComponent();

            if (DatabaseServices.IsPassword(null))
            {
                PART_Psw_Old.IsEnabled = false;
            }
            General_ComboBox_Location.SelectedIndex     = (int)UserSettings.AppDataLocation;
            General_ComboBox_Location.SelectionChanged += General_ComboBox_Location_SelectionChanged;
        }