public AddressTypeDbSeed(SgConContext context) : base(context) { if (!context.AddressesTypes.Any()) { List <AddressType> listAddressesTypes = new List <AddressType>(); AddressType addressTypeCondominium = new AddressType { Id = 1, Description = "Condomínio" }; listAddressesTypes.Add(addressTypeCondominium); AddressType addressTypeCompany = new AddressType { Id = 2, Description = "Empresa" }; listAddressesTypes.Add(addressTypeCompany); AddressType addressTypeEmployee = new AddressType { Id = 3, Description = "Funcionário" }; listAddressesTypes.Add(addressTypeEmployee); context.AddRange(listAddressesTypes); context.SaveChanges(); } }
public CommonAreaDbSeed(SgConContext context) : base(context) { if (!context.CommonAreas.Any()) { List <CommonArea> commonArea = new List <CommonArea>(); CommonArea commonAreaOne = new CommonArea { Id = 1, CondominiumId = 1, Name = "Área 1", Description = "Área de lazer 1", Capacity = 20, IntervalTime = 60 }; commonArea.Add(commonAreaOne); CommonArea commonAreaTwo = new CommonArea { Id = 2, CondominiumId = 1, Name = "Área 2", Description = "Área de lazer 2", Capacity = 20, IntervalTime = 30 }; commonArea.Add(commonAreaTwo); context.AddRange(commonArea); context.SaveChanges(); } }
public TowerDbSeed(SgConContext context) : base(context) { if (!context.Towers.Any()) { List <Tower> towers = new List <Tower>(); Tower towerOne = new Tower { Id = 1, Block = "Bloco A", CondominiumId = 1, FloorsNumber = 20, CreatedBy = "Sistema", CreatedAt = DateTime.Now }; towers.Add(towerOne); Tower towerTwo = new Tower { Id = 2, Block = "Bloco B", CondominiumId = 1, FloorsNumber = 20, CreatedBy = "Sistema", CreatedAt = DateTime.Now }; towers.Add(towerTwo); Tower towerThree = new Tower { Id = 3, Block = "Bloco A", CondominiumId = 2, FloorsNumber = 20, CreatedBy = "Sistema", CreatedAt = DateTime.Now }; towers.Add(towerThree); Tower towerFour = new Tower { Id = 4, Block = "Bloco B", CondominiumId = 2, FloorsNumber = 20, CreatedBy = "Sistema", CreatedAt = DateTime.Now }; towers.Add(towerFour); context.AddRange(towers); context.SaveChanges(); } }
public ProfileDbSeed(SgConContext context) : base(context) { if (!context.Profiles.Any()) { List <Profile> profiles = new List <Profile>(); Profile adminProfile = new Profile { Id = 1, Name = "Administrador", Description = "Administrador", Role = context.Roles.Find(1), CreatedBy = "Sistema", CreatedAt = DateTime.Now }; profiles.Add(adminProfile); Profile employeeProfile = new Profile { Id = 2, Name = "Funcionário", Description = "Funcionário", Role = context.Roles.Find(2), CreatedBy = "Sistema", CreatedAt = DateTime.Now }; profiles.Add(employeeProfile); Profile residentProfile = new Profile { Id = 3, Name = "Morador", Description = "Morador", Role = context.Roles.Find(3), CreatedBy = "Sistema", CreatedAt = DateTime.Now }; profiles.Add(residentProfile); //Profile profileResident = new Profile //{ // Id = 4, // Name = "Morador", // Description = "Morador", // Role = context.Roles.Find(3), // CreatedBy = "Sistema", // CreatedAt = DateTime.Now //}; //profiles.Add(profileResident); context.AddRange(profiles); context.SaveChanges(); } }
public ApartmentDbSeed(SgConContext context) : base(context) { if (!context.Apartments.Any()) { List <Apartment> apartments = new List <Apartment>(); Apartment apartmentOne = new Apartment { Number = "10", Floor = "1", TowerId = 1, CreatedBy = "Sistema", CreatedAt = DateTime.Now }; apartments.Add(apartmentOne); Apartment apartmentTwo = new Apartment { Number = "11", Floor = "1", TowerId = 1, CreatedBy = "Sistema", CreatedAt = DateTime.Now }; apartments.Add(apartmentTwo); Apartment apartmentThree = new Apartment { Number = "20", Floor = "2", TowerId = 1, CreatedBy = "Sistema", CreatedAt = DateTime.Now }; apartments.Add(apartmentThree); Apartment apartmentFour = new Apartment { Number = "21", Floor = "2", TowerId = 1, CreatedBy = "Sistema", CreatedAt = DateTime.Now }; apartments.Add(apartmentFour); context.AddRange(apartments); context.SaveChanges(); } }
public CompanyDbSeed(SgConContext context) : base(context) { if (!context.Companies.Any()) { List <Company> companies = new List <Company>(); Company companyOne = new Company { Id = 1, Name = "Empresa 1", Cnpj = "85351161000182", Email = "*****@*****.**", DDDComercialPhone = "11", ComercialPhone = "12345678", Address = context.Addresses.Find(3), CreatedBy = "Sistema", CreatedAt = DateTime.Now }; companies.Add(companyOne); Company companyTwo = new Company { Id = 2, Name = "Empresa 2", Cnpj = "85351161000182", Email = "*****@*****.**", DDDComercialPhone = "11", ComercialPhone = "12345678", Address = context.Addresses.Find(4), CreatedBy = "Sistema", CreatedAt = DateTime.Now }; companies.Add(companyTwo); context.AddRange(companies); context.SaveChanges(); } }
public RoleDbSeed(SgConContext context) : base(context) { if (!context.Roles.Any()) { List <Role> roles = new List <Role>(); Role roleAdministrator = new Role { Id = 1, Description = "Administrador", CreatedBy = "Sistema", CreatedAt = DateTime.Now }; roles.Add(roleAdministrator); Role roleEmployee = new Role { Id = 2, Description = "Funcionário", CreatedBy = "Sistema", CreatedAt = DateTime.Now }; roles.Add(roleEmployee); Role roleResident = new Role { Id = 3, Description = "Morador", CreatedBy = "Sistema", CreatedAt = DateTime.Now }; roles.Add(roleResident); context.AddRange(roles); context.SaveChanges(); } }
public AddressDbSeed(SgConContext context) : base(context) { if (!context.Addresses.Any()) { List <Address> listAddresses = new List <Address>(); Address addressCondominium = new Address { Id = 1, AddressType = context.AddressesTypes.Find(1), CEP = "05140060", Street = "Rua Genésio Arruda", Number = 500, Neighborhood = "Chácara Inglesa", City = "São Paulo", UF = "SP", CreatedBy = "Sistema", CreatedAt = DateTime.Now }; listAddresses.Add(addressCondominium); Address addressCondominiumTwo = new Address { Id = 2, AddressType = context.AddressesTypes.Find(1), CEP = "05140060", Street = "Rua Genésio Arruda", Number = 900, Neighborhood = "Chácara Inglesa", City = "São Paulo", UF = "SP", CreatedBy = "Sistema", CreatedAt = DateTime.Now }; listAddresses.Add(addressCondominiumTwo); Address addressCompany = new Address { Id = 3, AddressType = context.AddressesTypes.Find(2), CEP = "05440000", Street = "Rua Paulistânia", Number = 500, Neighborhood = "Sumarezinho", City = "São Paulo", UF = "SP", CreatedBy = "Sistema", CreatedAt = DateTime.Now }; listAddresses.Add(addressCompany); Address addressCompanyTwo = new Address { Id = 4, AddressType = context.AddressesTypes.Find(2), CEP = "05440000", Street = "Rua Paulistânia", Number = 700, Neighborhood = "Sumarezinho", City = "São Paulo", UF = "SP", CreatedBy = "Sistema", CreatedAt = DateTime.Now }; listAddresses.Add(addressCompanyTwo); Address addressEmployeeOne = new Address { Id = 5, AddressType = context.AddressesTypes.Find(3), CEP = "04003000", Street = "Rua Coronel Oscar Porto", Number = 70, Neighborhood = "Paraíso", City = "São Paulo", UF = "SP", CreatedBy = "Sistema", CreatedAt = DateTime.Now }; listAddresses.Add(addressEmployeeOne); Address addressEmployeeTwo = new Address { Id = 6, AddressType = context.AddressesTypes.Find(3), CEP = "04003000", Street = "Rua Coronel Oscar Porto", Number = 170, Neighborhood = "Paraíso", City = "São Paulo", UF = "SP", CreatedBy = "Sistema", CreatedAt = DateTime.Now }; listAddresses.Add(addressEmployeeTwo); Address addressEmployeeThree = new Address { Id = 7, AddressType = context.AddressesTypes.Find(3), CEP = "04003000", Street = "Rua Coronel Oscar Porto", Number = 270, Neighborhood = "Paraíso", City = "São Paulo", UF = "SP", CreatedBy = "Sistema", CreatedAt = DateTime.Now }; listAddresses.Add(addressEmployeeThree); context.AddRange(listAddresses); context.SaveChanges(); } }
public EmployeeDbSeed(SgConContext context) : base(context) { if (!context.Employees.Any()) { List <Employee> employees = new List <Employee>(); Employee managerEmployee = new Employee { Name = "Gerente", CPF = "65702551346", Email = "*****@*****.**", JobRole = "Gerente", UserName = "******", PassWord = "******", Profile = context.Profiles.Find(1), CreatedBy = "Sistema", CreatedAt = DateTime.Now, Address = context.Addresses.Find(5), DDDComercialPhone = "11", ComercialPhone = "12345678" }; employees.Add(managerEmployee); Employee managerAttendant = new Employee { Name = "Atendente", CPF = "65155881781", Email = "*****@*****.**", JobRole = "Atendente", UserName = "******", PassWord = "******", Profile = context.Profiles.Find(2), CreatedBy = "Sistema", CreatedAt = DateTime.Now, Address = context.Addresses.Find(6), DDDComercialPhone = "11", ComercialPhone = "12346789" }; employees.Add(managerAttendant); Employee managerAttendantTwo = new Employee { Name = "Atendente 2", CPF = "25405493490", Email = "*****@*****.**", JobRole = "Atendente", UserName = "******", PassWord = "******", Profile = context.Profiles.Find(2), CreatedBy = "Sistema", CreatedAt = DateTime.Now, Address = context.Addresses.Find(7), DDDComercialPhone = "11", ComercialPhone = "12347890" }; employees.Add(managerAttendantTwo); context.AddRange(employees); context.SaveChanges(); } }