Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Seed(Courier.Library.AccountingContext context)
- {
- //var startup = new AccountingLibrary.Models.Startup();
- //startup.Seed(context);
- var accountTypes = new List<AccountType>
- {
- new AccountType {Id = 2,Type = "Income",DispayName = "Sales"},
- new AccountType {Id = 5,Type = "Expense",DispayName = "Return Sales"},
- new AccountType {Id = 11,Type = "Expense",DispayName = "Manufacturing Expense",Real=false},
- new AccountType {Id = 21,Type = "Inventory",DispayName = "Opening Stock",Real = false},
- new AccountType {Id = 23,Type = "Inventory",DispayName = "Closing Stock",Real = false},
- new AccountType {Id = 24,Type = "Expense",DispayName = "Cost of Goods Manufactured",Real = false},
- new AccountType {Id = 25,Type = "Expense",DispayName = "Purchase"},
- new AccountType {Id = 27,Type = "Income",DispayName = "Return Purchase"},
- new AccountType {Id = 35,Type = "Expense",DispayName = "Expenses Operation"},
- new AccountType {Id = 41,Type = "Income",DispayName = "Non Operation Income"},
- new AccountType {Id = 43,Type = "Expense",DispayName = "Expenses Admin"},
- new AccountType {Id = 45,Type = "Expense",DispayName = "Expenses Marketing"},
- new AccountType {Id = 47,Type = "Expense",DispayName = "Expenses Financial"},
- new AccountType {Id = 51,Type = "Fixed Assets",DispayName = "Fixed Assets"},
- new AccountType {Id = 55,Type = "Current Assets",DispayName = "Current Assets"},
- new AccountType {Id = 57,Type = "Inventory",DispayName = "Inventories-Raw Material"},
- new AccountType {Id = 58,Type = "Inventory",DispayName = "Inventories-Work in Process"},
- new AccountType {Id = 59,Type = "Inventory",DispayName = "Inventories-Finished Goods"},
- new AccountType {Id = 60,Type = "Persoanl A/c",DispayName = "Personal A/c"},
- new AccountType {Id = 72,Type = "Bank",DispayName = "Bank"},
- new AccountType {Id = 75,Type = "Cash",DispayName = "Cash"},
- new AccountType {Id = 81,Type = "Long Term Liabilities",DispayName = "Long Term Liabilities"},
- new AccountType {Id = 83,Type = "Short term Liabilities",DispayName = "Short term Liabilities"},
- new AccountType {Id = 85,Type = "Persoanl A/c",DispayName = "Personal A/c",Real = false},
- new AccountType {Id = 91,Type = "Equity",DispayName = "Equity"},
- new AccountType {Id = 98,Type = "Dividend",DispayName = "Distribution of Income"},
- new AccountType {Id = 99,Type = "Acc P&L",DispayName = "Accumulated Profit & Loss"},
- };
- accountTypes.ForEach(a => context.AccountTypes.Add(a));
- context.SaveChanges();
- var roles = new List<Role>() {
- new Role{RoleId=Guid.NewGuid(), RoleName="Boss"},
- new Role{RoleId=Guid.NewGuid(), RoleName="Admin"},
- new Role{RoleId=Guid.NewGuid(), RoleName="CentralEntry"},
- new Role{RoleId=Guid.NewGuid(), RoleName="CentralEdit"},
- new Role{RoleId=Guid.NewGuid(), RoleName="LocalEntry"},
- new Role{RoleId=Guid.NewGuid(), RoleName="LocalEdit"},
- new Role{RoleId=Guid.NewGuid(), RoleName="Client"},
- new Role{RoleId=Guid.NewGuid(), RoleName="Delivery"},
- };
- roles.ForEach(a => context.Roles.Add(a));
- context.SaveChanges();
- var userRole = roles.Where(r => r.RoleName == "Boss").ToList();
- var u = new User()
- {
- UserId = Guid.NewGuid(),
- Username = "BossUser",
- Password = Crypto.HashPassword("bosspass"),
- Roles = userRole,//(ICollection<Role>)roles.Where(r => r.RoleName == "Boss"),
- Privilege = 1,
- };
- context.Users.Add(u);
- context.SaveChanges();
- var newdate = new DateTime(2015, 1, 1);
- var c = new Company()
- {
- Name = "Meghswar Courier",
- SoftStartDate = newdate,
- YearStartDate = newdate,
- DataClosedUpto = newdate,
- LicencedUpto=newdate,
- CType = 1,
- Id = 1,
- };
- context.Companies.Add(c);
- context.SaveChanges();
- userRole = roles.Where(r => r.RoleName == "Admin").ToList();
- u = new User()
- {
- UserId = Guid.NewGuid(),
- Username = "Admin",
- Password = Crypto.HashPassword("1234"),
- CompanyId=1,
- Roles = userRole,//(ICollection<Role>)roles.Where(r => r.RoleName == "Admin"),
- Privilege=2,
- };
- context.Users.Add(u);
- context.SaveChanges();
- var accounts = new List<Account>()
- {
- new Account(){AccountName="Accumulated Profit and Loss",AccountTypeId=99},
- new Account(){AccountName="Cash",AccountTypeId=75},
- new Account(){AccountName="Cash-Junnun",AccountTypeId=75},
- new Account(){AccountName="Payment Collectable",AccountTypeId=83},
- new Account(){AccountName="Courier Fee",AccountTypeId=2},
- };
- foreach(var a in accounts)
- {
- a.CompanyId = 1;
- a.Editable = false;
- a.CreatorId = u.UserId;
- context.Accounts.Add(a);
- }
- context.SaveChanges();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement