Exemple #1
0
 public PageRepository(EzCMSEntities entities, IClientNavigationRepository clientNavigationRepository,
                       IRepository <PageLog> pageLogRepository)
     : base(entities)
 {
     _clientNavigationRepository = clientNavigationRepository;
     _pageLogRepository          = pageLogRepository;
 }
        /// <summary>
        /// Init database
        /// </summary>
        public void InitDatabase()
        {
            Database.SetInitializer(new MigrateDatabaseToLatestVersion <EzCMSEntities, Configuration>());

            using (var dbContext = new EzCMSEntities())
            {
                //Trigger database to create structure and data
                var trigger = dbContext.Users.ToList();
            }
        }
Exemple #3
0
        /// <summary>
        /// Initialize default languages
        /// </summary>
        public void Initialize(DbContext ezContext)
        {
            var context = ezContext as EzCMSEntities;

            if (context != null)
            {
                #region Add countries

                if (!context.Countries.Any())
                {
                    var countryData = DataInitializeHelper.GetResourceContent("Country.Countries.txt",
                                                                              DataSetupResourceType.Others);
                    List <string> countryList =
                        countryData.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList();

                    int i         = 0;
                    var countries = new List <Country>();
                    foreach (var item in countryList)
                    {
                        i = i + 1;
                        var country = new Country
                        {
                            Name        = item,
                            RecordOrder = i * 10
                        };

                        countries.Add(country);
                    }

                    var dbContext = new EzCMSEntities();
                    dbContext.Countries.AddIfNotExist(country => country.Name, countries.ToArray());
                    dbContext.SaveChanges();
                }

                #endregion

                #region Add Languages

                var languages = new[]
                {
                    new Language
                    {
                        Name        = "English",
                        Culture     = "United States",
                        Key         = "en-US",
                        IsDefault   = false,
                        RecordOrder = 20
                    }
                };
                context.Languages.AddIfNotExist(l => l.Name, languages);

                #endregion
            }
        }
        public void Initialize(DbContext ezDbContext)
        {
            EzCMSEntities dbContext = ezDbContext as EzCMSEntities;

            if (dbContext != null)
            {
                var backgroundTask = new BackgroundTask
                {
                    Name         = GetName(),
                    Description  = GetName(),
                    Status       = BackgroundTaskEnums.TaskStatus.Active,
                    ScheduleType = BackgroundTaskEnums.ScheduleType.Interval,
                    Interval     = 60 * 60 //1 hour
                };

                dbContext.BackgroundTasks.AddIfNotExist(t => t.Name, backgroundTask);
            }
        }
        public void Initialize(DbContext ezDbContext)
        {
            EzCMSEntities dbContext = ezDbContext as EzCMSEntities;

            if (dbContext != null)
            {
                var backgroundTask = new BackgroundTask
                {
                    Name         = GetName(),
                    Description  = GetName(),
                    Status       = BackgroundTaskEnums.TaskStatus.Active,
                    ScheduleType = BackgroundTaskEnums.ScheduleType.Daily,
                    StartTime    = new TimeSpan(1, 0, 0)
                };

                dbContext.BackgroundTasks.AddIfNotExist(t => t.Name, backgroundTask);
            }
        }
Exemple #6
0
        public override void Initialize(DbContext ezDbContext)
        {
            EzCMSEntities dbContext = ezDbContext as EzCMSEntities;

            if (dbContext != null)
            {
                var setting       = GetSetup().DefaultValue;
                var settingString = SerializeUtilities.Serialize(setting);
                var insertSetting = new SiteSetting
                {
                    Name        = GetSetup().Name,
                    Description = GetSetup().Description,
                    Value       = settingString,
                    SettingType = GetSetup().SettingType
                };
                dbContext.SiteSettings.AddIfNotExist(i => i.Name, insertSetting);
            }
        }
        /// <summary>
        /// Initialize default languages
        /// </summary>
        public void Initialize(DbContext ezContext)
        {
            var context = ezContext as EzCMSEntities;

            if (context != null)
            {
                var dbContext = new EzCMSEntities();

                var availableTools           = EnumUtilities.GetAllItems <EditorTool>().Select(t => t.ToString());
                var availableToolsJsonString = SerializeUtilities.Serialize(availableTools);
                var toolbar = new Toolbar
                {
                    Name         = "Default Toolbar",
                    IsDefault    = true,
                    BasicToolbar = availableToolsJsonString,
                    PageToolbar  = availableToolsJsonString
                };

                dbContext.Toolbars.AddIfConditionInvalid(t => t.IsDefault, toolbar);
                dbContext.SaveChanges();
            }
        }
Exemple #8
0
        protected override void Seed(EzCMSEntities context)
        {
            IEnumerable <IDataInitializer> initializers = Enumerable.Empty <IDataInitializer>();

            try
            {
                initializers = HostContainer.GetInstances <IDataInitializer>().OrderBy(i => i.Priority());
            }
            catch (Exception)
            {
                //Likely called from Package Manager Console
            }
            using (var scope = new TransactionScope())
            {
                foreach (var initializer in initializers)
                {
                    initializer.Initialize(context);
                    context.SaveChanges();
                }
                scope.Complete();
            }
        }
 public EventEventCategoryRepository(EzCMSEntities entities)
     : base(entities)
 {
 }
 public PageSecurityRepository(EzCMSEntities entities)
     : base(entities)
 {
 }
 public ProtectedDocumentCompanyRepository(EzCMSEntities entities)
     : base(entities)
 {
 }
Exemple #12
0
 public ContactGroupContactRepository(EzCMSEntities entities)
     : base(entities)
 {
 }
Exemple #13
0
 public PageTagRepository(EzCMSEntities entities, IRepository <Tag> tagRepository)
     : base(entities)
 {
     _tagRepository = tagRepository;
 }
 public ClientNavigationRepository(EzCMSEntities entities)
     : base(entities)
 {
 }
Exemple #15
0
 public UserRepository(EzCMSEntities entities, IRepository <Contact> contactRepository)
     : base(entities)
 {
     _contactRepository = contactRepository;
 }
Exemple #16
0
 public LocalizedResourceRepository(EzCMSEntities entities)
     : base(entities)
 {
 }
 public AssociateLocationRepository(EzCMSEntities entities)
     : base(entities)
 {
 }
 public ProtectedDocumentGroupRepository(EzCMSEntities entities)
     : base(entities)
 {
 }
Exemple #19
0
 public LocationLocationTypeRepository(EzCMSEntities entities)
     : base(entities)
 {
 }
 public GroupPermissionRepository(EzCMSEntities entities)
     : base(entities)
 {
 }
 public void Setup()
 {
     _dbContext  = TestUtilities.GetTestDbContext();
     _repository = new AssociateAssociateTypeRepository(_dbContext);
 }
Exemple #22
0
 public SlideInHelpRepository(EzCMSEntities entities)
     : base(entities)
 {
 }
 public NewsNewsCategoryRepository(EzCMSEntities entities)
     : base(entities)
 {
 }
Exemple #24
0
 public AssociateCompanyTypeRepository(EzCMSEntities entities)
     : base(entities)
 {
 }
Exemple #25
0
 public UserUserGroupRepository(EzCMSEntities entities)
     : base(entities)
 {
 }