Example #1
0
        public frmUpdateSetor(Form frm, Enumeradores.TipoOperacao tpo, BindingSource bnd)
        {
            InitializeComponent();

            try
            {
                frmGrid      = frm;
                tpOperacao   = tpo;
                bndSetorGrid = bnd;

                MdiParent = frmGrid.MdiParent;

                if (tpOperacao.Equals(Enumeradores.TipoOperacao.Insert))
                {
                    SetorDTOBindingSource.AddNew();
                }
                else
                {
                    setorDTO = (SetorDTO)bndSetorGrid.Current;
                    SetorDTOBindingSource.DataSource = setorGL.GetSetor(setorDTO.Id);
                }

                setorDTO = (SetorDTO)SetorDTOBindingSource.Current;
            }
            catch
            {
                throw;
            }
        }
Example #2
0
        private void Excluir()
        {
            if (MessageBox.Show("Deseja realmente excluir ?", "Atenção", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                setorDTO = (SetorDTO)SetorDTOBindingSource.Current;

                try
                {
                    setorGL.Delete(setorDTO.Id);
                    SetorDTOBindingSource.RemoveCurrent();
                }
                catch
                {
                    throw;
                }
            }
        }