Esempio n. 1
0
        private void inserirIngredientesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmIngredients_InsertUpdate FrmIngredients_InsertUpdate = new FrmIngredients_InsertUpdate(true);

            FrmIngredients_InsertUpdate.ShowDialog();
            OpenFrmIngredients();
        }
Esempio n. 2
0
        private void btUpdate_Click(object sender, EventArgs e)
        {
            if (_title == "Ingredientes - Alterar")
            {
                int idCategories;
                int.TryParse(gvResultIngredients.CurrentRow.Cells["ID"].Value.ToString(), out idCategories);

                FrmIngredients_InsertUpdate frmIngredients_InsertUpdate = new FrmIngredients_InsertUpdate(false, idCategories);
                frmIngredients_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(gvResultIngredients.CurrentRow.Cells["ID"].Value.ToString(), out id);
                    _service.Remove(id);
                }
                else
                {
                    FillGrid();
                }
            }
        }