Ejemplo n.º 1
0
        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();
            }
        }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
0
 public JwtFactory(
     JwtCurrentUserFactory jwtCurrentUserFactory,
     SgConContext context,
     IEmployeeRepository employeeRepository,
     IResidentRepository residentRepository)
 {
     _jwCurrentUsertFactory = jwtCurrentUserFactory;
     _context            = context;
     _employeeRepository = employeeRepository;
     _residentRepository = residentRepository;
 }
Ejemplo n.º 4
0
        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();
            }
        }
Ejemplo n.º 5
0
        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();
            }
        }
Ejemplo n.º 6
0
        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();
            }
        }
Ejemplo n.º 7
0
        public ResidentDbSeed(SgConContext context) : base(context)
        {
            if (!context.Residents.Any())
            {
                List <Resident> residents = new List <Resident>();

                Resident residentOne = new Resident
                {
                    Id                = 1,
                    Name              = "Morador 1",
                    CPF               = "59766767742",
                    Email             = "*****@*****.**",
                    UserName          = "******",
                    PassWord          = "******",
                    CreatedBy         = "Sistema",
                    CreatedAt         = DateTime.Now,
                    Profile           = context.Profiles.Find(3),
                    DDDComercialPhone = "11",
                    ComercialPhone    = "12345678",
                    Apartment         = context.Apartments.Find(1)
                };
                residents.Add(residentOne);

                Resident residentTwo = new Resident
                {
                    Id                = 2,
                    Name              = "Morador 2",
                    CPF               = "41362234478",
                    Email             = "*****@*****.**",
                    UserName          = "******",
                    PassWord          = "******",
                    CreatedBy         = "Sistema",
                    CreatedAt         = DateTime.Now,
                    Profile           = context.Profiles.Find(3),
                    DDDComercialPhone = "11",
                    ComercialPhone    = "12345678",
                    Apartment         = context.Apartments.Find(2)
                };
                residents.Add(residentTwo);

                context.Residents.AddRange(residents);
                context.SaveChanges();
            }
        }
Ejemplo n.º 8
0
        public CondominiumDbSeed(SgConContext context) : base(context)
        {
            if (!context.Condominiums.Any())
            {
                List <Condominium> condominiuns = new List <Condominium>();

                Condominium condominiumOne = new Condominium
                {
                    Id                = 1,
                    Name              = "Condomínio 1",
                    Cnpj              = "85351161000182",
                    Email             = "*****@*****.**",
                    DDDComercialPhone = "11",
                    ComercialPhone    = "12345678",
                    TowerNumber       = 2,
                    Address           = context.Addresses.Find(1),
                    CreatedBy         = "Sistema",
                    CreatedAt         = DateTime.Now
                };
                condominiuns.Add(condominiumOne);

                Condominium condominiumTwo = new Condominium
                {
                    Id                = 2,
                    Name              = "Condomínio 2",
                    Cnpj              = "85351161000182",
                    Email             = "*****@*****.**",
                    DDDComercialPhone = "11",
                    ComercialPhone    = "12345678",
                    TowerNumber       = 2,
                    Address           = context.Addresses.Find(2),
                    CreatedBy         = "Sistema",
                    CreatedAt         = DateTime.Now
                };
                condominiuns.Add(condominiumTwo);

                context.Condominiums.AddRange(condominiuns);
                context.SaveChanges();
            }
        }
Ejemplo n.º 9
0
        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();
            }
        }
Ejemplo n.º 10
0
        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();
            }
        }
Ejemplo n.º 11
0
 public ApartmentRepository(SgConContext context) : base(context)
 {
 }
Ejemplo n.º 12
0
 public ResidentRepository(SgConContext context) : base(context)
 {
 }
Ejemplo n.º 13
0
        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 CommonAreaScheduleRepository(SgConContext context) : base(context)
 {
 }
Ejemplo n.º 15
0
 public PoliciesDbSeed(SgConContext context) : base(context)
 {
     if (!context.Policies.Any())
     {
     }
 }
Ejemplo n.º 16
0
 public BaseDataService(SgConContext context)
 {
     this.context = context;
 }
Ejemplo n.º 17
0
 public EmployeeRepository(SgConContext context, IAddressRepository addressRepository) : base(context)
 {
     _addressRepository = addressRepository;
 }
Ejemplo n.º 18
0
        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();
            }
        }
Ejemplo n.º 19
0
 public CondominiumRepository(
     SgConContext context,
     IAddressRepository addressRepository) : base(context)
 {
     _addressRepository = addressRepository;
 }
Ejemplo n.º 20
0
 public AddressRepository(SgConContext context) : base(context)
 {
 }
Ejemplo n.º 21
0
 public TowerRepository(SgConContext context) : base(context)
 {
 }
Ejemplo n.º 22
0
 public CompanyRepository(
     SgConContext context,
     IAddressRepository addressRepository) : base(context)
 {
     _addressRepository = addressRepository;
 }
Ejemplo n.º 23
0
 public DbSeedBase(SgConContext context)
 {
     Context = context;
 }
Ejemplo n.º 24
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, SgConContext context, JwtFactory jwtFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            DbInitializer.Initialize(context);

            jwtFactory.InitJwt(app, Configuration, _signingKey);

            app.UseMvc();

            //app.UseSwagger();

            //app.UseSwaggerUI(c =>
            //{
            //    c.SwaggerEndpoint("/swagger/v1/swagger.json", "SIT API V1");
            //});
        }