private void BtnEditar_Click(object sender, EventArgs e)
        {
            if (operacao == "Categoria")
            {
                var linha = dgVisualizar.CurrentRow.DataBoundItem;

                var menu = new CadastrarCategoria((CategoriaModel)linha);
                menu.FormClosed += (x, y) =>
                {
                    this.Show();
                    this.loadDataGrid();
                };
                menu.Show();
                this.Hide();
            }
            else if (operacao == "Status")
            {
                var linha = dgVisualizar.CurrentRow.DataBoundItem;
                var menu  = new CadastrarStatus((StatusModel)linha);
                menu.FormClosed += (x, y) =>
                {
                    this.Show();
                    this.loadDataGrid();
                };
                menu.Show();
                this.Hide();
            }
            else if (operacao == "Perfil")
            {
                var linha = dgVisualizar.CurrentRow.DataBoundItem;

                var menu = new CadastroPerfil((PerfilModel)linha);
                menu.FormClosed += (x, y) =>
                {
                    this.Show();
                    this.loadDataGrid();
                };
                menu.Show();
                this.Hide();
            }
            else if (operacao == "")
            {
                MessageBox.Show("Escolha o tipo de visualização e depois clique na operação desejada!");
            }
        }
 private void BtnCadastrar_Click(object sender, EventArgs e)
 {
     if (operacao == "Categoria")
     {
         var menu = new CadastrarCategoria();
         menu.FormClosed += (x, y) =>
         {
             this.Show();
             this.loadDataGrid();
         };
         menu.Show();
         this.Hide();
     }
     else if (operacao == "Status")
     {
         var menu = new CadastrarStatus();
         menu.FormClosed += (x, y) =>
         {
             this.Show();
             this.loadDataGrid();
         };
         menu.Show();
         this.Hide();
     }
     else if (operacao == "Perfil")
     {
         var menu = new CadastroPerfil();
         menu.FormClosed += (x, y) =>
         {
             this.Show();
             this.loadDataGrid();
         };
         menu.Show();
         this.Hide();
     }
     else if (operacao == "")
     {
         MessageBox.Show("Escolha o tipo de visualizar e depois clique na operação desejada!");
     }
 }
示例#3
0
        private void CadastroCategoria_Click(object sender, RoutedEventArgs e)
        {
            CadastrarCategoria cadastarCategoria = new CadastrarCategoria();

            cadastarCategoria.ShowDialog();
        }