Пример #1
0
        private void inserirCategoriasToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmCategories_InsertUpdate FrmCategories_InsertUpdate = new FrmCategories_InsertUpdate(true);

            FrmCategories_InsertUpdate.ShowDialog();
            OpenFrmCategories();
        }
Пример #2
0
        private void btUpdate_Click(object sender, EventArgs e)
        {
            if (_title == "Categorias - Alterar")
            {
                int idCategories;
                int.TryParse(gvResultCategories.CurrentRow.Cells["ID"].Value.ToString(), out idCategories);

                FrmCategories_InsertUpdate FrmCategories_InsertUpdate = new FrmCategories_InsertUpdate(false, idCategories);
                FrmCategories_InsertUpdate.ShowDialog();
                FillGrid();
            }
            else
            {
                DialogResult res = MessageBox.Show("Tem a certeza que pretende eliminar?", "Atenção!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (res == DialogResult.Yes)
                {
                    int id;
                    int.TryParse(gvResultCategories.CurrentRow.Cells["ID"].Value.ToString(), out id);
                    _service.Remove(id);
                }
                else
                {
                    FillGrid();
                }
            }
        }