Esempio n. 1
0
        public static void Main(string[] args)
        {
            var host = CreateHostBuilder(args).Build();

            using (var scope = host.Services.CreateScope())
            {
                IServiceProvider services  = scope.ServiceProvider;
                SATContext       context   = services.GetRequiredService <SATContext>();
                IEncryptor       encryptor = services.GetRequiredService <IEncryptor>();

                DummyData dummyData = new DummyData();
                dummyData.Initialize(context, encryptor);
            }

            host.Run();
        }
Esempio n. 2
0
 public AuthService(SATContext context) : base(context)
 {
 }
Esempio n. 3
0
 public Service(SATContext context)
 {
     this.context = context;
 }
Esempio n. 4
0
 public EmployeesController(SATContext context)
 {
     this.context = context;
 }
Esempio n. 5
0
 public AuthenticateController(SATContext dbContext, IEncryptor encryptor)
 {
     this.dbContext   = dbContext;
     this.encryptor   = encryptor;
     this.userManager = new UserManager(dbContext, encryptor);
 }
 public TechnicalAssistanceController(SATContext context) : base(context)
 {
 }
Esempio n. 7
0
        public void Initialize(SATContext context, IEncryptor encryptor)
        {
            if (!context.Users.Any())
            {
                context.Users.Add(
                    new User()
                {
                    Username = "******",
                    Password = encryptor.encrypt("123"),
                    Email    = "*****@*****.**",
                    Rol      = new Rol()
                    {
                        RolId   = RolId.SOPORTE_SISTEMAS,
                        RolName = "Soporte de sistemas"
                    },
                    IsActive = true
                });
            }

            if (!context.Provinces.Any())
            {
                Province managua = new Province()
                {
                    ProvinceName = "Managua"
                };
                Province nuevaSegovia = new Province()
                {
                    ProvinceName = "NuevaSegovia"
                };
                Province esteli = new Province()
                {
                    ProvinceName = "Esteli"
                };
                Province matagalpa = new Province()
                {
                    ProvinceName = "Matagalpa"
                };
                Province leon = new Province()
                {
                    ProvinceName = "Leon"
                };

                Municipality tipitapa = new Municipality()
                {
                    MunicipalityName = "Tipitapa"
                };
                Municipality managuaCabecera = new Municipality()
                {
                    MunicipalityName = "Managua"
                };

                List <Municipality> municipalities = new List <Municipality>()
                {
                    tipitapa, managuaCabecera
                };

                managua.Municipalities = municipalities;

                Municipality ocotal = new Municipality()
                {
                    MunicipalityName = "Ocotal"
                };
                Municipality jalapa = new Municipality()
                {
                    MunicipalityName = "Jalapa"
                };

                nuevaSegovia.Municipalities = new List <Municipality>()
                {
                    ocotal, jalapa
                };

                Municipality cabeceraEsteli = new Municipality()
                {
                    MunicipalityName = "Esteli"
                };
                Municipality condega = new Municipality()
                {
                    MunicipalityName = "Condega"
                };

                esteli.Municipalities = new List <Municipality>()
                {
                    cabeceraEsteli, condega
                };

                Municipality leonCabecera = new Municipality()
                {
                    MunicipalityName = "Leon"
                };
                Municipality larreynaga = new Municipality()
                {
                    MunicipalityName = "Larreynaga"
                };

                leon.Municipalities = new List <Municipality>()
                {
                    leonCabecera, larreynaga
                };

                Branch asososca = new Branch()
                {
                    BranchName = "Asososca", Municipality = managuaCabecera
                };
                Branch altamira = new Branch()
                {
                    BranchName = "Altamira", Municipality = managuaCabecera
                };
                Branch sucursalOcotal = new Branch()
                {
                    BranchName = "Ocotal", Municipality = ocotal
                };
                Branch sucursalEsteli = new Branch()
                {
                    BranchName = "Esteli", Municipality = cabeceraEsteli
                };
                Branch sucursalLeon = new Branch()
                {
                    BranchName = "Leon", Municipality = leonCabecera
                };

                context.Provinces.Add(managua);
                context.Provinces.Add(nuevaSegovia);
                context.Provinces.Add(esteli);
                context.Provinces.Add(matagalpa);
                context.Provinces.Add(leon);

                context.Branches.Add(asososca);
                context.Branches.Add(altamira);
                context.Branches.Add(sucursalOcotal);
                context.Branches.Add(sucursalEsteli);
                context.Branches.Add(sucursalLeon);
            }

            if (!context.Source.Any())
            {
                context.Source.Add(new Source()
                {
                    SourceName = "(AV) AquaVisum", TaskType = TaskType.AsistenciaTecnica, IsActive = true
                });
                context.Source.Add(new Source()
                {
                    SourceName = "(SCI) Sistema de Inventario", TaskType = TaskType.AsistenciaTecnica, IsActive = true
                });
            }

            context.SaveChanges();
        }
Esempio n. 8
0
 public TaskController(SATContext context)
 {
     this.context = context;
 }
Esempio n. 9
0
 public UserManager(SATContext dbContext, IEncryptor encryptor)
 {
     this.context   = dbContext;
     this.encryptor = encryptor;
 }
Esempio n. 10
0
 public UserController(SATContext context)
 {
     this.context = context;
 }