private void bbAltera_Click(object sender, EventArgs e) { using (TFNovoLoteAnvisa fLote = new TFNovoLoteAnvisa()) { fLote.rLote = bsLoteAnvisa.Current as CamadaDados.Faturamento.LoteAnvisa.TRegistro_LoteAnvisa; if (fLote.ShowDialog() == DialogResult.OK) { if (fLote.rLote != null) { try { CamadaNegocio.Faturamento.LoteAnvisa.TCN_LoteAnvisa.Gravar(fLote.rLote, null); MessageBox.Show("Alterado com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); bsLoteAnvisa.DataSource = CamadaNegocio.Faturamento.LoteAnvisa.TCN_LoteAnvisa.Buscar(fLote.rLote.Cd_empresa, string.Empty, fLote.rLote.Cd_produto, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, null); } catch (Exception ex) { MessageBox.Show(ex.Message.Trim(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } }
private void toolStripButton5_Click(object sender, EventArgs e) { using (TFNovoLoteAnvisa fLote = new TFNovoLoteAnvisa()) { fLote.pCd_empresa = pCd_empresa; fLote.pNm_empresa = pNm_empresa; fLote.pCd_produto = pCd_produto; fLote.pDs_produto = pDs_produto; fLote.pCd_fornecedor = pCd_fornecedor; fLote.pNm_fornecedor = pNm_fornecedor; if (fLote.ShowDialog() == DialogResult.OK) { if (fLote.rLote != null) { try { CamadaNegocio.Faturamento.LoteAnvisa.TCN_LoteAnvisa.Gravar(fLote.rLote, null); MessageBox.Show("Lote adicionado com sucesso.", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information); bsLoteAnvisa.Add(fLote.rLote); bsLoteAnvisa.ResetBindings(true); } catch (Exception ex) { MessageBox.Show(ex.Message.Trim(), "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } }