Beispiel #1
0
        public frmUpdateProdutoServico(Form frm, Enumeradores.TipoOperacao tpo, BindingSource bnd)
        {
            InitializeComponent();
            ValidaTipoLucro();
            try
            {
                frmGrid        = frm;
                tpOperacao     = tpo;
                bndProdutoGrid = bnd;
                MdiParent      = frmGrid.MdiParent;

                if (tpOperacao.Equals(Enumeradores.TipoOperacao.Insert))
                {
                    ProdutoServicoBindingSource.AddNew();
                }
                else
                {
                    produtoDTO = (ProdutoServicoDTO)bndProdutoGrid.Current;
                    ProdutoServicoBindingSource.DataSource = produtoGL.GetProdutoServico(produtoDTO.Id);
                    produtoDTOVersaoOriginal = new ProdutoServicoDTO((ProdutoServicoDTO)ProdutoServicoBindingSource.Current);
                }
                produtoDTO = (ProdutoServicoDTO)ProdutoServicoBindingSource.Current;
                carregaValores();
            }
            catch
            {
                throw;
            }

            GetFoto();
        }
Beispiel #2
0
        private void Excluir()
        {
            if (MessageBox.Show("Deseja realmente excluir ?", "Atenção", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                produtoDTO = (ProdutoServicoDTO)ProdutoServicoBindingSource.Current;

                try
                {
                    produtoGL.Delete(produtoDTO.Id);
                    ProdutoServicoBindingSource.RemoveCurrent();
                }
                catch
                {
                    throw;
                }
            }
        }