Exemplo n.º 1
0
        public override void Alterar()
        {
            try
            {
                base.Alterar();

                if (gv_Item.GetSelectedRows().Count() == 0)
                {
                    throw Excessoes.AlterandoSemRegistro();
                }

                using (var forma = new FItem_Cadastro {
                    Operacao = Operacao.Alterar, item = gv_Item.GetSelectedRow <E_ITEM>()
                })
                {
                    if (forma.ShowDialog() == DialogResult.OK)
                    {
                        item = forma.item;
                        Buscar();
                    }
                }
            }
            catch (Exception excessao)
            {
                Mensagens.Alerta(excessao.Tratar());
            }
        }
Exemplo n.º 2
0
        public override void Adicionar()
        {
            try
            {
                base.Adicionar();

                using (var forma = new FItem_Cadastro {
                    Operacao = Operacao.Cadastrar
                })
                {
                    if (forma.ShowDialog() == DialogResult.OK)
                    {
                        item = forma.item;
                        Buscar();
                    }
                }
            }
            catch (Exception excessao)
            {
                Mensagens.Alerta(excessao.Tratar());
            }
        }