Exemplo n.º 1
0
 /// <summary>
 /// Ensures the seeding of the database
 /// </summary>
 /// <param name="context">The context.</param>
 public static void EnsureSeeding(this AdoptersContext context)
 {
     if (context.AllMigrationsApplied())
     {
         EnsureSeedingExtension.Seed(context);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Seeds the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        public static void Seed(AdoptersContext context)
        {
            var list = new List <Notification>();

            list.Add(new Notification()
            {
                Id = Convert.ToInt32(NotificationType.Welcome), Name = "Registro de usuario", Active = true, IsEmail = true, IsSystem = false, SystemText = null, Tags = "[{ \"key\":\"%%NotifiedUser.Name%%\",\"value\":\"Nombre del usuario\" },{ \"key\":\"%%NotifiedUser.Email%%\",\"value\":\"Correo del usuario notificado\" },{\"key\":\"%%Url%%\" , \"value\": \"Link principal\"}]", EmailSubject = "Bienvenido a Huellitas sin hogar", EmailHtml = "<h2 style=\"color: #304a6f;text-align: center;font-size: 22px;\"><b>!Nos alegra mucho que te hayas unido a Huellitas sin Hogar!</b></h2>                     <p><br></p>                     <p>Hola %%NotifiedUser.Name%%,</p>                     <p>queremos comunicarte que el perfil ya está creado en nuestra pagina y podrás empezar a:</p> <ul> 	<li><a href=\"%%RootUrl%%/sinhogar\" target=\"\">​Llenar formularios de adopción</a></li> 	<li><a href=\"%%RootUrl%%perdidos/crear\" target=\"\">Reportar mascotas perdidas</a></li> 	<li><a href=\"%%RootUrl%%dar-en-adopcion\" target=\"\">Dar en adopción perros y gatos</a></li> 	<li><a href=\"%%RootUrl%%/fundaciones/crear\" target=\"\">Registrar tu fundación o hogar de paso</a></li> </ul> <p>Muchas gracias por apoyar a las huellitas sin hogar.</p>                     <p><a href=\"%%RootUrl%%\" style=\"color: #FFF; background: #3C75C2; font-size: 20px;  text-decoration: none; margin: 10px auto; display: block; min-width: 140px; text-align: center; border-radius: 6px; padding: 10px 0;\">Ir a Huellitas sin Hogar</a></p>"
            });
            list.Add(new Notification()
            {
                Id = Convert.ToInt32(NotificationType.NewCommentOnReport), Name = "Comentario en contenido creado", Active = true, IsEmail = true, IsSystem = false, SystemText = "%%TriggerUser.Name%% ha comentado <b>%%Report.Name%%</b>", Tags = "[{ \"key\":\"%%NotifiedUser.Name%%\",\"value\":\"Nombre del usuario\" },{ \"key\":\"%%NotifiedUser.Email%%\",\"value\":\"Correo del usuario notificado\" },{ \"key\":\"%%TriggerUser.Name%%\",\"value\":\"Nombre del usuario que realiza acción\" },{ \"key\":\"%%TriggerUser.Email%%\",\"value\":\"Correo del usuario que realiza acción\" },{\"key\":\"%%Url%%\" , \"value\": \"Link principal\"},{\"key\":\"%%Report.Name%%\", \"value\":\"Nombre del contenido\"},{\"key\":\"%%Report.Url%%\", \"value\":\"Link del contenido\"}]", EmailSubject = "%%TriggerUser.Name%% ha comentado %%Report.Name%%", EmailHtml = "<h2 style=\"color: #304a6f;text-align: center;font-size: 22px;\"><b>Han comentado %%Report.Name%%</b></h2> <p style=\"text-align: left;\"><br></p> <p style=\"text-align: left;\">Hola %%NotifiedUser.Name%%, mira que han dicho de %%Report.Name%% aquí.</p> <p></p> <p><a href=\"%%Report.Url%%\" style=\"color: #FFF; background: #3C75C2; font-size: 20px; text-decoration: none; margin: 10px auto; display: block; min-width: 140px; text-align: center; border-radius: 6px; padding: 10px 0;\">Ver comentario</a></p> <p>Muchas gracias por apoyar a las huellitas sin hogar.<br></p>"
            });
            list.Add(new Notification()
            {
                Id = Convert.ToInt32(NotificationType.NewSubcommentOnMyComment), Name = "Subcomentario en mi comentario", Active = true, IsEmail = true, IsSystem = false, SystemText = "Han respondido tu comentario sobre %%Report.Name%%", Tags = "[{ \"key\":\"%%NotifiedUser.Name%%\",\"value\":\"Nombre del usuario\" },{ \"key\":\"%%NotifiedUser.Email%%\",\"value\":\"Correo del usuario notificado\" },{ \"key\":\"%%TriggerUser.Name%%\",\"value\":\"Nombre del usuario que realiza acción\" },{ \"key\":\"%%TriggerUser.Email%%\",\"value\":\"Correo del usuario que realiza acción\" },{\"key\":\"%%Url%%\" , \"value\": \"Link principal\"},{\"key\":\"%%Report.Name%%\", \"value\":\"Nombre del contenido\"},{\"key\":\"%%Report.Url%%\", \"value\":\"Link del contenido\"}]", EmailSubject = "Han respondido tu comentario sobre %%Report.Name%%", EmailHtml = "<h2 style=\"color: #304a6f;text-align: center;font-size: 22px;\"><b>Han respondido tu comentario en &nbsp;%%Report.Name%%</b></h2> <p style=\"text-align: left;\"><br></p> <p style=\"text-align: left;\">Hola %%NotifiedUser.Name%%, mira que han dicho de %%Report.Name%% aquí.</p> <p></p> <p><a href=\"%%Report.Url%%\" style=\"color: #FFF; background: #3C75C2; font-size: 20px; text-decoration: none; margin: 10px auto; display: block; min-width: 140px; text-align: center; border-radius: 6px; padding: 10px 0;\">Ver comentario</a></p> <p>Muchas gracias por apoyar a las huellitas sin hogar.<br></p>"
            });
            list.Add(new Notification()
            {
                Id = Convert.ToInt32(NotificationType.NewSubcommentOnSomeoneElseComment), Name = "Subcomentario en el comentario de otro", Active = true, IsEmail = true, IsSystem = false, SystemText = "Han comentado algo que comentaste", Tags = "[{ \"key\":\"%%NotifiedUser.Name%%\",\"value\":\"Nombre del usuario\" },{ \"key\":\"%%NotifiedUser.Email%%\",\"value\":\"Correo del usuario notificado\" },{ \"key\":\"%%TriggerUser.Name%%\",\"value\":\"Nombre del usuario que realiza acción\" },{ \"key\":\"%%TriggerUser.Email%%\",\"value\":\"Correo del usuario que realiza acción\" },{\"key\":\"%%Url%%\" , \"value\": \"Link principal\"},{\"key\":\"%%Report.Name%%\", \"value\":\"Nombre del contenido\"},{\"key\":\"%%Report.Url%%\", \"value\":\"Link del contenido\"}]", EmailSubject = "Han comentado algo que comentaste", EmailHtml = "<h2 style=\"color: #304a6f;text-align: center;font-size: 22px;\"><b>Han respondido en un comentario</b></h2> <p style=\"text-align: left;\"><br></p> <p style=\"text-align: left;\">Hola %%NotifiedUser.Name%%, mira que han dicho de %%Report.Name%% aquí.</p> <p></p> <p><a href=\"%%Report.Url%%\" style=\"color: #FFF; background: #3C75C2; font-size: 20px; text-decoration: none; margin: 10px auto; display: block; min-width: 140px; text-align: center; border-radius: 6px; padding: 10px 0;\">Ver comentario</a></p> <p>Muchas gracias por apoyar a las huellitas sin hogar.<br></p>"
            });

            foreach (var item in list)
            {
                if (!context.Notifications.Any(c => c.Id.Equals(item.Id)))
                {
                    context.Notifications.Add(item);
                }
            }

            context.SaveChanges();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Seeds the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        public static void Seed(AdoptersContext context)
        {
            var user     = context.Users.FirstOrDefault();
            var location = context.Locations.FirstOrDefault();
            var file     = context.Files.FirstOrDefault();

            var list = new List <Report>();

            list.Add(new Report()
            {
                Name = "Reporte de prueba 1", Description = "Reporte de prueba 1", FriendlyName = "reporte-prueba1", Email = "*****@*****.**", UserId = user.Id, LocationId = location.Id, CountComments = 1, CountDislikes = 2, CountLikes = 3, CreationDate = DateTime.Now, Deleted = true, FacebookProfile = "facebook", Positive = true, TwitterProfile = "twitter", FileId = file.Id
            });
            list.Add(new Report()
            {
                Name = "Reporte de prueba 2", Description = "Reporte de prueba 2", FriendlyName = "reporte-prueba2", Email = "*****@*****.**", UserId = user.Id, LocationId = location.Id, CountComments = 1, CountDislikes = 2, CountLikes = 3, CreationDate = DateTime.Now, Deleted = true, FacebookProfile = "facebook", Positive = true, TwitterProfile = "twitter", FileId = file.Id
            });

            foreach (var item in list)
            {
                if (!context.Reports.Any(c => c.Name.Equals(item.Name)))
                {
                    context.Reports.Add(item);
                }
            }

            context.SaveChanges();
        }
Exemplo n.º 4
0
 /// <summary>
 /// Seeds the specified context.
 /// </summary>
 /// <param name="context">The context.</param>
 private static void Seed(AdoptersContext context)
 {
     SeedSettings.Seed(context);
     SeedLocations.Seed(context);
     SeedFiles.Seed(context);
     SeedUsers.Seed(context);
     SeedReports.Seed(context);
     SeedNotification.Seed(context);
 }
Exemplo n.º 5
0
        /// <summary>
        /// Seeds the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        public static void Seed(AdoptersContext context)
        {
            var list = new List <User>();

            list.Add(new Entities.User()
            {
                Name = "Administrador", Email = "*****@*****.**", CreationDate = DateTime.Now, FacebookId = "123", Role = Role.Admin
            });

            foreach (var item in list)
            {
                if (!context.Users.Any(c => c.Email.Equals(item.Email)))
                {
                    context.Users.Add(item);
                }
            }

            context.SaveChanges();
        }
Exemplo n.º 6
0
        /// <summary>
        /// Seeds the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        public static void Seed(AdoptersContext context)
        {
            var list = new List <File>();

            list.Add(new File()
            {
                FileName = "mi archivo.jpg", MimeType = "image/jpg", Name = "archivo"
            });

            foreach (var item in list)
            {
                if (!context.Files.Any(c => c.Name.Equals(item.Name)))
                {
                    context.Files.Add(item);
                }
            }

            context.SaveChanges();
        }
Exemplo n.º 7
0
        /// <summary>
        /// Seeds the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        public static void Seed(AdoptersContext context)
        {
            var list = new List <SystemSetting>();

            list.Add(new SystemSetting()
            {
                Name = "GeneralSettings.BigPictureWidth", Value = "1000"
            });
            list.Add(new SystemSetting()
            {
                Name = "GeneralSettings.BigPictureHeight", Value = "600"
            });
            list.Add(new SystemSetting()
            {
                Name = "GeneralSettings.SmallPictureWidth", Value = "500"
            });
            list.Add(new SystemSetting()
            {
                Name = "GeneralSettings.SmallPictureHeight", Value = "300"
            });
            list.Add(new SystemSetting()
            {
                Name = "SecuritySettings.AuthenticationAudience", Value = "theaudienceofadopters"
            });
            list.Add(new SystemSetting()
            {
                Name = "SecuritySettings.AuthenticationIssuer", Value = "adoptantes.com"
            });
            list.Add(new SystemSetting()
            {
                Name = "SecuritySettings.AuthenticationSecretKey", Value = "thesecretkeyofjwt"
            });
            list.Add(new SystemSetting()
            {
                Name = "SecuritySettings.ExpirationTokenMinutes", Value = "14000"
            });
            list.Add(new SystemSetting()
            {
                Name = "SecuritySettings.MaxRequestFileUploadMB", Value = "3"
            });
            list.Add(new SystemSetting()
            {
                Name = "GeneralSettings.DefaultPictureWidth", Value = "1500"
            });
            list.Add(new SystemSetting()
            {
                Name = "GeneralSettings.DefaultPictureHeight", Value = "1500"
            });
            list.Add(new SystemSetting()
            {
                Name = "GeneralSettings.BodyBaseHtml", Value = "%%Body%%"
            });
            list.Add(new SystemSetting()
            {
                Name = "GeneralSettings.SiteUrl", Value = "http://localhost:60122/"
            });
            list.Add(new SystemSetting()
            {
                Name = "SecuritySettings.FacebookApiKey", Value = "1895527400661121"
            });

            foreach (var item in list)
            {
                if (!context.SystemSettings.Any(c => c.Name.Equals(item.Name)))
                {
                    context.SystemSettings.Add(item);
                }
            }

            context.SaveChanges();
        }