コード例 #1
0
 public void Equals_All_Fields_Same()
 {
     var first = new ExpenseCategory(0, "name");
     var second = new ExpenseCategory(0, "name");
     Assert.AreNotSame(first, second);
     Assert.IsTrue(first.Equals(second));
     Assert.IsTrue(second.Equals(first));
 }
コード例 #2
0
 public AccountableSlipsView(Employee accountable, ExpenseCategory expense)
     : this()
 {
     if (accountable != null)
         accountableslipfilter1.RestrictAccountable = accountable;
     if (expense != null)
         accountableslipfilter1.RestrictExpenseCategory = expense;
 }
コード例 #3
0
 public void Equals_Name_Differs()
 {
     var first = new ExpenseCategory(0, "name");
     var second = new ExpenseCategory(0, "other name");
     Assert.AreNotSame(first, second);
     Assert.IsFalse(first.Equals(second));
     Assert.IsFalse(second.Equals(first));
 }
コード例 #4
0
ファイル: Expense.cs プロジェクト: stoiandan/MyHome
 public Expense(decimal amount, DateTime date, ExpenseCategory expenseCategory,
     PaymentMethod paymentMethod, string comment, int id = 0)
 {
     Amount = amount;
     Category = expenseCategory;
     Comments = comment;
     Date = date;
     Id = id;
     Method = paymentMethod;
 }
コード例 #5
0
ファイル: Expense.cs プロジェクト: smwentum/MyHome
 public Expense(double amount, DateTime date, ExpenseCategory expenseCategory,
     PaymentMethod paymentMethod, string comment, int id = 0)
 {
     this.Amount = amount;
     this.Category = expenseCategory;
     this.Comment = comment;
     this.Date = date;
     this.ID = id;
     this.Method = paymentMethod;
 }
コード例 #6
0
 public void Save(ExpenseCategory expenseCategory)
 {
     if (expenseCategory.Id != 0)
     {
         Update(expenseCategory);
     }
     else
     {
         Create(expenseCategory);
     }
 }
コード例 #7
0
        public void ExpenseCategoryRepository_Create_Adds_New_Item()
        {
            var testObject = new ExpenseCategory(0, "test");

            var mock = RepositoryMocks.GetMockExpenseCategoryRepository();
            mock.Create(testObject);

            var result = mock.GetAll();
            Assert.IsTrue(result.Contains(testObject));

            var singleItem = mock.GetById(testObject.Id);
            Assert.IsNotNull(singleItem);
            Assert.AreEqual(testObject, singleItem);
        }
コード例 #8
0
 public void Save(ExpenseCategory expenseCategory)
 {
     _repository.Save(expenseCategory);
 }
コード例 #9
0
 public void Update(ExpenseCategory expenseCategory)
 {
     _context.ExpenseCategories.Attach(expenseCategory);
     _context.SaveChanges();
 }
コード例 #10
0
ファイル: AdvanceReportDlg.cs プロジェクト: Art8m/Vodovozfork
 public AdvanceReportDlg(Employee accountable, ExpenseCategory expenseCategory, decimal money, IPermissionService permissionService) : this(permissionService)
 {
     Entity.Accountable     = accountable;
     Entity.ExpenseCategory = expenseCategory;
     Entity.Money           = money;
 }
コード例 #11
0
 public void Category_Throws_If_Name_Is_Only_Whitespace()
 {
     var c = new ExpenseCategory(0, "    \t\r\n");
 }
コード例 #12
0
 public ActionResult Update(ExpenseCategory ctrg)
 {
     ex.Update(ctrg);
     return(View());
 }
コード例 #13
0
 public static ExpenseCategoryModel ToModel(this ExpenseCategory entity)
 {
     return(entity.MapTo <ExpenseCategory, ExpenseCategoryModel>());
 }
コード例 #14
0
 public void Category_Throws_If_Name_Is_Empty_String()
 {
     var c = new ExpenseCategory(0, string.Empty);
 }
コード例 #15
0
 public void Update(ExpenseCategory expenseCategory)
 {
     _context.ExpenseCategories.Attach(expenseCategory);
     _context.SaveChanges();
 }
コード例 #16
0
ファイル: DBHelper.cs プロジェクト: Fateblade/Booky
 private static ExpenseCategory readExpenseCategory(SqlDataReader reader)
 {
     ExpenseCategory retData = new ExpenseCategory((int)reader["ID"])
     {
         Name = (string)reader["Name"]
     };
     return retData;
 }
コード例 #17
0
 public void Create(ExpenseCategory expenseCategory)
 {
     _repository.Create(expenseCategory);
 }
コード例 #18
0
 public IHttpActionResult UpdateOldExpenseCategory(ExpenseCategory oldexpensecategorytoupdate)
 {
     unitOfWork.expensecategories.Update(m => m.Id == oldexpensecategorytoupdate.Id, oldexpensecategorytoupdate);
     unitOfWork.Complete();
     return(Ok("Expense Category Updated Successfully"));
 }
コード例 #19
0
 public IHttpActionResult AddNewExpenseCategory(ExpenseCategory newexpensecategorytoadd)
 {
     unitOfWork.expensecategories.Add(newexpensecategorytoadd);
     unitOfWork.Complete();
     return(Ok("One new Expense Category Successfully Added"));
 }
コード例 #20
0
        protected override void Seed(ApplicationDbContext context)
        {
            // DEFAULT ROLE CREATION
            var roleManager = new RoleManager <IdentityRole>(
                new RoleStore <IdentityRole>(context));
            ApplicationDbContext db = new ApplicationDbContext();

            if (!context.Roles.Any(r => r.Name == "Head"))
            {
                roleManager.Create(new IdentityRole {
                    Name = "Head"
                });
            }
            if (!context.Roles.Any(r => r.Name == "Adult"))
            {
                roleManager.Create(new IdentityRole {
                    Name = "Adult"
                });
            }
            if (!context.Roles.Any(r => r.Name == "Member"))
            {
                roleManager.Create(new IdentityRole {
                    Name = "Member"
                });
            }
            if (!context.Roles.Any(r => r.Name == "DemoAccount"))
            {
                roleManager.Create(new IdentityRole {
                    Name = "DemoAccount"
                });
            }

            // DEFAULT USER CREATION
            var userManager = new UserManager <ApplicationUser>(
                new UserStore <ApplicationUser>(context));

            if (!context.Users.Any(u => u.Email == "*****@*****.**"))
            {
                userManager.Create(new ApplicationUser {
                    UserName       = "******",
                    FirstName      = "Casey",
                    LastName       = "Jones",
                    Email          = "*****@*****.**",
                    EmailConfirmed = true,
                }, "CoderFoundry1!");
            }
            if (!context.Users.Any(u => u.Email == "*****@*****.**"))
            {
                userManager.Create(new ApplicationUser {
                    UserName       = "******",
                    FirstName      = "Mark",
                    LastName       = "Jaang",
                    Email          = "*****@*****.**",
                    EmailConfirmed = true,
                }, "Budgeter8**");
            }
            if (!context.Users.Any(u => u.Email == "*****@*****.**"))
            {
                userManager.Create(new ApplicationUser {
                    UserName       = "******",
                    FirstName      = "Ryan",
                    LastName       = "Chapman",
                    Email          = "*****@*****.**",
                    EmailConfirmed = true,
                }, "Budgeter8**");
            }
            if (!context.Users.Any(u => u.Email == "*****@*****.**"))
            {
                userManager.Create(new ApplicationUser {
                    UserName       = "******",
                    FirstName      = "Demo",
                    LastName       = "Head",
                    Email          = "*****@*****.**",
                    EmailConfirmed = true,
                }, "Budgeter8**");
            }
            if (!context.Users.Any(u => u.Email == "*****@*****.**"))
            {
                userManager.Create(new ApplicationUser {
                    UserName       = "******",
                    FirstName      = "Demo",
                    LastName       = "Adult",
                    Email          = "*****@*****.**",
                    EmailConfirmed = true,
                }, "Budgeter8**");
            }
            if (!context.Users.Any(u => u.Email == "*****@*****.**"))
            {
                userManager.Create(new ApplicationUser {
                    UserName       = "******",
                    FirstName      = "Demo",
                    LastName       = "Member",
                    Email          = "*****@*****.**",
                    EmailConfirmed = true,
                }, "Budgeter8**");
            }


            // ASSIGNMENT OF ROLES TO EACH INITIAL USER

            //Casey Jones
            var userID = userManager.FindByEmail("*****@*****.**").Id;

            userManager.AddToRole(userID, "Head");
            userID = userManager.FindByEmail("*****@*****.**").Id;
            userManager.AddToRole(userID, "Adult");
            userID = userManager.FindByEmail("*****@*****.**").Id;
            userManager.AddToRole(userID, "Member");


            //Mark Jaang
            userID = userManager.FindByEmail("*****@*****.**").Id;
            userManager.AddToRole(userID, "Head");
            userID = userManager.FindByEmail("*****@*****.**").Id;
            userManager.AddToRole(userID, "Adult");
            userID = userManager.FindByEmail("*****@*****.**").Id;
            userManager.AddToRole(userID, "Member");

            //Ryan Chapman
            userID = userManager.FindByEmail("*****@*****.**").Id;
            userManager.AddToRole(userID, "Head");
            userID = userManager.FindByEmail("*****@*****.**").Id;
            userManager.AddToRole(userID, "Adult");
            userID = userManager.FindByEmail("*****@*****.**").Id;
            userManager.AddToRole(userID, "Member");

            // ASSIGNMENT OF DEMO USERS FOR EACH ROLE

            //DemoHead
            userID = userManager.FindByEmail("*****@*****.**").Id;
            userManager.AddToRole(userID, "Head");
            userID = userManager.FindByEmail("*****@*****.**").Id;
            userManager.AddToRole(userID, "Adult");
            userID = userManager.FindByEmail("*****@*****.**").Id;
            userManager.AddToRole(userID, "Member");
            userID = userManager.FindByEmail("*****@*****.**").Id;
            userManager.AddToRole(userID, "DemoAccount");

            //DemoAdult
            userID = userManager.FindByEmail("*****@*****.**").Id;
            userManager.AddToRole(userID, "Adult");
            userID = userManager.FindByEmail("*****@*****.**").Id;
            userManager.AddToRole(userID, "Member");
            userID = userManager.FindByEmail("*****@*****.**").Id;
            userManager.AddToRole(userID, "DemoAccount");

            //DemoMember
            userID = userManager.FindByEmail("*****@*****.**").Id;
            userManager.AddToRole(userID, "Member");
            userID = userManager.FindByEmail("*****@*****.**").Id;
            userManager.AddToRole(userID, "DemoAccount");


            //ACCOUNT TYPE/CATEGORY SEEDING
            if (!context.AccountCategories.Any(p => p.Category == "Savings"))
            {
                var ac = new AccountCategory();
                ac.Category = "Savings";
                context.AccountCategories.Add(ac);
            }
            if (!context.AccountCategories.Any(p => p.Category == "Checking"))
            {
                var ac = new AccountCategory();
                ac.Category = "Checking";
                context.AccountCategories.Add(ac);
            }
            if (!context.AccountCategories.Any(p => p.Category == "Mortgage"))
            {
                var ac = new AccountCategory();
                ac.Category = "Mortgage";
                context.AccountCategories.Add(ac);
            }
            if (!context.AccountCategories.Any(p => p.Category == "Credit Card"))
            {
                var ac = new AccountCategory();
                ac.Category = "Credit Card";
                context.AccountCategories.Add(ac);
            }
            if (!context.AccountCategories.Any(p => p.Category == "Investment"))
            {
                var ac = new AccountCategory();
                ac.Category = "Investment";
                context.AccountCategories.Add(ac);
            }
            if (!context.AccountCategories.Any(p => p.Category == "Retirement"))
            {
                var ac = new AccountCategory();
                ac.Category = "Retirement";
                context.AccountCategories.Add(ac);
            }
            if (!context.AccountCategories.Any(p => p.Category == "Student Loan"))
            {
                var ac = new AccountCategory();
                ac.Category = "Student Loan";
                context.AccountCategories.Add(ac);
            }
            if (!context.AccountCategories.Any(p => p.Category == "Loan"))
            {
                var ac = new AccountCategory();
                ac.Category = "Loan";
                context.AccountCategories.Add(ac);
            }


            //EXPENSE TYPE/CATEGORY SEEDING
            if (!context.ExpenseCategories.Any(p => p.Category == "Utilities"))
            {
                var ec = new ExpenseCategory();
                ec.Category = "Utilities";
                context.ExpenseCategories.Add(ec);
            }
            if (!context.ExpenseCategories.Any(p => p.Category == "Mobile Devices"))
            {
                var ec = new ExpenseCategory();
                ec.Category = "Mobile Devices";
                context.ExpenseCategories.Add(ec);
            }
            if (!context.ExpenseCategories.Any(p => p.Category == "Rent"))
            {
                var ec = new ExpenseCategory();
                ec.Category = "Rent";
                context.ExpenseCategories.Add(ec);
            }
            if (!context.ExpenseCategories.Any(p => p.Category == "Mortgage"))
            {
                var ec = new ExpenseCategory();
                ec.Category = "Mortgage";
                context.ExpenseCategories.Add(ec);
            }
            if (!context.ExpenseCategories.Any(p => p.Category == "Credit Card Payment"))
            {
                var ec = new ExpenseCategory();
                ec.Category = "Credit Card Payment";
                context.ExpenseCategories.Add(ec);
            }
            if (!context.ExpenseCategories.Any(p => p.Category == "Insurance"))
            {
                var ec = new ExpenseCategory();
                ec.Category = "Insurance";
                context.ExpenseCategories.Add(ec);
            }
            if (!context.ExpenseCategories.Any(p => p.Category == "Daycare"))
            {
                var ec = new ExpenseCategory();
                ec.Category = "Daycare";
                context.ExpenseCategories.Add(ec);
            }
            if (!context.ExpenseCategories.Any(p => p.Category == "Student Loan Payment"))
            {
                var ec = new ExpenseCategory();
                ec.Category = "Student Loan Payment";
                context.ExpenseCategories.Add(ec);
            }
            if (!context.ExpenseCategories.Any(p => p.Category == "Loan Payment"))
            {
                var ec = new ExpenseCategory();
                ec.Category = "Loan Payment";
                context.ExpenseCategories.Add(ec);
            }
            if (!context.ExpenseCategories.Any(p => p.Category == "Tuition"))
            {
                var ec = new ExpenseCategory();
                ec.Category = "Tuition";
                context.ExpenseCategories.Add(ec);
            }
            if (!context.ExpenseCategories.Any(p => p.Category == "School Supplies"))
            {
                var ec = new ExpenseCategory();
                ec.Category = "School Supplies";
                context.ExpenseCategories.Add(ec);
            }
            if (!context.ExpenseCategories.Any(p => p.Category == "Taxes"))
            {
                var ec = new ExpenseCategory();
                ec.Category = "Taxes";
                context.ExpenseCategories.Add(ec);
            }
            if (!context.ExpenseCategories.Any(p => p.Category == "Investment"))
            {
                var ec = new ExpenseCategory();
                ec.Category = "Investment";
                context.ExpenseCategories.Add(ec);
            }
            if (!context.ExpenseCategories.Any(p => p.Category == "Retirement Contribution"))
            {
                var ec = new ExpenseCategory();
                ec.Category = "Retirement Contribution";
                context.ExpenseCategories.Add(ec);
            }

            if (!context.ExpenseCategories.Any(p => p.Category == "Child Support Payment"))
            {
                var ec = new ExpenseCategory();
                ec.Category = "Child Support Payment";
                context.ExpenseCategories.Add(ec);
            }
            if (!context.ExpenseCategories.Any(p => p.Category == "Alimony Payment"))
            {
                var ec = new ExpenseCategory();
                ec.Category = "Alimony Payment";
                context.ExpenseCategories.Add(ec);
            }

            //INCOME TYPE/CATEGORY SEEDING
            if (!context.IncomeCategories.Any(p => p.Category == "Paycheck"))
            {
                var ic = new IncomeCategory();
                ic.Category = "Paycheck";
                context.IncomeCategories.Add(ic);
            }
            if (!context.IncomeCategories.Any(p => p.Category == "Investment Return"))
            {
                var ic = new IncomeCategory();
                ic.Category = "Investment Return";
                context.IncomeCategories.Add(ic);
            }
            if (!context.IncomeCategories.Any(p => p.Category == "Retirement Benefit"))
            {
                var ic = new IncomeCategory();
                ic.Category = "Retirement Benefit";
                context.IncomeCategories.Add(ic);
            }
            if (!context.IncomeCategories.Any(p => p.Category == "Loan Dispursement"))
            {
                var ic = new IncomeCategory();
                ic.Category = "Loan Dispursement";
                context.IncomeCategories.Add(ic);
            }
            if (!context.IncomeCategories.Any(p => p.Category == "Unemployment"))
            {
                var ic = new IncomeCategory();
                ic.Category = "Unemployment";
                context.IncomeCategories.Add(ic);
            }
            if (!context.IncomeCategories.Any(p => p.Category == "Child Support"))
            {
                var ic = new IncomeCategory();
                ic.Category = "Child Support";
                context.IncomeCategories.Add(ic);
            }
            if (!context.IncomeCategories.Any(p => p.Category == "Alimony"))
            {
                var ic = new IncomeCategory();
                ic.Category = "Alimony";
                context.IncomeCategories.Add(ic);
            }
            if (!context.IncomeCategories.Any(p => p.Category == "Social Security"))
            {
                var ic = new IncomeCategory();
                ic.Category = "Social Security";
                context.IncomeCategories.Add(ic);
            }
            if (!context.IncomeCategories.Any(p => p.Category == "Tax Return"))
            {
                var ic = new IncomeCategory();
                ic.Category = "Tax Return";
                context.IncomeCategories.Add(ic);
            }
            if (!context.IncomeCategories.Any(p => p.Category == "Student Loan"))
            {
                var ic = new IncomeCategory();
                ic.Category = "Student Loan";
                context.IncomeCategories.Add(ic);
            }
            if (!context.IncomeCategories.Any(p => p.Category == "Reverse Mortgage"))
            {
                var ic = new IncomeCategory();
                ic.Category = "Reverse Mortgage";
                context.IncomeCategories.Add(ic);
            }

            // TRANSACTION TYPE/CATEGORY SEEDING
            // Expenses
            if (!context.TransactionCategories.Any(p => p.Category == "Gas"))
            {
                var tc = new TransactionCategory();
                tc.Category             = "Gas";
                tc.BudgetPlanCategoryId = db.BudgetPlanCategories.First(b => b.Category == "Transportation" && b.HouseholdId == null).Id;
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Food"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Food";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Utilities"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Utilities";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Mobile Devices"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Mobile Devices";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Rent"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Rent";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Mortgage"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Mortgage";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Credit Card Payment"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Credit Card Payment";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Insurance"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Insurance";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Daycare"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Daycare";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Student Loan Payment"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Student Loan Payment";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Loan Payment"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Loan Payment";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Tuition"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Tuition";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "School Supplies"))
            {
                var tc = new TransactionCategory();
                tc.Category = "School Supplies";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Taxes"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Taxes";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Investment"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Investment";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Child Support Payment"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Child Support Payment";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Alimony Payment"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Alimony Payment";
                context.TransactionCategories.Add(tc);
            }
            // Incomes
            if (!context.TransactionCategories.Any(p => p.Category == "Paycheck"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Paycheck";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Investment Return"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Investment Return";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Retirement"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Retirement";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Loan Dispursement"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Loan Dispursement";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Unemployment"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Unemployment";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Child Support"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Child Support";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Alimony"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Alimony";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Social Security"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Social Security";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Tax Return"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Tax Return";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Student Loan Dispursement"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Student Loan Dispursement";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Reverse Mortgage"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Reverse Mortgage";
                context.TransactionCategories.Add(tc);
            }
            // Other
            if (!context.TransactionCategories.Any(p => p.Category == "Clothing"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Clothing";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Home Repair/Maintenance"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Home Repair/Maintenance";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Auto Repair/Maintenance"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Auto Repair/Maintenance";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Money Transfer"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Money Transfer";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Travel/Vacation"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Travel/Vacation";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Pharmacy"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Pharmacy";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Healthcare"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Healthcare";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Restaurant"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Restaurant";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Pet Care"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Pet Care";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Entertainment"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Entertainment";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Gift"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Gift";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Charity"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Charity";
                context.TransactionCategories.Add(tc);
            }
            if (!context.TransactionCategories.Any(p => p.Category == "Hobby"))
            {
                var tc = new TransactionCategory();
                tc.Category = "Hobby";
                context.TransactionCategories.Add(tc);
            }

            // BUDGETPLAN CATEGORIES - !!!! DO *NOT* *NOT* *NOT* CHANGE THE ORDER OF THESE !!!!
            if (!context.BudgetPlanCategories.Any(p => p.Category == "Housing"))
            {
                var bpc = new BudgetPlanCategory();
                bpc.Category = "Housing";
                context.BudgetPlanCategories.Add(bpc);
            }
            if (!context.BudgetPlanCategories.Any(p => p.Category == "Transportation"))
            {
                var bpc = new BudgetPlanCategory();
                bpc.Category = "Transportation";
                context.BudgetPlanCategories.Add(bpc);
            }
            if (!context.BudgetPlanCategories.Any(p => p.Category == "Food"))
            {
                var bpc = new BudgetPlanCategory();
                bpc.Category = "Food";
                context.BudgetPlanCategories.Add(bpc);
            }
            if (!context.BudgetPlanCategories.Any(p => p.Category == "Entertainment"))
            {
                var bpc = new BudgetPlanCategory();
                bpc.Category = "Entertainment";
                context.BudgetPlanCategories.Add(bpc);
            }
            if (!context.BudgetPlanCategories.Any(p => p.Category == "Savings"))
            {
                var bpc = new BudgetPlanCategory();
                bpc.Category = "Savings";
                context.BudgetPlanCategories.Add(bpc);
            }
            if (!context.BudgetPlanCategories.Any(p => p.Category == "Debt"))
            {
                var bpc = new BudgetPlanCategory();
                bpc.Category = "Debt";
                context.BudgetPlanCategories.Add(bpc);
            }
            if (!context.BudgetPlanCategories.Any(p => p.Category == "Healthcare"))
            {
                var bpc = new BudgetPlanCategory();
                bpc.Category = "Healthcare";
                context.BudgetPlanCategories.Add(bpc);
            }
            if (!context.BudgetPlanCategories.Any(p => p.Category == "Education"))
            {
                var bpc = new BudgetPlanCategory();
                bpc.Category = "Education";
                context.BudgetPlanCategories.Add(bpc);
            }
            if (!context.BudgetPlanCategories.Any(p => p.Category == "Personal"))
            {
                var bpc = new BudgetPlanCategory();
                bpc.Category = "Personal";
                context.BudgetPlanCategories.Add(bpc);
            }
            if (!context.BudgetPlanCategories.Any(p => p.Category == "Childcare"))
            {
                var bpc = new BudgetPlanCategory();
                bpc.Category = "Childcare";
                context.BudgetPlanCategories.Add(bpc);
            }
            if (!context.BudgetPlanCategories.Any(p => p.Category == "Miscellaneous"))
            {
                var bpc = new BudgetPlanCategory();
                bpc.Category = "Miscellaneous";
                context.BudgetPlanCategories.Add(bpc);
            }

            // FREQUENCY CATEGORIES
            if (!context.FrequencyCategories.Any(p => p.Frequency == "Monthly"))
            {
                var fc = new FrequencyCategory();
                fc.Frequency = "Monthly";
                context.FrequencyCategories.Add(fc);
            }
            if (!context.FrequencyCategories.Any(p => p.Frequency == "Annually"))
            {
                var fc = new FrequencyCategory();
                fc.Frequency = "Annually";
                context.FrequencyCategories.Add(fc);
            }
            if (!context.FrequencyCategories.Any(p => p.Frequency == "Weekly"))
            {
                var fc = new FrequencyCategory();
                fc.Frequency = "Weekly";
                context.FrequencyCategories.Add(fc);
            }
            if (!context.FrequencyCategories.Any(p => p.Frequency == "Biweekly "))
            {
                var fc = new FrequencyCategory();
                fc.Frequency = "Biweekly";
                context.FrequencyCategories.Add(fc);
            }
            if (!context.FrequencyCategories.Any(p => p.Frequency == "Bimonthly"))
            {
                var fc = new FrequencyCategory();
                fc.Frequency = "Bimonthly";
                context.FrequencyCategories.Add(fc);
            }
        }
コード例 #21
0
 public static ExpenseCategory ToEntity(this ExpenseCategoryModel model, ExpenseCategory destination)
 {
     return(model.MapTo(destination));
 }
コード例 #22
0
ファイル: DBHelper.cs プロジェクト: Fateblade/Booky
        internal static ExpenseCategory SaveExpenseCategory(ExpenseCategory data)
        {
            using (SqlConnection con = new SqlConnection(_ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("dbo.ExpenseCategoriesSave", con);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter idParam = cmd.Parameters.Add("@ID", SqlDbType.Int);
                idParam.Value = data.ID;
                SqlParameter nameParam = cmd.Parameters.Add("@Name", SqlDbType.VarChar, 80);
                nameParam.Value = data.Name;

                con.Open();
                SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);

                while (reader.Read())
                {
                    data = readExpenseCategory(reader);
                }

                reader.Close();
            }

            return data;
        }
コード例 #23
0
 public async Task DeleteExpenseCategoryAsync(ExpenseCategory expenseCategory)
 {
     _unitOfWork.ExpenseCategoryRepository.Remove(expenseCategory);
     await _unitOfWork.Complete();
 }
コード例 #24
0
ファイル: DBHelper.cs プロジェクト: Fateblade/Booky
        internal static bool DeleteExpenseCategories(ExpenseCategory data)
        {
            bool retData = false;

            using (SqlConnection con = new SqlConnection(_ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("dbo.ExpenseCategoryDelete", con);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter idParam = cmd.Parameters.Add("@ID", SqlDbType.Int);
                idParam.Value = data.ID;

                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();
                retData = true;
            }

            return retData;
        }
コード例 #25
0
        private static ExpenseCategory ConvertFrom_Entity_To_HouseModel(ExpenseCategoryEf entity, ExpenseCategory model)
        {
            var instance = model ?? new ExpenseCategory();

            instance.Id          = entity.Id;
            instance.Name        = entity.Name;
            instance.Description = entity.Description;

            return(instance);
        }
コード例 #26
0
ファイル: CashFlow.cs プロジェクト: QualitySolution/Vodovoz
        private void FineIds(IList<int> result, ExpenseCategory cat)
        {
            result.Add(cat.Id);
            if (cat.Childs == null)
                return;

            foreach(var childCat in cat.Childs)
            {
                FineIds(result, childCat);
            }
        }
コード例 #27
0
 public void Create(ExpenseCategory item)
 {
     item = Context.ExpenseCategories.Add(item);
     Context.SaveChanges();
 }
コード例 #28
0
 public void Category_Throws_If_Name_Is_Null()
 {
     var c = new ExpenseCategory(0, null);
 }
コード例 #29
0
 public void Save(ExpenseCategory expenseCategory)
 {
     _repository.Save(expenseCategory);
 }
コード例 #30
0
        public static TR Map <T, TR>(T sourceObject) where T : class where TR : class
        {
            if (sourceObject == null)
            {
                return(null);
            }
            Type myType = typeof(T);

            if (myType == typeof(ExpenseCategory))
            {
                var objItem = new ExpenseManager.EF.ExpenseCategory();
                var myItem  = sourceObject as ExpenseCategory;
                if (myItem == null)
                {
                    return(null);
                }
                ;
                try
                {
                    objItem.ExpenseCategoryId = myItem.ExpenseCategoryId;

                    objItem.Title = myItem.Title;

                    objItem.Code = myItem.Code;

                    objItem.Status = myItem.Status;
                }
                catch (Exception ex)
                {
                    return(new ExpenseCategory() as TR);
                }
                return(objItem as TR);
            }
            if (myType == typeof(ExpenseManager.EF.ExpenseCategory))
            {
                var objItem = new ExpenseCategory();
                var myItem  = sourceObject as ExpenseManager.EF.ExpenseCategory;
                if (myItem == null)
                {
                    return(null);
                }
                ;
                try
                {
                    objItem.ExpenseCategoryId = myItem.ExpenseCategoryId;

                    objItem.Title = myItem.Title;

                    objItem.Code = myItem.Code;

                    objItem.Status = myItem.Status;

                    #region Included Tables
                    #endregion
                }
                catch (Exception ex)
                {
                    return(new ExpenseCategory() as TR);
                }
                return(objItem as TR);
            }
            return(null);
        }
コード例 #31
0
 public void Create(ExpenseCategory expenseCategory)
 {
     _context.ExpenseCategories.Add(expenseCategory);
     _context.SaveChanges();
 }
コード例 #32
0
 public void Create(ExpenseCategory expenseCategory)
 {
     _repository.Create(expenseCategory);
 }
コード例 #33
0
 public static void Add(string descrip, decimal amount, DateTime expDate, ExpenseCategory expcat)
 {
     App.GlobalBudget.AddExpense(descrip, amount, expDate, expcat);
 }
コード例 #34
0
        public void ExpenseCategoryRepository_Save_New_Item_With_Non_Zero_Id_Does_Nothing()
        {
            var mock = RepositoryMocks.GetMockExpenseCategoryRepository();

            var before = mock.GetAll();
            Assert.IsTrue(before.Count() == 0);

            var expected = mock.GetById(baseTestData.Id);
            Assert.IsNull(expected);
            expected = new ExpenseCategory(1, "save-test");
            mock.Save(expected);

            var after = mock.GetAll();
            Assert.IsTrue(after.Count() == 0);
        }
コード例 #35
0
        public async Task CreateExpenseCategoryAsync_ReturnsANewExpenseCategory()
        {
            _todelete = await Api.CreateExpenseCategoryAsync("Test Create Expense Category");

            Assert.Equal("Test Create Expense Category", _todelete.Name);
        }
コード例 #36
0
        public void ExpenseCategpryRepository_Save_Id_Zero_Adds_Item()
        {
            var mock = RepositoryMocks.GetMockExpenseCategoryRepository();
            var before = mock.GetAll();
            Assert.IsTrue(before.Count() == 0);

            var newItem = new ExpenseCategory(0, "test");
            mock.Save(newItem);

            var after = mock.GetAll();
            Assert.IsTrue(after.Contains(newItem));
        }
コード例 #37
0
        public void CreateExpenseCategory_ReturnsANewExpenseCategory()
        {
            _todelete = Api.CreateExpenseCategory("Test Create Expense Category");

            Assert.Equal("Test Create Expense Category", _todelete.Name);
        }
コード例 #38
0
 public void Create(ExpenseCategory expenseCategory)
 {
     _context.ExpenseCategories.Add(expenseCategory);
     _context.SaveChanges();
 }
コード例 #39
0
ファイル: AdvanceReportDlg.cs プロジェクト: Enzogord/Vodovoz
 public AdvanceReportDlg(Employee accountable, ExpenseCategory expenseCategory, decimal money) : this()
 {
     Entity.Accountable     = accountable;
     Entity.ExpenseCategory = expenseCategory;
     Entity.Money           = money;
 }