public frmUpdateSecao(Form frm, Enumeradores.TipoOperacao tpo, BindingSource bnd) { InitializeComponent(); try { frmGrid = frm; tpOperacao = tpo; bndSecaoGrid = bnd; MdiParent = frmGrid.MdiParent; if (tpOperacao.Equals(Enumeradores.TipoOperacao.Insert)) { SecaoDTOBindingSource.AddNew(); } else { secaoDTO = (SecaoDTO)bndSecaoGrid.Current; SecaoDTOBindingSource.DataSource = secaoGL.GetSecao(secaoDTO.Id); } secaoDTO = (SecaoDTO)SecaoDTOBindingSource.Current; } catch { throw; } }
private void Excluir() { if (MessageBox.Show("Deseja realmente excluir ?", "Atenção", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { secaoDTO = (SecaoDTO)SecaoDTOBindingSource.Current; try { secaoGL.Delete(secaoDTO.Id); SecaoDTOBindingSource.RemoveCurrent(); } catch { throw; } } }