示例#1
0
        private void inserirReceitasToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmRecipesInsert frmRecipesInsert = new FrmRecipesInsert(true);

            frmRecipesInsert.ShowDialog();
            OpenFrmReceitas();
        }
示例#2
0
        private void btUpdate_Click_1(object sender, EventArgs e)
        {
            if (_title == "Receitas - Validar")
            {
                DialogResult res = MessageBox.Show("Tem a certeza que pretende Validar?", "Atenção!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (res == DialogResult.Yes)
                {
                    int id;
                    int.TryParse(gvResultRecepies.CurrentRow.Cells["ID"].Value.ToString(), out id);
                    recipe.ID     = id;
                    recipe.Status = true;
                    _service.UpdateStatus(recipe);
                    MessageBox.Show("Validado com sucesso", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    FillGrid();
                }
                FillGrid();
            }
            else if (_title == "Receitas - Alterar")
            {
                int idRecipes;
                int.TryParse(gvResultRecepies.CurrentRow.Cells["ID"].Value.ToString(), out idRecipes);

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