Пример #1
0
        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);
            }
        }
Пример #2
0
        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);
            }
        }