Пример #1
0
        private void BtnDelCat_Click(object sender, EventArgs e)
        {
            if (selectedCat != null)
            {
                using (var db = new CategoryManager())
                {
                    db.DeleteItem(selectedCat);
                }

                using (var db = new ExpenseManager())
                {
                    var expenses = db.GetItemsByCategory(selectedCat);
                    foreach (var exp in expenses)
                    {
                        exp.CategoryId = 2;
                        db.SaveItem(exp);
                    }
                }

                Dialog.Dismiss();
            }
        }