Esempio n. 1
0
 private async void button1_Click(object sender, EventArgs e)
 {
     var mr = new MakeRequest();
     var indicators = mr.getAllIndicators();
     List<Indicators> ind = await indicators;
     using (var _db = new GLOBALEDGE_MVCEntities())
     {
         foreach (var i in ind)
         {
             Match m = Regex.Match(i.name.Trim(), @"(.*)\((.*)\)+$");
             string name = "", unit = "";
             if (m.Groups.Count > 1)
             {
                 name = m.Groups[1].Value;
                 unit = m.Groups[2].Value;
             }
             else
             {
                 name = i.name;
             }
             var unitID = _db.DIBS_Insert_Unit(unit).First().UnitID;
             _db.SaveChanges();
             _db.DIBS_Field_Insert(i.id, i.name.Trim(), i.sourceNote.Trim(), unitID, 117, 38, true, false);
             _db.SaveChanges();
             textBox1.Invoke(new UpdateTextBox(UpdateText), i.name.Trim());
         }
     }
     mr.Dispose();
 }
Esempio n. 2
0
 private async Task getCountries()
 {
     var mr = new MakeRequest();
     var countries = mr.getAllCountries();
     List<Countries> country = await countries;
     using (var _db = new GLOBALEDGE_MVCEntities())
     {
         foreach (var i in country)
         {
             textBox1.Invoke(new UpdateTextBox(UpdateText), i.name + " ...");
             var c = _db.Countries.FirstOrDefault(a => a.Abbr == i.iso2code || a.NameCIA == i.name);
             if (c == null)
             {
                 continue;
             }
             c.iso2code = i.iso2code;
             _db.SaveChanges();
             textBox1.Invoke(new UpdateTextBox(UpdateText), i.name + " Updated");
         }
     }
 }
Esempio n. 3
0
 void updateField(string indicator)
 {
     using (var _db = new GLOBALEDGE_MVCEntities())
     {
         var i = _db.DIBS_Fields.FirstOrDefault(a => a.FieldID == indicator);
         i.DateDataUpdated = DateTime.Now;
         _db.SaveChanges();
     }
 }