示例#1
0
        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);
        }
示例#4
0
        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)));
        }
示例#5
0
        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();
        }
示例#6
0
        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);
        }
示例#7
0
        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));
        }
示例#8
0
 private void onSelecionChange(object sender, SelectionChangedEventArgs e)
 {
     pagina = (sender as ListBox).SelectedItem as Cota;
 }
 public async Task AdicionarCotas(Cota cota)
 {
     await _cotaRepository.Inserir(cota);
 }