public bool ChangeKwotaKatWyd(decimal kwota, int idKatWyd, string userName) { using (var context = new CheaperEntities()) { try { ExpenseCategories katWyd = (from c in context.ExpenseCategories where c.UserID == userName && c.Id == idKatWyd select c).First(); //if (katWyd == null) // throw new NullReferenceException("Próba zmiany kwoty kategorii wydatku nie należącej do użytkownika"); katWyd.Amount = kwota; if (context.SaveChanges() == 1) { return(true); } else { return(false); } } catch (Exception ex) { throw new Exception("Próba zmiany kwoty kategorii wydatku nie należącej do użytkownika", ex); } } }
/// <summary> /// Clears data from the SubCategories. /// </summary> public void ClearData() { IncomeCategories.Clear(); ExpenseCategories.Clear(); SelectedIncomeCategory = new Category(); SelectedExpenseCategory = new Category(); }
public ExpenseTransaction(DateTime date, string description, ExpenseCategories expenseCategories, decimal paidOut, decimal paidIn) { Date = date; Description = description; ExpenseCategories = expenseCategories; PaidOut = paidOut; PaidIn = paidIn; }
/// <summary> /// Adds a new Expense SubCategory with the name in the NewExpenseName TextBox. /// </summary> public void AddExpenseCategory() { if (NewExpenseName == String.Empty) { ExpenseCategories.Add(new Category("Default")); } else { ExpenseCategories.Add(new Category(NewExpenseName)); NewExpenseName = String.Empty; } }
/// <summary> /// Base Constructor, Subscribes to the SendEnter Event. /// </summary> public SubCategoryViewModel() { #region Test Data. Should get replaced on startup. IncomeCategories.Add(new Category("Temp Income Category 1")); IncomeCategories.Add(new Category("Temp Income Category 2")); IncomeCategories.Add(new Category("Temp Income Category 3")); IncomeCategories.Add(new Category("Should not be shown.")); ExpenseCategories.Add(new Category("Temp Expense Category 1")); ExpenseCategories.Add(new Category("Temp Expense Category 2")); ExpenseCategories.Add(new Category("Temp Expense Category 3")); ExpenseCategories.Add(new Category("Should not be shown.")); #endregion SubCategoryView.SendEnter += this.SubCategoryView_SendKeyPress; }
public bool DodajKatWyd(string nazwaKat, decimal kwotaKat, string userName) { using (var context = new CheaperEntities()) { var nowaKatWyd = new ExpenseCategories(); nowaKatWyd.Name = nazwaKat; nowaKatWyd.Amount = kwotaKat; nowaKatWyd.UserID = userName; context.ExpenseCategories.AddObject(nowaKatWyd); if (context.SaveChanges() == 1) { return(true); } else { return(false); } } }
public ActionResult AddCategory(ExpenseCategories expenseCategories) { expenseRepository.AddExpenseCategory(expenseCategories); return(RedirectToAction("AddExpense")); }
public void AddExpenseCategory(ExpenseCategories expenseCategories) { context.ExpenseCategories.Add(expenseCategories); context.SaveChanges(); }
public void Handle(UpdateDataListEvent message) { Income.AllIncomeCategories = IncomeCategories.ToList(); Expense.AllExpenseCategories = ExpenseCategories.ToList(); }
/// <summary> /// Sends all edits to the Income & Expense SubCategory Lists. /// </summary> public void FinishCategories() { Income.AllIncomeCategories = IncomeCategories.ToList(); Expense.AllExpenseCategories = ExpenseCategories.ToList(); }
/// <summary> /// Removes the selected Expense SubCategory from the SubCategory List. /// </summary> public void RemoveExpenseCategory() { ExpenseCategories.Remove(SelectedExpenseCategory); }