private void BtnArquivo_Importar_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "JSON files (*.json) | *.json"; if (openFileDialog.ShowDialog() == true) { Arquivo relatorio = new Arquivo(); CookieDAO dao = new CookieDAO(); foreach (CookieClass cafe in relatorio.lerJson(openFileDialog.FileName)) { dao.inserirCookie(cafe); } } }
private void Button_Click(object sender, RoutedEventArgs e) { CookieClass cookie = new CookieClass() { Sabor = txtSabor.Text, Valor = Convert.ToDecimal(txtValor.Text) }; CookieDAO dao = new CookieDAO(); dao.inserirCookie(cookie); MessageBox.Show("cookie cadastrado com sucesso!!"); txtSabor.Clear(); txtValor.Clear(); }