private void btnExcluir_Click(object sender, EventArgs e) { ClasseApolice apolice = new ClasseApolice(); apolice.IdApolice = Convert.ToInt32(txtIdApolice.Text); string msg = apolice.Excluir(); MessageBox.Show(msg); Limpar(); }
private void btnAlterar_Click(object sender, EventArgs e) { ClasseApolice apolice = new ClasseApolice(); apolice.IdApolice = Convert.ToInt32(txtIdApolice.Text); apolice.IdPessoa = Convert.ToInt32(txtIdPessoa.Text); apolice.IdVeiculo = Convert.ToInt32(txtIdVeiculo.Text); apolice.NumeroApolice = txtNumApolice.Text; apolice.DataInicio = Convert.ToDateTime(txtDataInicio.Text); apolice.DataFim = Convert.ToDateTime(txtDataFim.Text); apolice.Valor = Convert.ToDouble(txtValor.Text); apolice.Franquia = Convert.ToDouble(txtFranquia.Text); apolice.DataContrato = Convert.ToDateTime(txtDataContrato.Text); string msg = apolice.Alterar(); MessageBox.Show(msg); Limpar(); }
private void btnConsultar_Click(object sender, EventArgs e) { ClasseApolice apolice = new ClasseApolice(); if (txtIdApolice.Text == "") { DataTable tbldados = apolice.Consultar(); dgvConsulta.DataSource = tbldados; } else { DataTable tbldados = apolice.Consultar(); txtDataContrato.Text = tbldados.Rows[0]["DataContrato"].ToString(); txtDataFim.Text = tbldados.Rows[0]["DataFim"].ToString(); txtDataInicio.Text = tbldados.Rows[0]["DataInicio"].ToString(); txtFranquia.Text = tbldados.Rows[0]["Franquia"].ToString(); txtIdApolice.Text = tbldados.Rows[0]["IdApolice"].ToString(); txtIdPessoa.Text = tbldados.Rows[0]["IdPessoa"].ToString(); txtIdVeiculo.Text = tbldados.Rows[0]["IdVeiculo"].ToString(); txtNumApolice.Text = tbldados.Rows[0]["Numeroapolice"].ToString(); txtValor.Text = tbldados.Rows[0]["valor"].ToString(); } }