private void cmdSalvar_Click(object sender, System.EventArgs e) { //int cod = int.Parse(txtCodigo.Text); float preco = float.Parse(txtPreco.Text); int tempoMax = int.Parse(cmbTempo.SelectedItem.ToString()); TabelaPreco novo = new TabelaPreco(1,tempoMax,preco); try { chamarDAO.Inserir(novo); MessageBox.Show("Preço inserido"); } catch (Exception er) { MessageBox.Show(er.Message); } }
private void cmdAlterar_Click(object sender, EventArgs e) { TabelaPreco novo = new TabelaPreco(); int tempo = Convert.ToInt32(cmbTempo.SelectedItem); float valor = float.Parse(txtPreco.Text); novo = new TabelaPreco(1, tempo, valor); try { chamarDAO.Atualizar(novo); MessageBox.Show("Preço atualizado"); } catch(Exception ex) { MessageBox.Show(ex.Message); } }