Exemplo n.º 1
0
        public void Execute(object parameter)
        {
            var selectedExpenses = _mainPresentation.SelectedExpenses;

            if (!selectedExpenses.Any())
            {
                return;
            }

            var recipients = selectedExpenses.Select(e => e.Recipient);

            var dlg = new EditCategoryWindow {
                CategoryName = _category.Name,
                Color        = _category.Color,
                Patterns     = _category.Patterns.Concat(recipients).ToArray()
            };

            if (dlg.ShowDialog() == true && !string.IsNullOrEmpty(dlg.CategoryName))
            {
                _category.Name     = dlg.CategoryName;
                _category.Color    = dlg.Color;
                _category.Patterns = dlg.Patterns;
                _mainPresentation.SaveCategories();
            }
        }
Exemplo n.º 2
0
        public void Execute(object parameter)
        {
            var dlg = new EditCategoryWindow();

            if (dlg.ShowDialog() == true && !string.IsNullOrEmpty(dlg.CategoryName))
            {
                var category = new Category(dlg.CategoryName, dlg.Color, dlg.Patterns);
                _mainPresentation.AddCategory(category);
            }
        }
Exemplo n.º 3
0
        private void EditCategory_Click(Object parameter)
        {
            int categoryID          = (int)parameter;
            EditCategoryWindow form = new EditCategoryWindow(categoryID);

            form.ShowDialog();

            if (form.MViewModel.IsCategoryValid)
            {
                form.editingCategoryGlobal.CategoryName        = form.MViewModel.CategoryName;
                form.editingCategoryGlobal.CategoryDescription = form.MViewModel.CategoryDescription;
                form.editingCategoryGlobal.ColorTag            = form.MViewModel.CategoryColorTag;
                form.editingCategoryMonthly.Amount             = Math.Round(decimal.Parse(form.MViewModel.CategoryAmount), 2);
                form.editingCategoryMonthly.LastModifDate      = DateTime.Now;

                EZBudgetDB.SaveChanges();

                // TO BE CHANGED
                PopulateViewModel();
            }
        }
        public void Execute(object parameter)
        {
            if (parameter is not CategoryPresentation category)
            {
                return;
            }

            var dlg = new EditCategoryWindow {
                CategoryName = category.Name,
                Patterns     = category.Patterns,
                Color        = category.Color,
            };

            if (dlg.ShowDialog() == true && !string.IsNullOrEmpty(dlg.CategoryName))
            {
                category.Name     = dlg.CategoryName;
                category.Color    = dlg.Color;
                category.Patterns = dlg.Patterns;
                _mainPresentation.SaveCategories();
            }
        }
        public void Execute(object parameter)
        {
            var selectedExpenses = _mainPresentation.SelectedExpenses;

            if (!selectedExpenses.Any())
            {
                return;
            }

            var recipients = selectedExpenses.Select(e => e.Recipient);

            var dlg = new EditCategoryWindow {
                CategoryName = "",
                Patterns     = recipients.ToArray()
            };

            if (dlg.ShowDialog() == true && !string.IsNullOrEmpty(dlg.CategoryName))
            {
                var category = new Category(dlg.CategoryName, dlg.Color, dlg.Patterns);
                _mainPresentation.AddCategory(category);
            }
        }