Beispiel #1
0
        public void SeedEverything(AccountingDatabaseService context)
        {
            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            if (context.AccountType.Any())
            {
                return; // Db has been seeded
            }

            SeedAccountType(context);
            SeedSystemLookup(context);
            SeedLedgerEntries(context);

            context.SaveChanges();
        }
Beispiel #2
0
        public void SeedAccountType(AccountingDatabaseService database)
        {
            var accountType = new [] {
                new AccountType()
                {
                    Id = 10, Type = "Asset", TypeOf = 0
                },
                new AccountType()
                {
                    Id = 12, Type = "Liability", TypeOf = 0
                },
                new AccountType()
                {
                    Id = 13, Type = "Capital", TypeOf = 0
                },
                new AccountType()
                {
                    Id = 14, Type = "Revenue", TypeOf = 0
                },
                new AccountType()
                {
                    Id              = 15,
                    Type            = "Expence", TypeOf = 0,
                    AccountCatagory = new [] {
                        new AccountCatagory()
                        {
                            Id = 2, Catagory = "Cash Account", DateAdded = DateTime.Now, DateUpdated = DateTime.Now
                        },
                        new AccountCatagory()
                        {
                            Id = 3, Catagory = "COGE", DateAdded = DateTime.Now, DateUpdated = DateTime.Now
                        },
                    }
                },
            };

            database.AccountType.AddRange(accountType);
        }
Beispiel #3
0
 public void SeedLedgerEntries(AccountingDatabaseService database)
 {
     database.Save();
 }
Beispiel #4
0
 public void SeedSystemLookup(AccountingDatabaseService database)
 {
 }
Beispiel #5
0
        public static void Initialize(AccountingDatabaseService context)
        {
            var initializer = new AccountingDatabaseInitializer();

            initializer.SeedEverything(context);
        }