Exemple #1
0
        private static List <LoanType> LoadLoanTypes(CollectionWeek collectionWeek)
        {
            List <LoanType> loanTypes = new List <LoanType>();

            loanTypes.Add(
                new LoanType()
            {
                LoanTypeId         = Guid.NewGuid().ToString(),
                Code               = "26D40P",
                Description        = "26 Cuotas diarias, 40% de interés total",
                InstallmentsAmount = 26,
                InterestPercentage = 40,
                CollectionWeekId   = collectionWeek.CollectionWeekId
            });
            loanTypes.Add(
                new LoanType()
            {
                LoanTypeId         = Guid.NewGuid().ToString(),
                Code               = "20D30P",
                Description        = "20 Cuotas diarias, 30% de interés total",
                InstallmentsAmount = 20,
                InterestPercentage = 30,
                CollectionWeekId   = collectionWeek.CollectionWeekId
            });
            return(loanTypes);
        }
Exemple #2
0
        //Siembra de datos:
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            List <Zone> zones = new List <Zone>();

            zones.Add(
                new Zone {
                ZoneId = Guid.NewGuid().ToString(),
                Code   = "TOR",
                Name   = "Tortuguitas, Malvinas Argentinas, Bs. As",
            });
            zones.Add(
                new Zone {
                ZoneId = Guid.NewGuid().ToString(),
                Code   = "GAR",
                Name   = "Garin, Escobar, Bs. As",
            });
            List <DebtCollector> debtCollectors = new List <DebtCollector>();

            debtCollectors.Add(
                new DebtCollector {
                Birthdate       = Convert.ToDateTime("12/4/1980 12:10:15 PM", new CultureInfo("en-US")),
                DebtCollectorId = Guid.NewGuid().ToString(),
                CellPhone       = "115521-3345",
                Name            = "Martín",
                SurName         = "Gomez",
                OptionalContact = "*****@*****.**"
            }
                );
            debtCollectors.Add(
                new DebtCollector {
                Birthdate       = Convert.ToDateTime("12/12/1987 12:10:15 PM", new CultureInfo("en-US")),
                DebtCollectorId = Guid.NewGuid().ToString(),
                CellPhone       = "115521-2555",
                Name            = "Gabriel",
                SurName         = "Rojo",
                OptionalContact = "*****@*****.**"
            }
                );


            var collectionWeek = new CollectionWeek()
            {
                CollectionWeekId = Guid.NewGuid().ToString(),
                Code             = "LuSa",
                Description      = "Lunes a Sabados, sin feriados",
                Monday           = true,
                Tuesday          = true,
                Wednesday        = true,
                Thursday         = true,
                Friday           = true,
                Saturday         = true,
                Sunday           = false,
                Holiday          = false
            };

            var holidays = new List <Holyday>();

            holidays.Add(new Holyday()
            {
                HolydayId   = Guid.NewGuid().ToString(),
                Description = "Día del Trabajador",
                Date        = Convert.ToDateTime("5/1/2019", new CultureInfo("en-US"))
            });
            holidays.Add(new Holyday()
            {
                HolydayId   = Guid.NewGuid().ToString(),
                Description = "Conmemoración de General Don Martín Miguel de Güemes",
                Date        = Convert.ToDateTime("6/17/2019", new CultureInfo("en-US"))
            });
            holidays.Add(new Holyday()
            {
                HolydayId   = Guid.NewGuid().ToString(),
                Description = "Paso a la Inmortalidad del General Manuel Belgrano",
                Date        = Convert.ToDateTime("6/20/2019", new CultureInfo("en-US"))
            });

            List <LoanType> loanTypes = LoadLoanTypes(collectionWeek);

            var filteredDebtCollectors = debtCollectors.Where(x => x.Name == "Gabriel");
            var route = new Route()
            {
                RouteId         = Guid.NewGuid().ToString(),
                DebtCollectorId = filteredDebtCollectors.FirstOrDefault().DebtCollectorId,
                Code            = "ClientesGabriel",
                Name            = "Lista Clientes Gabriel"
            };

            List <Customer> customers = GenerateRandomCustomers(route, 50);
            List <Address>  addresses = LoadAddresses(customers);



            modelBuilder.Entity <CollectionWeek>().HasData(collectionWeek);
            modelBuilder.Entity <Holyday>().HasData(holidays.ToArray());

            modelBuilder.Entity <Zone>().HasData(zones.ToArray());
            modelBuilder.Entity <DebtCollector>().HasData(debtCollectors.ToArray());

            modelBuilder.Entity <Route>().HasData(route);
            modelBuilder.Entity <Customer>().HasData(customers.ToArray());
            modelBuilder.Entity <Address>().HasData(addresses.ToArray());
            modelBuilder.Entity <LoanType>().HasData(loanTypes.ToArray());
        }