private void btLocalizar_Click(object sender, EventArgs e) { frmConsultaCompra f = new frmConsultaCompra(); f.ShowDialog(); f.Dispose(); if (f.codigo != 0) { DALConexao cx = new DALConexao(DadosConexao.StringDeConexao); BLLCompra bll = new BLLCompra(cx); ModeloCompra modelo = bll.CarregaModeloCompra(f.codigo); txtCodigo.Text = modelo.ComCod.ToString(); txtDataCompra.Text = modelo.ComData; txtNota.Text = modelo.ComNfiscal.ToString(); txtValorTotal.Text = modelo.ComTotal.ToString(); txtNParcelas.Text = modelo.ComParcelas.ToString(); txtStatus.Text = modelo.ComStatus.ToString(); txtFornecedor.Text = modelo.ForCod.ToString(); txtTipoPagamento.Text = modelo.TpaCod.ToString(); alteraBotoes(3); } else { this.LimpaTela(); this.alteraBotoes(1); } f.Dispose(); }
private void btSalvar_Click(object sender, EventArgs e) { try { ModeloSubCategoria modelo = new ModeloSubCategoria(); modelo.SCatNome = txtSnome.Text; modelo.CatCod = Convert.ToInt32(cbCatCod.SelectedValue); DALConexao cx = new DALConexao(DadosDaConexao.srtConexao); BLLSubCategoria bll = new BLLSubCategoria(cx); if (operacao == "inserir") { //cadastrar categoria bll.Incluir(modelo); Ferramentas.MessageBoxHelper.PrepToCenterMessageBoxOnForm(this); MessageBox.Show("Cadastro efetuado - Código " + modelo.SCatCod.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { // alterar categoria modelo.SCatCod= Convert.ToInt32(txtSCatCod.Text); bll.Alterar(modelo); Ferramentas.MessageBoxHelper.PrepToCenterMessageBoxOnForm(this); MessageBox.Show("Cadastro Alterado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } this.LimpaTela(); this.AlteraBotoes(1); } catch (Exception erro) { Ferramentas.MessageBoxHelper.PrepToCenterMessageBoxOnForm(this); MessageBox.Show(erro.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnExcluir_Click(object sender, EventArgs e) { try { DialogResult mensagem = MessageBox.Show("Desaja excluir o registro?", "Aviso", MessageBoxButtons.YesNo); if (mensagem.ToString().Equals("Yes")) { DALConexao con = new DALConexao(DadosConexao.StringConexao); BLLSubCategoria sc = new BLLSubCategoria(con); sc.Excluir(Convert.ToInt32(txtCodigoSubCategoria.Text)); this.LimparCampos(); this.AlteraBotoes(1); } } catch { MessageBox.Show("Erro ao excluir registro"); this.AlteraBotoes(3); } }
private void btnSalvar_Click(object sender, EventArgs e) { try { //Leitura dos Dados ModeloUnidadeDeMedida modelo = new ModeloUnidadeDeMedida(); modelo.UmedNome = txtUnidadeMedida.Text; //Obj para gravar os dados no Banco DALConexao cx = new DALConexao(DadosDaConexao.StringDeConexao); BLLUnidadeDeMedida bll = new BLLUnidadeDeMedida(cx); if (this.operacao == "inserir") { //Cadastrar uma Categoria bll.incluir(modelo); MessageBox.Show("Cadastro efetuado: Código " + modelo.UmedCod.ToString()); } else { //Alterar uma Categoria modelo.UmedCod = Convert.ToInt32(txtCod.Text); bll.Alterar(modelo); MessageBox.Show("Cadastro Alterado!"); } this.LimpaTela(); this.alterarBotoes(1); } catch (Exception erro) { MessageBox.Show(erro.Message); } }
private void btPesquisar_Click(object sender, EventArgs e) { DALConexao cx = new DALConexao(DadosDaConexao.srtConexao); BLLSubCategoria bll = new BLLSubCategoria(cx); dgvDados.DataSource = bll.Localizar(txtValor.Text); }
// Botão Salvar private void btSalvar_Click(object sender, EventArgs e) { try { // Leitura dos dados nos campos ModeloCategoria modelo = new ModeloCategoria(); modelo.CatNome = txtNome.Text; // Objeto para conexão e gravação no banco DALConexao cx = new DALConexao(DadosDaConexao.StringDeConexao); BLLCategoria bll = new BLLCategoria(cx); if (this.operacao == "Inserir") { // Cadastrar uma categoria bll.Incluir(modelo); MessageBox.Show("Cadastro efetuado: Código " + modelo.CatCod.ToString()); } else { // Alterar uma categoria modelo.CatCod = Convert.ToInt32(txtCodigo.Text); bll.Alterar(modelo); MessageBox.Show("Cadastro alterado"); } this.LimpaTela(); this.alteraBotoes(1); } catch (Exception erro) { MessageBox.Show(erro.Message); } }
private void frmMovimentacaoCompra_Load(object sender, EventArgs e) { Ferramentas.CloseButtonDisabler.FormCloseButtonDisabler.DisableCloseButton(this.Handle.ToInt32()); this.AlteraBotoes(1); // txtNome.Focus(); DALConexao cx = new DALConexao(DadosDaConexao.srtConexao); BLLFornecedor bllforn = new BLLFornecedor(cx); cbFornecedor.DataSource = bllforn.Localizar(""); cbFornecedor.DisplayMember = "for_nome"; cbFornecedor.ValueMember = "for_cod"; cbFornecedor.AutoCompleteMode = AutoCompleteMode.Suggest; cbFornecedor.AutoCompleteSource = AutoCompleteSource.ListItems; BLLProduto bllprod = new BLLProduto(cx); cbProduto.DataSource = bllprod.Localizar(""); cbProduto.DisplayMember = "pro_nome"; cbProduto.ValueMember = "pro_cod"; cbProduto.AutoCompleteMode = AutoCompleteMode.Suggest; cbProduto.AutoCompleteSource = AutoCompleteSource.ListItems; cbProduto_Leave(sender, e); BLLTipoDePagamento blltp = new BLLTipoDePagamento(cx); cbTipoPagamento.DataSource = blltp.Localizar(""); cbTipoPagamento.DisplayMember = "tpa_nome"; cbTipoPagamento.ValueMember = "tpa_cod"; cbTipoPagamento.AutoCompleteMode = AutoCompleteMode.Suggest; cbTipoPagamento.AutoCompleteSource = AutoCompleteSource.ListItems; }
private void frmCadastroProduto_Load(object sender, EventArgs e) { this.alterarBotoes(1); //ComboBox da Categoria DALConexao cx = new DALConexao(DadosDaConexao.StringDeConexao); BLLCategoria bll = new BLLCategoria(cx); cbCategoria.DataSource = bll.Localizar(""); cbCategoria.DisplayMember = "cat_nome"; cbCategoria.ValueMember = "cat_cod"; try { //ComboBox da Subcategoria BLLSubCategoria sbll = new BLLSubCategoria(cx); cbSubCategoria.DataSource = sbll.LocalizarPorCategoria((int)cbCategoria.SelectedValue); cbSubCategoria.DisplayMember = "scat_nome"; cbSubCategoria.ValueMember = "scat_cod"; } catch { MessageBox.Show("Cadastre uma Categoria"); } //ComboBox da Unidade de Medidas BLLUnidadeDeMedida ubll = new BLLUnidadeDeMedida(cx); cbUnd.DataSource = ubll.Localizar(""); cbUnd.DisplayMember = "umed_nome"; cbUnd.ValueMember = "umed_cod"; }
private void btnPesquizar_Click(object sender, EventArgs e) { DALConexao cx = new DALConexao(DadosConexao.StringDeConexao); BBL.BLLContasPagar bll = new BBL.BLLContasPagar(cx); dgvDados.DataSource = bll.Localizar(txtValor.Text); }
public void frmListaCategoria_Load(object sender, EventArgs e) { DALConexao cx = new DALConexao(DadosConexao.StringDeConexao); BLLCategoria bll = new BLLCategoria(cx); cboCategoria.DataSource = bll.Localizar("");//trás todos os dados cboCategoria.DisplayMember = "cat_nome";// valor que aparece cboCategoria.ValueMember = "cat_cod";//valor que vai ser passado }
private void frmCadastroSubCategoria_Load(object sender, EventArgs e) { this.alteraBotoes(1); DALConexao cx = new DALConexao(DadosDaConexao.StringDeConexao); BLLCategoria bll = new BLLCategoria(cx); cbCatCod.DataSource = bll.Localizar(""); // Carrega no ComboBox os valores da Categoria cbCatCod.DisplayMember = "cat_nome"; cbCatCod.ValueMember = "cat_cod"; }
public frmContasPagar() { InitializeComponent(); DALConexao cx = new DALConexao(DadosConexao.StringDeConexao); BLLFornecedor bll = new BLLFornecedor(cx); cbFornecedor.DataSource = bll.Localizar(""); cbFornecedor.DisplayMember = "for_nome"; cbFornecedor.ValueMember = "for_cod"; }
private void CarregaUnidadeMedida(string dados) { // Objeto conexão DALConexao con = new DALConexao(DadosConexao.StringConexao); //Objeto categoria regras e manipulação de dados BLLUnidadeMedida um = new BLLUnidadeMedida(con); dgvUnidadeMedida.DataSource = um.Localizar(dados); }
private void CarregarCategoria(string dados) { // Objeto conexão DALConexao con = new DALConexao(DadosConexao.StringConexao); //Objeto categoria regras e manipulação de dados BLLCategoria c = new BLLCategoria(con); dgvDadosCategoria.DataSource = c.Localizar(dados); }
private void frmCadastroSubCategoria_Load(object sender, EventArgs e) { Ferramentas.CloseButtonDisabler.FormCloseButtonDisabler.DisableCloseButton(this.Handle.ToInt32()); this.AlteraBotoes(1); DALConexao cx = new DALConexao(DadosDaConexao.srtConexao); BLLCategoria bll = new BLLCategoria(cx); cbCatCod.DataSource = bll.Localizar(""); cbCatCod.DisplayMember = "cat_nome"; cbCatCod.ValueMember = "cat_cod"; txtSnome.Focus(); }
private void AddUnidadeMedida_Click(object sender, EventArgs e) { frmCadastroUnidadeMedida f = new frmCadastroUnidadeMedida(); f.ShowDialog(); f.Dispose(); DALConexao cx = new DALConexao(DadosConexao.StringDeConexao); //combo und medida BLLUnidadeMedida ubll = new BLLUnidadeMedida(cx); cbUnd.DataSource = ubll.Localizar(""); cbUnd.DisplayMember = "umed_nome"; cbUnd.ValueMember = "umed_cod"; }
private void btnPesquizar_Click(object sender, EventArgs e) { DALConexao cx = new DALConexao(DadosConexao.StringDeConexao); BLLVenda bll = new BLLVenda(cx); dataGridVenda.DataSource = null; dataGridVenda.DataSource = bll.Localizar(txtValor.Text); dataGridVenda.Refresh(); string numeroVenda = dataGridVenda[0, 0].Value.ToString(); BLLItemVenda bll2 = new BLLItemVenda(cx); dataGridItens.DataSource = null; dataGridItens.DataSource = bll2.Localizar(Convert.ToInt32(numeroVenda)); dataGridItens.Refresh(); }
private void btnExcluir_Click(object sender, EventArgs e) { try { DialogResult d = MessageBox.Show("Deseja excluir o registro?", "Aviso", MessageBoxButtons.YesNo); if (d.ToString() == "Yes") { DALConexao cx = new DALConexao(DadosDaConexao.StringDeConexao); BLLCategoria bll = new BLLCategoria(cx); bll.Excluir(Convert.ToInt32(txtCodigo.Text)); this.LimpaTela(); this.alterarBotoes(1); } }catch { MessageBox.Show("Impossível excluir o registro. \n O Registro Está sendo Utilizado em outro Local."); this.alterarBotoes(3); } }
private void btPesquisar_Click(object sender, EventArgs e) { DALConexao cx = new DALConexao(DadosDaConexao.srtConexao); BLLProduto bll = new BLLProduto(cx); dgvDados.DataSource = bll.Localizar(txtValor.Text); dgvDados.Columns[0].HeaderText = "Código"; dgvDados.Columns[0].Width = 50; dgvDados.Columns[1].HeaderText = "Produto"; dgvDados.Columns[1].Width = 150; dgvDados.Columns[2].HeaderText = "Descrição"; dgvDados.Columns[2].Width = 200; dgvDados.Columns[3].HeaderText = "Foto"; dgvDados.Columns[3].Width = 50; dgvDados.Columns[4].HeaderText = "Valor Pago"; dgvDados.Columns[4].Width = 100; dgvDados.Columns[5].HeaderText = "Valor de Venda"; dgvDados.Columns[5].Width = 100; dgvDados.Columns[6].HeaderText = "Quantidade"; dgvDados.Columns[6].Width = 100; dgvDados.Columns[7].HeaderText = "Unidade de Medida"; dgvDados.Columns[7].Width = 50; dgvDados.Columns[8].HeaderText = "Categoria"; dgvDados.Columns[8].Width = 50; dgvDados.Columns[9].HeaderText = "Sub Categoria"; dgvDados.Columns[9].Width = 100; dgvDados.Columns[10].HeaderText = "Unidade de medida"; dgvDados.Columns[10].Width = 100; dgvDados.Columns[11].HeaderText = "Categoria"; dgvDados.Columns[11].Width = 100; dgvDados.Columns[12].HeaderText = "Sub Categoria"; dgvDados.Columns[12].Width = 100; dgvDados.Columns["pro_foto"].Visible = false; dgvDados.Columns["pro_valorpago"].Visible = false; dgvDados.Columns["cat_cod"].Visible = false; dgvDados.Columns["scat_cod"].Visible = false; dgvDados.Columns["umed_cod"].Visible = false; }
private void btExcluir_Click(object sender, EventArgs e) { try { DialogResult d = MessageBox.Show("Deseja excluir o registro?", "Aviso", MessageBoxButtons.YesNo); if (d.ToString() == "Yes") { DALConexao cx = new DALConexao(DadosConexao.StringDeConexao); BLLVenda bll = new BLLVenda(cx); bll.Excluir(Convert.ToInt32(lbVenda.Text)); this.LimpaTela(); this.alteraBotoes(1); } } catch { MessageBox.Show("Impossível excluir o registro.\n Pois o mesmo está sendo utilizado em outro local."); this.alteraBotoes(3); } }
private void btLocalizar_Click(object sender, EventArgs e) { frmConsultaUnidadeDeMedida f = new frmConsultaUnidadeDeMedida(); f.ShowDialog(); if (f.codigo != 0) { DALConexao cx = new DALConexao(DadosDaConexao.StringDeConexao); BLLUnidadeDeMedida bll = new BLLUnidadeDeMedida(cx); ModeloUnidadeDeMedida modelo = bll.CarregaModeloUnidadeDeMedida(f.codigo); txtCod.Text = modelo.UmedCod.ToString(); txtUnidadeMedida.Text = modelo.UmedNome; alteraBotoes(3); } else { this.LimpaTela(); this.alteraBotoes(1); } f.Dispose(); }
private void frmCadastroDeProdutos_Load(object sender, EventArgs e) { Ferramentas.CloseButtonDisabler.FormCloseButtonDisabler.DisableCloseButton(this.Handle.ToInt32()); AlteraBotoes(1); DALConexao cx = new DALConexao(DadosDaConexao.srtConexao); BLLCategoria bll = new BLLCategoria(cx); cbCategoria.DataSource = bll.Localizar(""); cbCategoria.DisplayMember = "cat_nome"; cbCategoria.ValueMember = "cat_cod"; cbCategoria.AutoCompleteMode = AutoCompleteMode.Suggest; cbCategoria.AutoCompleteSource = AutoCompleteSource.ListItems; try { BLLSubCategoria sbll = new BLLSubCategoria(cx); cbSubCategoria.DataSource = sbll.LocalizarPorCategoria((int) cbCategoria.SelectedValue); cbSubCategoria.DisplayMember = "scat_nome"; cbSubCategoria.ValueMember = "scat_cod"; cbSubCategoria.AutoCompleteMode = AutoCompleteMode.Suggest; cbSubCategoria.AutoCompleteSource = AutoCompleteSource.ListItems; } catch { // MessageBox.Show("Cadastre uma Categoria"); } BLLUnidadeDeMedida ubll = new BLLUnidadeDeMedida(cx); cbUnidadeMedida.DataSource = ubll.Localizar(""); cbUnidadeMedida.DisplayMember = "umed_nome"; cbUnidadeMedida.ValueMember = "umed_cod"; cbUnidadeMedida.AutoCompleteMode = AutoCompleteMode.Suggest; cbUnidadeMedida.AutoCompleteSource = AutoCompleteSource.ListItems; txtNome.Focus(); }
private void btLocalizar_Click(object sender, EventArgs e) { frmConsultaTipoPagamento f = new frmConsultaTipoPagamento(); f.ShowDialog(); f.Dispose(); if (f.codigo != 0) { DALConexao cx = new DALConexao(DadosConexao.StringDeConexao); BLLTipoPagamento bll = new BLLTipoPagamento(cx); ModeloTipoPagamento modelo = bll.CarregaModeloTipoPagamento(f.codigo); txtCodigo.Text = modelo.TpaCod.ToString(); txtNome.Text = modelo.TpaNome; alteraBotoes(3); } else { this.LimpaTela(); this.alteraBotoes(1); } f.Dispose(); }
private void btLocalizar_Click(object sender, EventArgs e) { frmConsultaUnidadeDeMedida consulta = new frmConsultaUnidadeDeMedida(); consulta.ShowDialog(); if (consulta.codigo != 0) { DALConexao cx = new DALConexao(DadosDaConexao.srtConexao); BLLUnidadeDeMedida bll = new BLLUnidadeDeMedida(cx); ModeloUnidadeDeMedida modelo = bll.CarregaModeloUnidadeDeMedida(consulta.codigo); txtCodigo.Text = modelo.umedCod.ToString(); txtNome.Text = modelo.umedNome; AlteraBotoes(3); } else { this.LimpaCampos(); this.AlteraBotoes(1); } consulta.Dispose(); }
public void btSalvar_Click(object sender, EventArgs e) { try { //leitura dos dados ModeloCategoria modelo = new ModeloCategoria(); modelo.CatNome = txtNome.Text; //obj para gravar os dados no banco DALConexao cx = new DALConexao(DadosConexao.StringDeConexao); BLLCategoria bll = new BLLCategoria(cx); if (this.operacao == "inserir") { //cadastrar uma categoria bll.Incluir(modelo); MessageBox.Show("Cadastro efetuado: Código: "+modelo.CatCod.ToString()); } else { //alterar uma categoria modelo.CatCod = Convert.ToInt32(txtCodigo.Text); bll.Alterar(modelo); MessageBox.Show("Cadastro alterado"); } this.LimpaTela(); this.alteraBotoes(1); } catch (SqlException) { MessageBox.Show("A categoria " + txtNome.Text + " já está cadastrada", "Verifique!"); } catch (Exception erro) { MessageBox.Show(erro.Message); } }
private void btLocalizar_Click(object sender, EventArgs e) { frmConsultaSubcategoria f = new frmConsultaSubcategoria(); f.ShowDialog(); f.Dispose(); if (f.codigo != 0) { DALConexao cx = new DALConexao(DadosConexao.StringDeConexao); BLLSubCategoria bll = new BLLSubCategoria(cx); ModeloSubCategoria modelo = bll.CarregaModeloSubCategoria(f.codigo); txtCodigo.Text = modelo.ScatCod.ToString(); txtNome.Text = modelo.ScatNome; cbxCategoria.SelectedValue = modelo.CatCod; alteraBotoes(3); } else { this.LimpaTela(); this.alteraBotoes(1); } f.Dispose(); }
private void btLocalizar_Click(object sender, EventArgs e) { frmConsultaProduto f = new frmConsultaProduto(); f.ShowDialog(); if (f.codigo != 0) { DALConexao cx = new DALConexao(DadosDaConexao.StringDeConexao); BLLProduto bll = new BLLProduto(cx); ModeloProduto modelo = bll.CarregaModeloProduto(f.codigo); txtCodigo.Text = modelo.CatCod.ToString(); //colocar os dados na tela txtCodigo.Text = modelo.ProCod.ToString(); txtDescricao.Text = modelo.ProDescricao; txtNome.Text = modelo.ProNome; txtQtde.Text = modelo.ProQtde.ToString(); txtValorPago.Text = modelo.ProValorPago.ToString(); txtValorVenda.Text = modelo.ProValorVenda.ToString(); cbCategoria.SelectedValue = modelo.CatCod; cbSubCategoria.SelectedValue = modelo.ScatCod; cbUnd.SelectedValue = modelo.UmedCod; try { MemoryStream ms = new MemoryStream(modelo.ProFoto); pbFoto.Image = Image.FromStream(ms); } catch {} alteraBotoes(3); } else { this.LimpaTela(); this.alteraBotoes(1); } f.Dispose(); }
private void btExcluir_Click(object sender, EventArgs e) { try { Ferramentas.MessageBoxHelper.PrepToCenterMessageBoxOnForm(this); DialogResult res = MessageBox.Show("Deseja excluir esta unidade de Medida ?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (res.ToString() == "Yes") { DALConexao cx = new DALConexao(DadosDaConexao.srtConexao); BLLUnidadeDeMedida bll = new BLLUnidadeDeMedida(cx); bll.Excluir(Convert.ToInt32(txtCodigo.Text)); Ferramentas.MessageBoxHelper.PrepToCenterMessageBoxOnForm(this); MessageBox.Show("Registro excluido com sucesso", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); this.LimpaCampos(); this.AlteraBotoes(1); } } catch (Exception erro) { Ferramentas.MessageBoxHelper.PrepToCenterMessageBoxOnForm(this); MessageBox.Show("Impossivel excluir este registro \n O Registro está sendo utilizado \n" + erro.Message, "Erro", MessageBoxButtons.OK,MessageBoxIcon.Error); AlteraBotoes(3); } }
public DALPCORIGEMPRECO(DALConexao cx) { this.conexao = cx; }
public DALTipoPagamento(DALConexao conn) { this.conexao = conn; }
public DALUnidadeDeMedida(DALConexao cx) { this.conexao = cx; }
public DALItensCompra(DALConexao cx) { this.conexao = cx; }
public DALUsuario(DALConexao con) { conexao = con; }
public DALPermissaoUsuario(DALConexao cx) { this.conexao = cx; }
private DALConexao conexao; // cria uma propriedade privada public DALCliente(DALConexao cx) //criar um construtor, ele recebe uma conexão { this.conexao = cx; }
public DALItensVenda(DALConexao cx) { this.conexao = cx; }
public DALEleicao(DALConexao cx) { this.conexao = cx; }
private DALConexao conexao; // cria uma propriedade privada public DALParcelasCompra(DALConexao cx) //criar um construtor, ele recebe uma conexão { this.conexao = cx; }
public DALVendas(DALConexao cx) { this.conexao = cx; }
public DALTipoPagamento(DALConexao cx) { this.conexao = cx; }
private DALConexao conexao; //Conexao é uma variavel que representa a conexao public DALTipoPagamento(DALConexao cx) //Construtor que recebe como parametro uma conexao { conexao = cx; //conexao que recebe o objeto cx }
public DALMateria(DALConexao cx) { this.conexao = cx; }
public DALUnidadeMedida(DALConexao cx) { this.conexao = cx; }
public DALFornecedor(DALConexao cx) { this.conexao = cx; }
public DALMedia(DALConexao cn) { this.con = cn; }
public DALCidade(DALConexao cx) { this.conexao = cx; }
private DALConexao conexao; //Conexao é uma variavel que representa a conexao public DALSubCategoria(DALConexao cx) //Construtor que recebe como parametro uma conexao { conexao = cx; //conexao que recebe o objeto cx }
public DALFabricante(DALConexao cx) { this.conexao = cx; }
public DALCandidato(DALConexao cx) { this.conexao = cx; }
public DALCentroCustos(DALConexao cx) { this.conexao = cx; }
public DALSubCategoria(DALConexao con) { this.CONEXAO = con; }
public DALVoto(DALConexao cx) { this.conexao = cx; }
public DALCategoria(DALConexao cx) { this.conexao = cx; }
public DALProduto(DALConexao con) { this.CONEXAO = con; }
//Construtor public DALProduto(DALConexao cx) { this.conexao = cx; }
public DALNome(DALConexao cn) { this.con = cn; }
public DALCategoria(DALConexao con) { conexao = con; }
public DALPessoa(DALConexao cx) { this.conexao = cx; }
private void btSalvar_Click(object sender, EventArgs e) { try { ModeloMotorista modelo = new ModeloMotorista(); txtNome.Text = txtNome.Text.ToUpper(); modelo.MotNome = txtNome.Text; txtLocalidade.Text = txtLocalidade.Text.ToUpper(); modelo.MotLocalidade = txtLocalidade.Text; modelo.MotCNH = txtCNH.Text; modelo.MotVencCNH = dtpVencimentoCNH.Value; txtCargo.Text = txtCargo.Text.ToUpper(); modelo.MotCargo = txtCargo.Text; modelo.MotSituacao = cbAtivo.Text; DALConexao cx = new DALConexao(DadosDaConexao.srtConexao); BLLMotorista bll = new BLLMotorista(cx); if (operacao == "inserir") { modelo.CarregaImagemCNH(cnh); modelo.CarregaImagemFoto(foto); bll.Incluir(modelo); Ferramentas.MessageBoxHelper.PrepToCenterMessageBoxOnForm(this); MessageBox.Show("Cadastro efetuado - Código " + modelo.IdMotorista.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { modelo.IdMotorista = Convert.ToInt32(txtCodigo.Text); if (this.foto == "Imagem Original") { ModeloMotorista mt = bll.CarregaModeloMotorista(modelo.IdMotorista); modelo.MotFoto = mt.MotFoto; } else { modelo.CarregaImagemFoto(foto); } if (this.cnh == "Imagem Original") { ModeloMotorista mt = bll.CarregaModeloMotorista(modelo.IdMotorista); modelo.MotImgCNH = mt.MotImgCNH; } else { modelo.CarregaImagemCNH(cnh); } bll.Alterar(modelo); Ferramentas.MessageBoxHelper.PrepToCenterMessageBoxOnForm(this); MessageBox.Show("Cadastro Alterado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); } this.LimpaCampos(); this.AlteraBotoes(1); } catch (Exception erro) { MessageBox.Show(erro.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public DALCliente(DALConexao cx) { this.conexao = cx; }