コード例 #1
0
ファイル: CheaperService.cs プロジェクト: radtek/Cheaper
 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);
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// Clears data from the SubCategories.
        /// </summary>
        public void ClearData()
        {
            IncomeCategories.Clear();
            ExpenseCategories.Clear();

            SelectedIncomeCategory  = new Category();
            SelectedExpenseCategory = new Category();
        }
コード例 #3
0
 public ExpenseTransaction(DateTime date,
                           string description,
                           ExpenseCategories expenseCategories,
                           decimal paidOut,
                           decimal paidIn)
 {
     Date              = date;
     Description       = description;
     ExpenseCategories = expenseCategories;
     PaidOut           = paidOut;
     PaidIn            = paidIn;
 }
コード例 #4
0
 /// <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;
     }
 }
コード例 #5
0
        /// <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;
        }
コード例 #6
0
ファイル: CheaperService.cs プロジェクト: radtek/Cheaper
    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);
            }
        }
    }
コード例 #7
0
 public ActionResult AddCategory(ExpenseCategories expenseCategories)
 {
     expenseRepository.AddExpenseCategory(expenseCategories);
     return(RedirectToAction("AddExpense"));
 }
コード例 #8
0
 public void AddExpenseCategory(ExpenseCategories expenseCategories)
 {
     context.ExpenseCategories.Add(expenseCategories);
     context.SaveChanges();
 }
コード例 #9
0
 public void Handle(UpdateDataListEvent message)
 {
     Income.AllIncomeCategories   = IncomeCategories.ToList();
     Expense.AllExpenseCategories = ExpenseCategories.ToList();
 }
コード例 #10
0
 /// <summary>
 /// Sends all edits to the Income & Expense SubCategory Lists.
 /// </summary>
 public void FinishCategories()
 {
     Income.AllIncomeCategories   = IncomeCategories.ToList();
     Expense.AllExpenseCategories = ExpenseCategories.ToList();
 }
コード例 #11
0
 /// <summary>
 /// Removes the selected Expense SubCategory from the SubCategory List.
 /// </summary>
 public void RemoveExpenseCategory()
 {
     ExpenseCategories.Remove(SelectedExpenseCategory);
 }