public static void Create(Cota pFavoritos) { DataBase db = GetDataBase(); db.Cotacoes.InsertOnSubmit(pFavoritos); db.SubmitChanges(); }
public async Task Atualizar(Cota cota) { if (!ExecutarValidacao(new CotaValidation(), cota)) { return; } await _cotaRepository.Atualizar(cota); }
public async Task Adicionar(Cota cota) { if (!ExecutarValidacao(new CotaValidation(), cota)) { return; } await _cotaRepository.Inserir(cota); }
public IActionResult AcertarCotas(string id) { Cota cotas = _context.Cota.Include(c => c.NumSocioNavigation).SingleOrDefault(c => c.NumSocio == id); cotas.AcertarCotas(); _context.Update(cotas); _context.SaveChanges(); return(RedirectToAction(nameof(GerirCotas))); }
public static void Delete(Cota pFavoritos) { DataBase db = GetDataBase(); var query = from c in db.Cotacoes where c.id == pFavoritos.id select c; db.Cotacoes.DeleteOnSubmit(query.ToList()[0]); db.SubmitChanges(); }
private Cota ParseJson(string pJson) { if (pJson != null) { //faz o parse para um tipo jobject JObject jobject = JObject.Parse(pJson); CotaDoJson = new Cota { indice = (double)jobject["indice"], data_consulta = (string)jobject["atual"] }; } return(CotaDoJson); }
void rssClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { double aux = 0; double resultado = 0; try { Cota cot = ParseJson(e.Result); } catch { MessageBox.Show("Sem Conexao com internet."); return; } // double valorDouble = Convert.ToDouble(CotaDoJson.indice); double valorDouble = CotaDoJson.indice; //try //{ if (TxtDolar.Text == "") { TxtDolar.Text = "1"; } aux = Convert.ToDouble(TxtDolar.Text); resultado = valorDouble * aux; TxtResultado.Text = "R$ " + Convert.ToString(resultado); TxtAtual.Text = "Ultima Atualização " + CotaDoJson.data_consulta; TxtIndice.Text = " US$ 1,00 = R$ " + valorDouble; //} //catch //{ // MessageBox.Show("Informe um valor"); // Navigate("/MainPage.xaml"); //} //NavigationService.Navigate(new Uri("/Result.xaml", UriKind.Relative)); }
private void onSelecionChange(object sender, SelectionChangedEventArgs e) { pagina = (sender as ListBox).SelectedItem as Cota; }
public async Task AdicionarCotas(Cota cota) { await _cotaRepository.Inserir(cota); }