コード例 #1
0
        private void barbtnSalvar_Click(object sender, EventArgs e)
        {
            if (VerificaDadosObrigatorios())
            {
                int id = veiculo.ID;
                veiculo = new ClasseVeiculo {
                    ID       = id,
                    MarcaID  = Convert.ToInt32(txtMarca.Text),
                    ModeloID = Convert.ToInt32(txtModelo.Text)
                };

                if (id == 0)
                {
                    db.InsereVeiculoBase(veiculo);
                }
                else
                {
                    db.AlteraVeiculoBase(veiculo);
                }


                HabilitaBotoesMenu(true);
                HabilitaCamposDados(false);
                LimpaCamposDados();
                AtualizaDadosGrid();
            }
            else
            {
                MessageBox.Show("Dados Obrigatórios não informados ", "Urgente!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        private void grdDadosCid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int id = Convert.ToInt32(grdDadosVec.CurrentRow.Cells[0].Value);

            veiculo = db.SelectVeiculoDBase(new ClasseVeiculo {
                ID = id
            });

            txtMarca.Text  = veiculo.MarcaID.ToString();
            txtModelo.Text = veiculo.ModeloID.ToString();
        }
コード例 #3
0
 private void LimpaCamposDados()
 {
     txtMarca.Text  = "";
     txtModelo.Text = "";
     veiculo        = new ClasseVeiculo();
 }