Exemplo n.º 1
0
        protected override void Seed(CashRegisterContext context)
        {
            var enumToLookup = new EnumToLookup();

            enumToLookup.Apply(context);
            base.Seed(context);
        }
        protected override void Seed(LogDbContext context)
        {
            var enumToAdd    = new EnumToLookup();
            var migrationSql = enumToAdd.GenerateMigrationSql(context);

            enumToAdd.Apply(context);
            base.Seed(context);
        }
Exemplo n.º 3
0
        protected override void Seed(HangManContext context)
        {
            var enumToLookup = new EnumToLookup()
            {
                TableNamePrefix = null
            };

            enumToLookup.Apply(context);
        }
Exemplo n.º 4
0
        protected override void Seed(CarsalesDbContext context)
        {
            using (var dbContext = new CarsalesDbContext())
            {
                var enumToLookup = new EnumToLookup();
                enumToLookup.NameFieldLength = 25;
                enumToLookup.TableNamePrefix = string.Empty;
                enumToLookup.Apply(dbContext);

                //using (var roleStore = new RoleStore<Role, long, UserRole>(dbContext))
                //{
                //    using (var roleManager = new RoleManager<Role, long>(roleStore))
                //    {
                //        roleManager.Create(new Role
                //        {
                //            Id = 1,
                //            Name = "Administrator"
                //        });

                //        roleManager.Create(new Role
                //        {
                //            Id = 2,
                //            Name = "User"
                //        });

                //        roleManager.Create(new Role
                //        {
                //            Id = 3,
                //            Name = "CustomManager"
                //        });
                //    }
                //}

                //using (var userStore = new CarsalesUserStore(dbContext))
                //{
                //    using (var userManager = new CarsalesUserManager(userStore))
                //    {
                //        var user = new User
                //        {
                //            Email = "*****@*****.**",
                //            EmailConfirmed = true,
                //            PhoneNumber = "0430501022",
                //            PhoneNumberConfirmed = true,
                //            AccessFailedCount = 0,
                //            LockoutEnabled = false,
                //            UserName = "******",
                //            SecurityStamp = "7668b7bc-7a5d-4b3b-8388-f2e5c59f3d43",
                //            PasswordHash = "ABJ1bxk+trJ6PTk4iCBSq/WLDVmhI455FFxZbcXHtH1Xw2NyTKHsJmrWQ1Mbl7S4SQ=="
                //        };
                //        userManager.Create(user);
                //        userManager.AddToRole(user.Id, "Administrator");
                //    }
                //}

                dbContext.SaveChanges();
            }
        }
Exemplo n.º 5
0
        public void ExampleOfUsingApply()
        {
            using (var context = new MyDbContext())
            {
                var enumToLookup = new EnumToLookup();
                enumToLookup.NameFieldLength = 42;                 // optional, example of how to override default values

                // This would normally be run inside either a db initializer Seed()
                // or the migration Seed() method which both provide access to a context.
                enumToLookup.Apply(context);
            }
        }
Exemplo n.º 6
0
        public void ExampleOfUsingApply()
        {
            var enumToLookup = new EnumToLookup();

            // enumToLookup.NameFieldLength = 42; // optional, example of how to override default values
            //This will prevent spliiting the words
            enumToLookup.SplitWords = false;

            //Table prefix
            enumToLookup.TableNamePrefix = "CAPS_E";

            // This would normally be run inside either a db initializer Seed()
            // or the migration Seed() method which both provide access to a context.
            enumToLookup.Apply(_context);
        }
Exemplo n.º 7
0
        protected override void Seed(Domain.Models.ApplicationDbContext context)
        {
            var enumToLookup = new EnumToLookup();

            enumToLookup.Apply(context);
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //
        }
Exemplo n.º 8
0
        protected override void Seed(STM.Common.DataAccess.StmDbContext context)
        {
            //throw new Exception();
            var mt1 = new MessageType
            {
                Name      = "RTZ",
                SchemaXSD = "rtz.xsd"
            };

            var mt2 = new MessageType
            {
                Name      = "TXT",
                SchemaXSD = "textMessageSchema.xsd"
            };

            var mt3 = new MessageType
            {
                Name      = "S124",
                SchemaXSD = "s124.xsd"
            };

            var mt4 = new MessageType
            {
                Name      = "PCM",
                SchemaXSD = "port-call-message_v0.16.xsd"
            };

            if (!context.MessageType.Any())
            {
                context.MessageType.Add(mt1);
                context.MessageType.Add(mt2);
                context.MessageType.Add(mt3);
                context.MessageType.Add(mt4);

                context.SaveChanges();
            }

            var enumToAdd    = new EnumToLookup();
            var migrationSql = enumToAdd.GenerateMigrationSql(context);

            enumToAdd.Apply(context);

            base.Seed(context);
        }
Exemplo n.º 9
0
        protected override void Seed(Models.StripeOnboardingContext context)
        {
            var enumToLookup = new EnumToLookup();

            enumToLookup.Apply(context);
        }
Exemplo n.º 10
0
        protected override void Seed(LynexDbContext context)
        {
            using (var dbContext = new LynexDbContext())
            {
                var enumToLookup = new EnumToLookup();
                enumToLookup.NameFieldLength = 25;
                enumToLookup.TableNamePrefix = string.Empty;
                enumToLookup.Apply(dbContext);

                using (var roleStore = new RoleStore <Role, string, UserRole>(dbContext))
                {
                    using (var roleManager = new RoleManager <Role>(roleStore))
                    {
                        roleManager.Create(new Role
                        {
                            Id   = Guid.NewGuid().ToString(),
                            Name = "Administrator"
                        });

                        roleManager.Create(new Role
                        {
                            Id   = Guid.NewGuid().ToString(),
                            Name = "User"
                        });

                        roleManager.Create(new Role
                        {
                            Id   = Guid.NewGuid().ToString(),
                            Name = "CustomManager"
                        });
                    }
                }

                using (var userStore = new LynexUserStore(dbContext))
                {
                    using (var userManager = new LynexUserManager(userStore))
                    {
                        var user = new User("0efc7c0b-e378-4fc7-9e48-af184f78ee03")
                        {
                            Email                = "*****@*****.**",
                            EmailConfirmed       = true,
                            Phone                = "0430501022",
                            PhoneNumber          = "0430501022",
                            PhoneNumberConfirmed = true,
                            AccessFailedCount    = 0,
                            LockoutEnabled       = false,
                            UserName             = "******",
                            SecurityStamp        = "7668b7bc-7a5d-4b3b-8388-f2e5c59f3d43",
                            PasswordHash         = "ABJ1bxk+trJ6PTk4iCBSq/WLDVmhI455FFxZbcXHtH1Xw2NyTKHsJmrWQ1Mbl7S4SQ=="
                        };
                        userManager.Create(user);
                        userManager.AddToRole(user.Id, "Administrator");

                        var user2 = new User("b1f9c2ce-ad49-4251-9f33-f0dc8a2080c9")
                        {
                            Email                = "*****@*****.**",
                            EmailConfirmed       = true,
                            Phone                = "0430501022",
                            PhoneNumber          = "0430501022",
                            PhoneNumberConfirmed = true,
                            AccessFailedCount    = 0,
                            LockoutEnabled       = false,
                            UserName             = "******",
                            SecurityStamp        = "6c5d586d-8390-4d96-9db7-f06bb2c6a6df",
                            PasswordHash         = "ANNNzqwEGjePRrU/8VbqSXnJynL/wP51zG+1Ilf424Pu9nYvLWmfa0owBFtj99fywQ=="
                        };
                        userManager.Create(user2);
                        userManager.AddToRole(user2.Id, "Administrator");
                    }
                }

                var site = new Site("5735824c-93cc-4016-b6b3-26f7947bb58e")
                {
                    IsDefault       = true,
                    UserId          = "0efc7c0b-e378-4fc7-9e48-af184f78ee03",
                    Address         = "11 Braceby Close",
                    Country         = "Australia",
                    CreatedDateTime = DateTime.UtcNow,
                    Name            = "Willetton",
                    Postcode        = "6155",
                    State           = "Western Australia",
                    Suburb          = "Willetton",
                    UpdatedDateTime = DateTime.UtcNow,
                    SerialNumber    = "RuHqYCQezwdrBmueo8ni",
                    Secret          = "MWFX6PvK7TZVXLZ75SWBmzmYpr74VoP7b4etbRe7mizXbzfjiz7B9wnFCpDNDuZJ2XY2dNgJonH8vpmGAGnGQLQEyMfRkxmysXzL"
                                      //{"D":"Z7At6fVvJdIX8QUS5s6qKo1K6YRrikZDCBtmZtFNvsLVDvmB5LNNtQ/TjrcxbmJCxcZCNudlnPSdK298QZFxc3asGpLtPkT9z2zjFOaQA9wpNtvQK7BTP/56QJQP6ioxGfEvilEXVXw+2ERkniu5zgOj5MdLy/T31JTUL6iCIJKsK6x2+pu0QbqCJPnQiZk+GvRB4/Y9VEvtUZl9xJQxuTkR/fYLXRL1sKbOxtWvf1Mimm62T1EH1GmR7cZvKkqdtLKrb/8/gehlcaWZ8ms0rfUWeEJUB1mPvqsCVjH5rvS1rX08j5gPyZtolpRqSoYjvFhk+3y6FQ6EOBX93RHVoQ==","DP":"TniHOfpjiWIuvEY46jdEgXfpycz5qwOBvkT59H551kAZvNjthCi3qaIhwpL+Eitfwe0ReqJKD/UYyojfq/6IDV+2UrKcitgd1f4E6dX5NIzQQ1cLN9Xga6hBPfosq12zZPHLUoHxQRtcNb305+EFHiHmEoYxfQl69RJBM3X3iZE=","DQ":"KR8L8vC8XiAFSg25dFmVrMxPmWT66+YmJKwanN2XV1bw3uajy5EFE0BjP74Ggt1IvnZm/PftBPQHNRRpF5VaQ5npaV6OVW1qDA2gdAOCU4tOh5Hnge1eN3r7bIwZ7S23ZhHBwvIYv3AHrjU9Ek25hqKMZ1B+A9Ghw22kNLB5BB0=","Exponent":"AQAB","InverseQ":"FjYzuUqQ4/EFTsWB2upii23mu5r0bEZ579TKNdbzVeSQkGcbI7tTRI4TrOWo07WkiAiJHe4XJtPxc/yj+vjzGhqqxjaaLWMK18qTwPY6OSOavwRZLEqdl/2kVslwZni8JTON18LY9itRM7uaY5lmmDUI7PNpyibbhJo9q0uBJYI=","Modulus":"mMxzNRkfAUGaa1CX8VGlsM07alr3mBMYbRWbOEz5/CtsrA8h70GMomHw97iTn6kn0/tTaOUUrEOu7bRZUiKLLlswV8Q5uyfukoNuSKR5bQUFGaZ1/WO11nAcdCcH0vmN8gZ9eRZiXfOx5sWA+SJ8YXN0H9DwlglhrRQZg8WA05bZ5jbAcfzeF3+rfkL+3b7CnZic2Yupk9zrR1uxQnD3qNKR2dlXCtSibb4JVzJ4CNSySqWvP0Q6fB0IBHnqLgJbE7lDRhLveW6IP6wcAZDxGFJ7fWys4Q2CGd0iCjviBHWDtkCWOaB57xTbR5Su7/mNhYWie14cuuWji9DiToNgZw==","P":"yx4toDmRKT1nu7MrJeNAbK1VzxxqpoovMiCezDnbv9XGwt2Yk1wejxasPNXVZ3Ca9DBItxZcx+fnKegZh2XzE8O8R+DZuXPEfOOwM+DZNZ5lk5VA/f+9XSjJZJaZeucatap75y4iTpvniuVx6zYIduUteS7Nyor8S3sLFsBch/E=","Q":"wJR9dPtEgb63x0Wdw9VNpRSt0eks6JE3CsLZkI80qnbpdZ5cmxIyDl5ww4t5haYiiJnD/FJIwFItdiH+GOyIaghcQnEMedSZG3iQVF6CvrjNhpymLPHqpg3iECmubyUlf3Q78UoVUl8u+3GEQQekwiHvbGyKq7vB5PziJqX9hdc="}
                                      //Secret = "{\"D\":\"Z7At6fVvJdIX8QUS5s6qKo1K6YRrikZDCBtmZtFNvsLVDvmB5LNNtQ/TjrcxbmJCxcZCNudlnPSdK298QZFxc3asGpLtPkT9z2zjFOaQA9wpNtvQK7BTP/56QJQP6ioxGfEvilEXVXw+2ERkniu5zgOj5MdLy/T31JTUL6iCIJKsK6x2+pu0QbqCJPnQiZk+GvRB4/Y9VEvtUZl9xJQxuTkR/fYLXRL1sKbOxtWvf1Mimm62T1EH1GmR7cZvKkqdtLKrb/8/gehlcaWZ8ms0rfUWeEJUB1mPvqsCVjH5rvS1rX08j5gPyZtolpRqSoYjvFhk+3y6FQ6EOBX93RHVoQ==\",\"DP\":\"TniHOfpjiWIuvEY46jdEgXfpycz5qwOBvkT59H551kAZvNjthCi3qaIhwpL+Eitfwe0ReqJKD/UYyojfq/6IDV+2UrKcitgd1f4E6dX5NIzQQ1cLN9Xga6hBPfosq12zZPHLUoHxQRtcNb305+EFHiHmEoYxfQl69RJBM3X3iZE=\",\"DQ\":\"KR8L8vC8XiAFSg25dFmVrMxPmWT66+YmJKwanN2XV1bw3uajy5EFE0BjP74Ggt1IvnZm/PftBPQHNRRpF5VaQ5npaV6OVW1qDA2gdAOCU4tOh5Hnge1eN3r7bIwZ7S23ZhHBwvIYv3AHrjU9Ek25hqKMZ1B+A9Ghw22kNLB5BB0=\",\"Exponent\":\"AQAB\",\"InverseQ\":\"FjYzuUqQ4/EFTsWB2upii23mu5r0bEZ579TKNdbzVeSQkGcbI7tTRI4TrOWo07WkiAiJHe4XJtPxc/yj+vjzGhqqxjaaLWMK18qTwPY6OSOavwRZLEqdl/2kVslwZni8JTON18LY9itRM7uaY5lmmDUI7PNpyibbhJo9q0uBJYI=\",\"Modulus\":\"mMxzNRkfAUGaa1CX8VGlsM07alr3mBMYbRWbOEz5/CtsrA8h70GMomHw97iTn6kn0/tTaOUUrEOu7bRZUiKLLlswV8Q5uyfukoNuSKR5bQUFGaZ1/WO11nAcdCcH0vmN8gZ9eRZiXfOx5sWA+SJ8YXN0H9DwlglhrRQZg8WA05bZ5jbAcfzeF3+rfkL+3b7CnZic2Yupk9zrR1uxQnD3qNKR2dlXCtSibb4JVzJ4CNSySqWvP0Q6fB0IBHnqLgJbE7lDRhLveW6IP6wcAZDxGFJ7fWys4Q2CGd0iCjviBHWDtkCWOaB57xTbR5Su7/mNhYWie14cuuWji9DiToNgZw==\",\"P\":\"yx4toDmRKT1nu7MrJeNAbK1VzxxqpoovMiCezDnbv9XGwt2Yk1wejxasPNXVZ3Ca9DBItxZcx+fnKegZh2XzE8O8R+DZuXPEfOOwM+DZNZ5lk5VA/f+9XSjJZJaZeucatap75y4iTpvniuVx6zYIduUteS7Nyor8S3sLFsBch/E=\",\"Q\":\"wJR9dPtEgb63x0Wdw9VNpRSt0eks6JE3CsLZkI80qnbpdZ5cmxIyDl5ww4t5haYiiJnD/FJIwFItdiH+GOyIaghcQnEMedSZG3iQVF6CvrjNhpymLPHqpg3iECmubyUlf3Q78UoVUl8u+3GEQQekwiHvbGyKq7vB5PziJqX9hdc=\"}"
                };

                dbContext.Set <Site>().Add(site);

                var site2 = new Site("781af7e0-0fe5-44b0-97c3-63a7ec48e420")
                {
                    IsDefault       = false,
                    UserId          = "0efc7c0b-e378-4fc7-9e48-af184f78ee03",
                    Address         = "8 Arklow Glen",
                    Country         = "Australia",
                    CreatedDateTime = DateTime.UtcNow,
                    Name            = "Canning Vale",
                    Postcode        = "6155",
                    State           = "Western Australia",
                    Suburb          = "Canning Vale",
                    UpdatedDateTime = DateTime.UtcNow,
                    SerialNumber    = "hcShsFBNtWgP95enHcSM",
                    Secret          = "MWFX6PvK7TZVXLZ75SWBmzmYpr74VoP7b4etbRe7mizXbzfjiz7B9wnFCpDNDuZJ2XY2dNgJonH8vpmGAGnGQLQEyMfRkxmysXzL"
                };

                dbContext.Set <Site>().Add(site2);


                var site3 = new Site("ae8213ef-cdc3-46f9-aff1-845a31f0b39a")
                {
                    IsDefault       = false,
                    UserId          = "0efc7c0b-e378-4fc7-9e48-af184f78ee03",
                    Address         = "59 Parry St",
                    Country         = "Australia",
                    CreatedDateTime = DateTime.UtcNow,
                    Name            = "Office",
                    Postcode        = "6000",
                    State           = "Western Australia",
                    Suburb          = "Perth",
                    UpdatedDateTime = DateTime.UtcNow,
                    SerialNumber    = "yP93qCe9ZeiRNNNa5ZBK",
                    Secret          = "HgUGCx4sfSpvBvcAhX9p7GKHQc8wpYGg5tSWhtHn4xjQQebEQvQmAg5EWtkuVSSPvqN7EmP7EjnveZtfMJeAEi83u47wc9DKrrD6"
                };

                dbContext.Set <Site>().Add(site3);

                var site4 = new Site("bba331f0-33a1-4a08-bdec-ea8257e807a9")
                {
                    IsDefault       = true,
                    UserId          = "b1f9c2ce-ad49-4251-9f33-f0dc8a2080c9",
                    Address         = "11 Braceby Close",
                    Country         = "Australia",
                    CreatedDateTime = DateTime.UtcNow,
                    Name            = "Willetton",
                    Postcode        = "6155",
                    State           = "Western Australia",
                    Suburb          = "Willetton",
                    UpdatedDateTime = DateTime.UtcNow,
                    SerialNumber    = "oVCZ49N7jDr6VgrnYHGF",
                    Secret          = "pShhgsaTuXQpyB7g8eKT7i5J3oWJGtkyTD5dBxuPEHvs3wsBzscMW4spNTZnqLDXe2fEP2nVsjUxrATNC3VetJRgBNmR64vK4dMd"
                };

                dbContext.Set <Site>().Add(site4);

                dbContext.SaveChanges();

                for (var i = 1; i <= 40; i++)
                {
                    var icon = new Icon
                    {
                        Id   = i,
                        Name = i.ToString(),
                        Url  = "/Images/Icons/white_64x64/" + i + ".png"
                    };
                    dbContext.Set <Icon>().Add(icon);
                }
                dbContext.SaveChanges();

                var switch1 = new Switch
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    Name            = "Irrigation",
                    Status          = false,
                    Type            = SwitchType.PowerMonitoring,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 0,
                    Y      = 0,
                    Order  = 0,
                    IconId = 1,
                    ChipId = "ESP10499465"//StringExtension.GenerateMACAddress(),
                };
                dbContext.Set <Switch>().Add(switch1);


                var switch2 = new Switch
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    Name            = "Pool Pump",
                    Status          = false,
                    Type            = SwitchType.PowerMonitoring,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 0,
                    Y      = 0,
                    Order  = 1,
                    IconId = 2,
                    ChipId = "ESP10498757"//StringExtension.GenerateMACAddress(),
                };
                dbContext.Set <Switch>().Add(switch2);

                var switch3 = new Switch
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    Name            = "Front Garden",
                    Status          = false,
                    Type            = SwitchType.PowerMonitoring,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 0,
                    Y      = 0,
                    Order  = 2,
                    IconId = 4,
                    ChipId = "ESP10500253"//StringExtension.GenerateMACAddress(),
                };
                dbContext.Set <Switch>().Add(switch3);

                var switch4 = new Switch
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    Name            = "Pond Feature",
                    Status          = false,
                    Type            = SwitchType.PowerMonitoring,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 0,
                    Y      = 0,
                    Order  = 3,
                    IconId = 1,
                    ChipId = "ESP10472361"//StringExtension.GenerateMACAddress(),
                };
                dbContext.Set <Switch>().Add(switch4);



                var switch5 = new Switch
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    Name            = "Water Feature",
                    Status          = false,
                    Type            = SwitchType.PowerMonitoring,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 0,
                    Y      = 0,
                    Order  = 4,
                    IconId = 1,
                    ChipId = "ESP10499179"//StringExtension.GenerateMACAddress(),
                };
                dbContext.Set <Switch>().Add(switch5);

                var switch6 = new Switch
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    Name            = "Test Light",
                    Status          = false,
                    Type            = SwitchType.PowerMonitoring,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 0,
                    Y      = 0,
                    Order  = 5,
                    IconId = 4,
                    ChipId = "ESP10499464"//StringExtension.GenerateMACAddress(),
                };
                dbContext.Set <Switch>().Add(switch6);



                var switch7 = new Switch
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    Name            = "Feature Water",
                    Status          = false,
                    Type            = SwitchType.SafeValtage,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 0,
                    Y      = 0,
                    Order  = 6,
                    IconId = 3,
                    ChipId = "ESP10488107"//StringExtension.GenerateMACAddress(),
                };
                dbContext.Set <Switch>().Add(switch7);

                var switch8 = new Switch
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    Name            = "Pond Water",
                    Status          = false,
                    Type            = SwitchType.SafeValtage,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 0,
                    Y      = 0,
                    Order  = 7,
                    IconId = 3,
                    ChipId = "ESP10488288"//StringExtension.GenerateMACAddress(),
                };
                dbContext.Set <Switch>().Add(switch8);

                var switch9 = new Switch
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    Name            = "SV 3",
                    Status          = false,
                    Type            = SwitchType.SafeValtage,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 0,
                    Y      = 0,
                    Order  = 8,
                    IconId = 1,
                    ChipId = "ESP104881071"//StringExtension.GenerateMACAddress(),
                };
                dbContext.Set <Switch>().Add(switch9);

                var switch10 = new Switch
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    Name            = "SV 4",
                    Status          = false,
                    Type            = SwitchType.SafeValtage,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 0,
                    Y      = 0,
                    Order  = 9,
                    IconId = 1,
                    ChipId = "ESP104881072"//StringExtension.GenerateMACAddress(),
                };
                dbContext.Set <Switch>().Add(switch10);

                for (var i = 1; i <= 4; i++)
                {
                    var theSwitch = new Switch
                    {
                        SiteId          = "781af7e0-0fe5-44b0-97c3-63a7ec48e420",
                        CreatedDateTime = DateTime.UtcNow,
                        Name            = "Other Switch " + i,
                        Status          = i % 2 != 0,
                        Type            = i % 2 == 0 ? SwitchType.Normal : SwitchType.PowerMonitoring,
                        UpdatedDateTime = DateTime.UtcNow,
                        X      = 0,
                        Y      = 0,
                        Order  = i - 1,
                        IconId = 1,
                        ChipId = StringExtension.GenerateMACAddress(),
                    };
                    dbContext.Set <Switch>().Add(theSwitch);
                }


                for (var i = 1; i <= 3; i++)
                {
                    var theSwitch = new Switch
                    {
                        SiteId          = "ae8213ef-cdc3-46f9-aff1-845a31f0b39a",
                        CreatedDateTime = DateTime.UtcNow,
                        Name            = "Office Switch " + i,
                        Status          = i % 2 != 0,
                        Type            = i % 2 == 0 ? SwitchType.Normal : SwitchType.PowerMonitoring,
                        UpdatedDateTime = DateTime.UtcNow,
                        X      = 0,
                        Y      = 0,
                        Order  = i - 1,
                        IconId = 1,
                        ChipId = StringExtension.GenerateMACAddress(),
                    };
                    dbContext.Set <Switch>().Add(theSwitch);
                }

                for (var i = 1; i <= 6; i++)
                {
                    var theSwitch = new Switch
                    {
                        SiteId          = "bba331f0-33a1-4a08-bdec-ea8257e807a9",
                        CreatedDateTime = DateTime.UtcNow,
                        Name            = "Switch " + i,
                        Status          = i % 2 != 0,
                        Type            = i % 2 == 0 ? SwitchType.Normal : SwitchType.PowerMonitoring,
                        UpdatedDateTime = DateTime.UtcNow,
                        X      = 0,
                        Y      = 0,
                        Order  = i - 1,
                        IconId = 1,
                        ChipId = StringExtension.GenerateMACAddress(),
                    };
                    dbContext.Set <Switch>().Add(theSwitch);
                }


                var wall1 = new Wall
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 94,
                    Y      = 252,
                    Angle  = 270,
                    Length = 194,
                    Type   = WallType.Single
                };
                dbContext.Set <Wall>().Add(wall1);

                var wall2 = new Wall
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 448,
                    Y      = -100,
                    Angle  = 0,
                    Length = 104,
                    Type   = WallType.Double
                };
                dbContext.Set <Wall>().Add(wall2);

                var wall3 = new Wall
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 1200,
                    Y      = 432,
                    Angle  = 0,
                    Length = 319.145802349033,
                    Type   = WallType.Single
                };
                dbContext.Set <Wall>().Add(wall3);


                dbContext.Set <Wall>().Add(new Wall
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 703,
                    Y      = 947,
                    Angle  = 90,
                    Length = 276.828999999999,
                    Type   = WallType.Double
                });

                dbContext.Set <Wall>().Add(new Wall
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 699,
                    Y      = 748,
                    Angle  = 360,
                    Length = 204.493579850322,
                    Type   = WallType.Single
                });

                dbContext.Set <Wall>().Add(new Wall
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 95,
                    Y      = 5,
                    Angle  = 270,
                    Length = 359.000000000007,
                    Type   = WallType.Double
                });
                dbContext.Set <Wall>().Add(new Wall
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 1201,
                    Y      = 749,
                    Angle  = 90,
                    Length = 500.963381096862,
                    Type   = WallType.Single
                });
                dbContext.Set <Wall>().Add(new Wall
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 1204,
                    Y      = 432,
                    Angle  = 90,
                    Length = 504.662845174875,
                    Type   = WallType.Double
                });
                dbContext.Set <Wall>().Add(new Wall
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 433,
                    Y      = 747,
                    Angle  = 90,
                    Length = 339.065299167577,
                    Type   = WallType.Double
                });
                dbContext.Set <Wall>().Add(new Wall
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 92,
                    Y      = 437,
                    Angle  = 270,
                    Length = 610.679000000001,
                    Type   = WallType.Single
                });
                dbContext.Set <Wall>().Add(new Wall
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 704,
                    Y      = -100,
                    Angle  = 90,
                    Length = 254.048950002483,
                    Type   = WallType.Double
                });
                dbContext.Set <Wall>().Add(new Wall
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 426,
                    Y      = 747,
                    Angle  = 0,
                    Length = 205.186,
                    Type   = WallType.Double
                });
                dbContext.Set <Wall>().Add(new Wall
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 286,
                    Y      = -1,
                    Angle  = 0,
                    Length = 251.294,
                    Type   = WallType.Single
                });
                dbContext.Set <Wall>().Add(new Wall
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 99,
                    Y      = 753,
                    Angle  = 180,
                    Length = 753.35,
                    Type   = WallType.Double
                });
                dbContext.Set <Wall>().Add(new Wall
                {
                    SiteId          = "5735824c-93cc-4016-b6b3-26f7947bb58e",
                    CreatedDateTime = DateTime.UtcNow,
                    UpdatedDateTime = DateTime.UtcNow,
                    X      = 705,
                    Y      = 438,
                    Angle  = 180,
                    Length = 539.66,
                    Type   = WallType.Double
                });
                dbContext.SaveChanges();

                var schedule = new Schedule();
                schedule.Active    = true;
                schedule.StartTime = new TimeSpan(6, 00, 0);
                schedule.Length    = 20;
                schedule.Name      = "Daily Irrigation";
                schedule.Frequency = ScheduleFrequency.Daily;
                schedule.SwitchId  = switch1.Id;
                schedule.Monday    = true;
                schedule.Tuesday   = true;
                schedule.Wednesday = true;
                schedule.Thursday  = true;
                schedule.Friday    = true;
                schedule.Saturday  = true;
                schedule.Sunday    = true;
                dbContext.Set <Schedule>().Add(schedule);


                var schedule2 = new Schedule();
                schedule.Active    = true;
                schedule.StartTime = new TimeSpan(20, 0, 0);
                schedule.Length    = 20;
                schedule.Name      = "Night Irrigation";
                schedule.Frequency = ScheduleFrequency.Daily;
                schedule.SwitchId  = switch1.Id;
                schedule.Monday    = true;
                schedule.Tuesday   = true;
                schedule.Wednesday = true;
                schedule.Thursday  = true;
                schedule.Friday    = true;
                schedule.Saturday  = true;
                schedule.Sunday    = true;
                dbContext.Set <Schedule>().Add(schedule2);

                var schedule3 = new Schedule();
                schedule.Active    = true;
                schedule.StartTime = new TimeSpan(18, 0, 0);
                schedule.Length    = 359;
                schedule.Name      = "Night Garden Light";
                schedule.Frequency = ScheduleFrequency.Daily;
                schedule.SwitchId  = switch3.Id;
                schedule.Monday    = true;
                schedule.Tuesday   = true;
                schedule.Wednesday = true;
                schedule.Thursday  = true;
                schedule.Friday    = true;
                schedule.Saturday  = true;
                schedule.Sunday    = true;
                dbContext.Set <Schedule>().Add(schedule3);

                var schedule4 = new Schedule();
                schedule.Active    = true;
                schedule.StartTime = new TimeSpan(20, 0, 0);
                schedule.Length    = 20;
                schedule.Name      = "Pond Refill";
                schedule.Frequency = ScheduleFrequency.Daily;
                schedule.SwitchId  = switch8.Id;
                schedule.Monday    = true;
                schedule.Tuesday   = true;
                schedule.Wednesday = true;
                schedule.Thursday  = true;
                schedule.Friday    = true;
                schedule.Saturday  = true;
                schedule.Sunday    = true;
                dbContext.Set <Schedule>().Add(schedule4);
                dbContext.SaveChanges();
            }
        }
Exemplo n.º 11
0
        protected override void Seed(CashRegisterContext context)
        {
            var enumToLookup = new EnumToLookup();

            enumToLookup.Apply(context);

            var s = new InitHelper(context);

            s.AddTab("Øl Fane", 0, "LimeGreen");

            s.AddType("Billig Øl Type", 12, "YellowGreen");
            s.AddGroup("Billig Øl Gruppe");
            s.AddProduct("Ceres Top");
            s.AddProduct("Royal Classic");

            s.AddType("Special Øl Type", 15, "GreenYellow");
            s.AddGroup("Special Øl Gruppe");
            s.AddProduct("Royal Export");
            s.AddProduct("Blå Thor");
            s.AddProduct("Heineken");
            s.AddProduct("Stout");
            s.AddProduct("Giraf Kalle");
            s.AddProduct("Havskum");

            s.AddType("Udenlandsk Øl Type", 15, "LawnGreen");
            s.AddGroup("Udenlandsk Øl Gruppe");
            s.AddProduct("Sol");
            s.AddProduct("Edelweiss");
            s.AddProduct("Newcastle");
            s.AddProduct("Moretti");
            s.AddProduct("Krusovice");

            s.AddType("Fadøl Type", 18, "Yellow");
            s.AddGroup("Fadøl Gruppe");
            s.AddProduct("Royal Fad");
            s.AddProduct("Jule Fad");

            s.AddTab("Drinks", 1, "DodgerBlue");

            s.AddType("Billig Drinks Type", 20, "LightSkyBlue");
            s.AddGroup("Billig Drinks Gruppe");
            s.AddProduct("Brandbil");
            s.AddProduct("Tequila Sunrise");
            s.AddProduct("Champangne Brus");
            s.AddProduct("Piña Colada");
            s.AddProduct("Southern Delight");
            s.AddProduct("Pawadise");
            s.AddProduct("Fidel Castro");
            s.AddProduct("Sommer Morgan");
            s.AddProduct("Pink Pussy");

            s.AddType("30 kr drinks", 30, "SkyBlue");
            s.AddGroup("30 kr Drinks Gruppe");
            s.AddProduct("Moscow Mule");
            s.AddProduct("Fake Cherry");
            s.AddProduct("Sweet Bombay");
            s.AddProduct("Den Hvide Enke");
            s.AddProduct("Irish Coffee");
            s.AddProduct("Kaptain Eventyr");
            s.AddProduct("White Russian");
            s.AddProduct("Vodka Redbull");
            s.AddProduct("Labre Larver");

            s.AddType("35 kr drinks", 35, "DeepSkyBlue");
            s.AddGroup("35 kr Drinks Gruppe");
            s.AddProduct("Gøglermælk");

            s.AddType("40 kr drinks", 40, "");
            s.AddGroup("40 kr Drinks Gruppe");
            s.AddProduct("Blå Batman");
            s.AddProduct("Party Hamster");
            s.AddProduct("Cosmopolitan");

            s.AddType("45 kr drinks", 45, "PowderBlue");
            s.AddGroup("45 kr Drinks Gruppe");
            s.AddProduct("Long Island Iced Tea");
            s.AddProduct("Memory Leak");
            s.AddProduct("K-Special");

            s.AddType("50 kr drinks", 50, "SteelBlue");
            s.AddGroup("50 kr Drinks Gruppe");
            s.AddProduct("Kold Krig (2 drinks)");

            s.AddTab("Shots", 2, "IndianRed");

            s.AddType("Billig Shots Type", 10, "DarkOrange");
            s.AddGroup("Billig Shots Gruppe");
            s.AddProduct("Jägermeister");
            s.AddProduct("Sambuca");
            s.AddProduct("Små Diverse");
            s.AddProduct("Tequila");
            s.AddProduct("Vodka");
            s.AddProduct("Rom");

            s.AddType("Alm Shots Type", 15, "OrangeRed");
            s.AddGroup("Alm Shots Gruppe");
            s.AddProduct("Arnbitter");
            s.AddProduct("Cointreau");
            s.AddProduct("Fernet Branca/Menta");
            s.AddProduct("Galliano");
            s.AddProduct("Gin");
            s.AddProduct("Khalua");
            s.AddProduct("Pisang Ambon");
            s.AddProduct("Southern Comfort");
            s.AddProduct("Whiskey");
            s.AddProduct("Bailey");
            s.AddProduct("Galliano Hotshots");

            s.AddType("Dyre Shots Type", 20, "Red");
            s.AddGroup("Dyre Shots Gruppe");
            s.AddProduct("Jägerbombs");
            s.AddProduct("Snefnugg");

            s.AddTab("SodaPopz", 3, "Coral");
            s.AddType("Sodapop", 25, "DarkSalmon");
            s.AddGroup("Sodapop");
            s.AddProduct("Blue Desire");
            s.AddProduct("Dirty Passion");
            s.AddProduct("Pure Exotic");
            s.AddProduct("White Lies");
            s.AddProduct("Senven Sins");
            s.AddProduct("Brezzer Lemon");

            s.Save();

            base.Seed(context);
        }