Ejemplo n.º 1
0
        internal RestIntegration(RestDiscordClient client, IntegrationModel model) : base(client, model.Id)
        {
            Name      = model.Name;
            Type      = model.Type;
            IsEnabled = model.Enabled;
            IsSyncing = model.Syncing;
            RoleId    = model.RoleId;
            User      = new RestUser(client, model.User);
            Account   = new IntegrationAccount(model.Account);
            SyncedAt  = model.SyncedAt;

            Update(model);
        }
Ejemplo n.º 2
0
        public static IntegrationModel MergeViewWithModelIntegration(IntegrationModel model, IntegrationView view)
        {
            model.Tawkto              = view.Tawkto;
            model.GoogleAnalytics     = view.GoogleAnalytics;
            model.FacebookPixel       = view.FacebookPixel;
            model.YandexMetrica       = view.YandexMetrica;
            model.GoogleMaps          = view.GoogleMaps;
            model.Recaptcha           = view.Recaptcha;
            model.Hotjar              = view.Hotjar;
            model.CustomHeaderScripts = view.CustomHeaderScripts;
            model.CustomFooterScripts = view.CustomFooterScripts;

            return(model);
        }
Ejemplo n.º 3
0
        public static IntegrationView ConvertToViewIntegration(IntegrationModel result)
        {
            var integrationView = new IntegrationView
            {
                Id                  = result.Id,
                Tawkto              = result.Tawkto,
                GoogleAnalytics     = result.GoogleAnalytics,
                FacebookPixel       = result.FacebookPixel,
                YandexMetrica       = result.YandexMetrica,
                GoogleMaps          = result.GoogleMaps,
                Recaptcha           = result.Recaptcha,
                Hotjar              = result.Hotjar,
                CustomHeaderScripts = result.CustomHeaderScripts,
                CustomFooterScripts = result.CustomFooterScripts
            };

            return(integrationView);
        }
Ejemplo n.º 4
0
        private static IntegrationModel CastSendingTasksListToIntegrationModel(SendingTask task, string recipient,
                                                                               string method, string uid)
        {
            var model = new IntegrationModel()
            {
                dataModel = new Models.FileInfo()
                {
                    name = task.Name,
                    path = task.Path
                },
                recipient = recipient,
                uid       = uid.ToString(),
                method    = method,
                envCode   = _config.FileMonitoringEnvCode
            };


            return(model);
        }
Ejemplo n.º 5
0
 internal void Update(IntegrationModel model)
 {
     ExpireBehavior    = model.ExpireBehavior;
     ExpireGracePeriod = TimeSpan.FromSeconds(model.ExpireGracePeriod);
 }
Ejemplo n.º 6
0
 public static string ConvertIntegrationModelToJson(IntegrationModel model)
 {
     return(JsonConvert.SerializeObject(model).ToString());
 }
 // ================================================================================================================
 // Metodos privados que proveen funcionalidad a las acciones del controlador.
 // ================================================================================================================
 private void connectModel()
 {
     integrationConfigurationModel = new IntegrationModel();
     encryptor = new Encrypt();
 }
Ejemplo n.º 8
0
Archivo: Seed.cs Proyecto: jarmatys/CMS
        public static async Task SeedData(CMSContext context, UserManager <User> userManager)
        {
            // Seed dla podstawowych kont użytkowników
            if (!userManager.Users.Any())
            {
                var users = new List <User>
                {
                    new User
                    {
                        UserName = "******",
                        Email    = "*****@*****.**",
                        Name     = "admin",
                        Surname  = "adminowski"
                    },
                    new User
                    {
                        UserName = "******",
                        Email    = "*****@*****.**",
                        Name     = "user",
                        Surname  = "userowski"
                    }
                };

                foreach (var user in users)
                {
                    await userManager.CreateAsync(user, "haslo");
                }
            }

            // Seed dla ustawień systemu
            if (!context.BlogSettings.Any())
            {
                var blogSettings = new BlogModel
                {
                    CommentsNotify = false,
                    PostPerPage    = 12,
                    AllowComments  = false,
                    DateFormat     = "dd-MM-yyyy",
                    TimeFormat     = "H:mm:ss"
                };

                await context.BlogSettings.AddAsync(blogSettings);

                await context.SaveChangesAsync();
            }

            // seed dla ustawień e-maila
            if (!context.EmailSettings.Any())
            {
                var emailsettings = new EmailModel
                {
                    Host      = "smtp.gmail.com",
                    Port      = 587,
                    EmailTo   = "*****@*****.**",
                    EmailFrom = "*****@*****.**",
                    Password  = "******",
                    EnableSSL = true,
                };

                await context.EmailSettings.AddAsync(emailsettings);

                await context.SaveChangesAsync();
            }

            // Seed dla polityki prywatności
            if (!context.PrivacyPolicySettings.Any())
            {
                var privacySettings = new PrivacyPolicyModel
                {
                    PageUrl     = "https://test.pl",
                    CompanyName = "Nazwa firmy",
                    Street      = "ul. ulicowska 45",
                    City        = "miasto",
                    ZipCode     = "12-345",
                    Email       = "*****@*****.**",
                    HostingName = "hosting.pl"
                };

                await context.PrivacyPolicySettings.AddAsync(privacySettings);

                await context.SaveChangesAsync();
            }

            // Seed dla polityki prywatności
            if (!context.IntegrationSettings.Any())
            {
                var integrationSettings = new IntegrationModel {
                };

                await context.IntegrationSettings.AddAsync(integrationSettings);

                await context.SaveChangesAsync();
            }

            // Seed dla ogólnych ustawień seo
            if (!context.SeoSettings.Any())
            {
                var generalSettings = new GeneralSeoSettingsModel
                {
                    MainUrl = "https://cmsopen.net",
                    Title   = "Twoja pierwsza strona w systemie CMSOPEN"
                };

                await context.SeoSettings.AddAsync(generalSettings);

                await context.SaveChangesAsync();
            }
        }
Ejemplo n.º 9
0
 public async Task <bool> SetIntegrationSettings(IntegrationModel result)
 {
     _context.IntegrationSettings.Update(result);
     return(await _context.SaveChangesAsync() > 0);
 }