/// <summary> /// Copy Existing Site /// </summary> /// <param name="site"></param> /// <returns></returns> public void CopySite(int siteId) { if (!CheckSiteCollectionAdmin(UserContextDetails.UserId)) { throw new BusinessException(_coreValidationResourceManager.GetString(CoreValidationMessagesConstants.UnAuthorized), CoreValidationMessagesConstants.UnAuthorized); } Site site = eCollabroDbContext.Repository<Site>().Query().Include(inc => inc.Navigations).Include(inc => inc.Roles).Filter(qry => qry.SiteId.Equals(siteId)).Get().FirstOrDefault(); if (site != null) { #region Site Copy Site newSite = new Site(); newSite.SiteName = site.SiteName + "-Copy"; newSite.SiteDesc = site.SiteDesc; newSite.IsActive = true; newSite.SiteCode = _commonManager.GetNextCode(EntityConstants.Site); newSite.CreatedById = UserContextDetails.UserId; newSite.CreatedOn = DateTime.UtcNow; #endregion #region Feature Copy foreach (SiteFeature siteFeature in site.SiteFeatures) { SiteFeature newsiteFeature = new SiteFeature(); newsiteFeature.FeatureId = siteFeature.FeatureId; newsiteFeature.CreatedById = UserContextDetails.UserId; newsiteFeature.CreatedOn = DateTime.UtcNow; newSite.SiteFeatures.Add(newsiteFeature); } #endregion #region Navigation Copy foreach (Navigation navigation in site.Navigations) { Navigation newNavigation = new Navigation(); newNavigation.NavigationCode = _commonManager.GetNextCode(EntityConstants.Navigation); newNavigation.NavigationParentId = navigation.NavigationParentId; newNavigation.ContentPageId = navigation.ContentPageId; newNavigation.DisplayOrder = navigation.DisplayOrder; newNavigation.IsAnomynousAccess = navigation.IsAnomynousAccess; newNavigation.FeatureId = navigation.FeatureId; newNavigation.NavigationText = navigation.NavigationText; newNavigation.Link = navigation.Link; newNavigation.IsActive = true; newNavigation.IsDeleted = false; newNavigation.NavigationTypeId = navigation.NavigationTypeId; newNavigation.CreatedById = UserContextDetails.UserId; newNavigation.CreatedOn = DateTime.UtcNow; newSite.Navigations.Add(newNavigation); } #endregion #region Role Copy foreach (Role role in site.Roles) { Role newRole = new Role(); newRole.RoleCode = _commonManager.GetNextCode(EntityConstants.Role); newRole.RoleName = role.RoleName; newRole.RoleDescription = role.RoleDescription; newRole.IsSystem = role.IsSystem; newRole.IsActive = true; newRole.IsDeleted = false; newRole.CreatedById = UserContextDetails.UserId; newRole.CreatedOn = DateTime.UtcNow; newSite.Roles.Add(newRole); } #endregion eCollabroDbContext.Repository<Site>().Insert(newSite); eCollabroDbContext.Save(); #region Change Navigation Ids List<Navigation> fxNavition = site.Navigations.ToList(); Dictionary<int, int?> dict = new Dictionary<int, int?>(); for (int i = 0; i < fxNavition.Count; i++) { if (fxNavition[i].NavigationParentId.HasValue) { int j = 0; for (; j < fxNavition.Count; j++) { if (fxNavition[i].NavigationParentId.Value.Equals(fxNavition[j].NavigationId)) { dict.Add(i, j); break; } } } else { dict.Add(i, null); } } for (int k = 0; k < dict.Count; k++) { int? m; dict.TryGetValue(k, out m); if (m == null) { newSite.Navigations.ToList()[k].NavigationParentId = null; } else { newSite.Navigations.ToList()[k].NavigationParentId = newSite.Navigations.ToList()[m.Value].NavigationId; } } eCollabroDbContext.Save(); #endregion } else { throw new DBConcurrencyException(); } }
/// <summary> /// SaveNavigation /// </summary> /// <param name="navigation"></param> public void SaveNavigation(Navigation navigation) { #region Check Permission List<PermissionEnum> userPermissions = GetUserFeaturePermissions(UserContextDetails.UserId, FeatureEnum.Navigation); if ((navigation.NavigationId.Equals(0) && !userPermissions.Contains(PermissionEnum.AddContent)) || (!navigation.NavigationId.Equals(0) && !userPermissions.Contains(PermissionEnum.EditContent))) throw new BusinessException(_coreValidationResourceManager.GetString(CoreValidationMessagesConstants.UnAuthorized), CoreValidationMessagesConstants.UnAuthorized); #endregion if (navigation.NavigationId.Equals(0)) // Adding Navigation { navigation.NavigationCode = _commonManager.GetNextCode(EntityConstants.Navigation); navigation.SiteId = UserContextDetails.SiteId; navigation.CreatedById = UserContextDetails.UserId; navigation.CreatedOn = DateTime.UtcNow; eCollabroDbContext.Repository<Navigation>().Insert(navigation); eCollabroDbContext.Save(); } else // Updating Navigation { Navigation oldNavigation = eCollabroDbContext.Repository<Navigation>().Find(navigation.NavigationId); if (oldNavigation != null) { oldNavigation.NavigationText = navigation.NavigationText; oldNavigation.AdditionalHtml = navigation.AdditionalHtml; oldNavigation.SiteId = UserContextDetails.SiteId; oldNavigation.NavigationParentId = navigation.NavigationParentId; oldNavigation.NavigationTypeId = navigation.NavigationTypeId; oldNavigation.FeatureId = navigation.FeatureId; oldNavigation.ContentPageId = navigation.ContentPageId; oldNavigation.Link = navigation.Link; oldNavigation.DisplayOrder = navigation.DisplayOrder; oldNavigation.IsAnomynousAccess = navigation.IsAnomynousAccess; oldNavigation.IsActive = navigation.IsActive; oldNavigation.ModifiedOn = DateTime.UtcNow; oldNavigation.ModifiedById = UserContextDetails.UserId; eCollabroDbContext.Save(); } else { throw new DBConcurrencyException(); } } }
/// <summary> /// SaveSiteFeatures /// </summary> /// <param name="lstFeatures"></param> /// <param name="siteId"></param> public void SaveSiteFeatures(List<int> lstFeatures, int siteId, bool isCreateNavigationChecked) { if (!CheckSiteCollectionAdmin(UserContextDetails.UserId)) { throw new BusinessException(_coreValidationResourceManager.GetString(CoreValidationMessagesConstants.UnAuthorized), CoreValidationMessagesConstants.UnAuthorized); } SaveSiteFeatures(lstFeatures, siteId); if (isCreateNavigationChecked) { List<FeatureResult> siteFeatures = eCollabroDbContext.ExtendedRepository().SecurityRepository.GetSiteFeatures(siteId).Where(fx => fx.IsAssigned.HasValue && fx.IsAssigned.Value && fx.IsNavigationLink).ToList(); List<Navigation> navigationsLst = new List<Navigation>(); var navLst = eCollabroDbContext.ExtendedRepository().SecurityRepository.GetNavigations(UserContextDetails.SiteId); foreach (FeatureResult feature in siteFeatures) { if (!navLst.Where(c => c.FeatureId.Equals(feature.FeatureId)).Any()) { var module = navLst.Where(fx => fx.NavigationText.Equals(feature.ModuleName)).FirstOrDefault(); if (module == null) { // Add top menu (Module Name) Navigation navigation = new Navigation(); navigation.NavigationCode = _commonManager.GetNextCode(EntityConstants.Navigation); navigation.NavigationText = feature.ModuleName; navigation.SiteId = siteId; navigation.NavigationTypeId = (int)NavigationTypeEnum.None; // None for top Menu navigation.FeatureId = feature.FeatureId; navigation.IsAnomynousAccess = false; // Default no anonymous access navigation.IsActive = true; navigation.CreatedOn = DateTime.UtcNow; navigation.CreatedById = UserContextDetails.UserId; eCollabroDbContext.Repository<Navigation>().Insert(navigation); eCollabroDbContext.Save(); navigationsLst.Add(navigation); navLst.Add(new NavigationResult { NavigationId = navigation.NavigationId, NavigationText = navigation.NavigationText }); // added to search in loop } else { //Add Module Features (Sub Menu) Navigation navigationc = new Navigation { NavigationCode = _commonManager.GetNextCode(EntityConstants.Navigation), NavigationText = feature.FeatureName, SiteId = siteId, NavigationTypeId = (int)NavigationTypeEnum.Feature, FeatureId = feature.FeatureId, IsAnomynousAccess = false, // Need to change NavigationParentId = module.NavigationId, IsActive = true, CreatedOn = DateTime.UtcNow, CreatedById = UserContextDetails.UserId }; navigationsLst.Add(navigationc); } } } List<Navigation> notSavedList = navigationsLst.Where(fx => fx.NavigationId.Equals(0)).ToList(); notSavedList.ForEach(fx => eCollabroDbContext.Repository<Navigation>().Insert(fx)); eCollabroDbContext.Save(); } }
/// <summary> /// SetupEcollabro /// </summary> /// <param name="adminUser"></param> public void SetupEcollabro(UserMembership adminUser) { if (IsEcollabroSetupReady()) throw new BusinessException(_coreValidationResourceManager.GetString(CoreValidationMessagesConstants.eCollabroAlreadySetup), CoreValidationMessagesConstants.eCollabroAlreadySetup); else { KeyValuePair<string, string> pass = DataEncryption.CreateHashedText(DataEncryption.Decrypt(adminUser.Password), true); //language eCollabroDbContext.Repository<lkpLanguage>().Insert(new lkpLanguage { Language = "English", LanguageCode = "en-US", CreatedById = 1, CreatedOn = DateTime.UtcNow, IsActive = true }); //Code Formats eCollabroDbContext.Repository<CodeFormat>().Insert(new CodeFormat { EntityName = "Role", Suffix = "", Prefix = "RL", CurrentSeed = 1, Seprator = "", Codelength = 10 }); eCollabroDbContext.Repository<CodeFormat>().Insert(new CodeFormat { EntityName = "Site", Suffix = "", Prefix = "ST", CurrentSeed = 1, Seprator = "", Codelength = 10 }); eCollabroDbContext.Repository<CodeFormat>().Insert(new CodeFormat { EntityName = "Module", Suffix = "", Prefix = "MD", CurrentSeed = 2, Seprator = "", Codelength = 10 }); eCollabroDbContext.Repository<CodeFormat>().Insert(new CodeFormat { EntityName = "Feature", Suffix = "", Prefix = "FT", CurrentSeed = 9, Seprator = "", Codelength = 10 }); eCollabroDbContext.Repository<CodeFormat>().Insert(new CodeFormat { EntityName = "Navigation", Suffix = "", Prefix = "NAV", CurrentSeed = 13, Seprator = "", Codelength = 10 }); //navigation type eCollabroDbContext.Repository<lkpNavigationType>().Insert(new lkpNavigationType { NavigationTypeCode = "NAVTYP0001", NavigationType = "None", CreatedById = 1, CreatedOn = DateTime.UtcNow, IsActive = true }); eCollabroDbContext.Repository<lkpNavigationType>().Insert(new lkpNavigationType { NavigationTypeCode = "NAVTYP0002", NavigationType = "Content", CreatedById = 1, CreatedOn = DateTime.UtcNow, IsActive = true }); eCollabroDbContext.Repository<lkpNavigationType>().Insert(new lkpNavigationType { NavigationTypeCode = "NAVTYP0003", NavigationType = "Feature", CreatedById = 1, CreatedOn = DateTime.UtcNow, IsActive = true }); eCollabroDbContext.Repository<lkpNavigationType>().Insert(new lkpNavigationType { NavigationTypeCode = "NAVTYP0004", NavigationType = "Link", CreatedById = 1, CreatedOn = DateTime.UtcNow, IsActive = true }); //Module - Setup Module moduleSetup = new Module { ModuleCode = "MD00000001", ModuleName = "Setup", ModuleDescription = "Site Settings/Setup Options", CreatedById = 1, CreatedOn = DateTime.UtcNow }; moduleSetup.Features.Add(new Feature { FeatureCode = "FT00000001", FeatureName = "Manage Roles", IsNavigationLink = true, Link = "/security/roles", CreatedById = 1, CreatedOn = DateTime.UtcNow, IsActive = true }); moduleSetup.Features.Add(new Feature { FeatureCode = "FT00000002", FeatureName = "Manage Users", IsNavigationLink = true, Link = "/security/users", CreatedById = 1, CreatedOn = DateTime.UtcNow, IsActive = true }); moduleSetup.Features.Add(new Feature { FeatureCode = "FT00000003", FeatureName = "Manage Navigations", IsNavigationLink = true, Link = "/security/navigations", CreatedById = 1, CreatedOn = DateTime.UtcNow, IsActive = true }); moduleSetup.Features.Add(new Feature { FeatureCode = "FT00000004", FeatureName = "Site Configuration", IsNavigationLink = true, Link = "/security/siteconfiguration", CreatedById = 1, CreatedOn = DateTime.UtcNow, IsActive = true }); //Module Content Module moduleContent = new Module { ModuleCode = "MD00000002", ModuleName = "Content", ModuleDescription = "Content Module - Blog, Document Library, Image Gallery, Content Pages & Announcements", CreatedById = 1, CreatedOn = DateTime.UtcNow }; moduleContent.Features.Add(new Feature { FeatureCode = "FT00000005", FeatureName = "Manage Content Pages", IsNavigationLink = true, Link = "/content/contentpage/categories", CreatedById = 1, CreatedOn = DateTime.UtcNow, IsActive = true }); moduleContent.Features.Add(new Feature { FeatureCode = "FT00000006", FeatureName = "Manage Blogs", IsNavigationLink = true, Link = "/content/blog/blogcategories", CreatedById = 1, CreatedOn = DateTime.UtcNow, IsActive = true }); moduleContent.Features.Add(new Feature { FeatureCode = "FT00000007", FeatureName = "Manage Document Libraries", IsNavigationLink = true, Link = "/content/documentlibrary/documentlibraries", CreatedById = 1, CreatedOn = DateTime.UtcNow, IsActive = true }); moduleContent.Features.Add(new Feature { FeatureCode = "FT00000008", FeatureName = "Manage Image Galleries", IsNavigationLink = true, Link = "/content/imagegallery/imagegalleries", CreatedById = 1, CreatedOn = DateTime.UtcNow, IsActive = true }); moduleContent.Features.Add(new Feature { FeatureCode = "FT00000009", FeatureName = "Manage Announcements", IsNavigationLink = true, Link = "/content/announcement/announcements", CreatedById = 1, CreatedOn = DateTime.UtcNow, IsActive = true }); eCollabroDbContext.Repository<Module>().Insert(moduleSetup); eCollabroDbContext.Repository<Module>().Insert(moduleContent); //Context eCollabroDbContext.Repository<lkpContext>().Insert(new lkpContext { Context = "User", IsActive = true, CreatedById = 1, CreatedOn = DateTime.UtcNow }); eCollabroDbContext.Repository<lkpContext>().Insert(new lkpContext { Context = "Content Page", IsActive = true, CreatedById = 1, CreatedOn = DateTime.UtcNow }); eCollabroDbContext.Repository<lkpContext>().Insert(new lkpContext { Context = "Blog", IsActive = true, CreatedById = 1, CreatedOn = DateTime.UtcNow }); eCollabroDbContext.Repository<lkpContext>().Insert(new lkpContext { Context = "Document", IsActive = true, CreatedById = 1, CreatedOn = DateTime.UtcNow }); eCollabroDbContext.Repository<lkpContext>().Insert(new lkpContext { Context = "Image", IsActive = true, CreatedById = 1, CreatedOn = DateTime.UtcNow }); eCollabroDbContext.Repository<lkpContext>().Insert(new lkpContext { Context = "Announcement", IsActive = true, CreatedById = 1, CreatedOn = DateTime.UtcNow }); //Content Permission eCollabroDbContext.Repository<ContentPermission>().Insert(new ContentPermission { ContentPermissionName = "View Content", ContentPermissionDescription = "View Content" }); eCollabroDbContext.Repository<ContentPermission>().Insert(new ContentPermission { ContentPermissionName = "View Unapproved Content", ContentPermissionDescription = "View Unapproved Content" }); eCollabroDbContext.Repository<ContentPermission>().Insert(new ContentPermission { ContentPermissionName = "View Inactive Content", ContentPermissionDescription = "View Inactive Content" }); eCollabroDbContext.Repository<ContentPermission>().Insert(new ContentPermission { ContentPermissionName = "Add Content", ContentPermissionDescription = "Add Content" }); eCollabroDbContext.Repository<ContentPermission>().Insert(new ContentPermission { ContentPermissionName = "Edit Content", ContentPermissionDescription = "Edit Content" }); eCollabroDbContext.Repository<ContentPermission>().Insert(new ContentPermission { ContentPermissionName = "Delete Content", ContentPermissionDescription = "Delete Content" }); eCollabroDbContext.Repository<ContentPermission>().Insert(new ContentPermission { ContentPermissionName = "Approve Content", ContentPermissionDescription = "Approve Content" }); //Content Setting eCollabroDbContext.Repository<ContentSetting>().Insert(new ContentSetting { ContentSettingName = "Approval Required", ContentSettingDescription = "Approval Required" }); // Site Site site = new Site { SiteCode = "ST00000001", SiteName = "Primary", SiteDesc = "Primary Site", CreatedById = 1, CreatedOn = DateTime.UtcNow, IsActive = true }; site.Roles.Add(new Role { RoleCode = "RL00000001", RoleName = "Site Admin", RoleDescription = "Site Admin role has access to all options available for Site.", CreatedById = 1, CreatedOn = DateTime.UtcNow, IsActive = true, IsSystem = true }); eCollabroDbContext.Repository<Site>().Insert(site); // setup admin user adminUser.PasswordChangedDate = DateTime.UtcNow; adminUser.Password = pass.Key; adminUser.PasswordSalt = pass.Value; adminUser.CreatedById = 1; adminUser.CreatedOn = DateTime.UtcNow; adminUser.IsConfirmed = true; adminUser.IsActive = true; adminUser.IsApproved = true; adminUser.SiteCollectionAdmins.Add(new SiteCollectionAdmin { CreatedById = 1, CreatedOn = DateTime.UtcNow }); eCollabroDbContext.Repository<UserMembership>().Insert(adminUser); eCollabroDbContext.Save(); eCollabroDbContext.Repository<Navigation>().Insert(new Navigation { NavigationCode = "NAV0000001", NavigationText = "Home", AdditionalHtml = "<span class=\"glyphicon glyphicon-home\"></span> ", SiteId = site.SiteId, NavigationTypeId = 4, Link = "/", CreatedById = 1, CreatedOn = DateTime.UtcNow, IsAnomynousAccess = true, DisplayOrder = 1, IsActive = true }); eCollabroDbContext.Repository<Navigation>().Insert(new Navigation { NavigationCode = "NAV0000002", NavigationText = "Dashboard", AdditionalHtml = "<span class=\"glyphicon glyphicon-dashboard\"></span> ", SiteId = site.SiteId, NavigationTypeId = 4, Link = "/home/dashboard", CreatedById = 1, CreatedOn = DateTime.UtcNow, IsAnomynousAccess = false, DisplayOrder = 2, IsActive = true }); Navigation navigationSetup = new Navigation { NavigationCode = "NAV0000003", NavigationText = "Setup", SiteId = site.SiteId, NavigationTypeId = 1, CreatedById = 1, CreatedOn = DateTime.UtcNow, IsAnomynousAccess = false, DisplayOrder = 3, IsActive = true }; Navigation navigationContent = new Navigation { NavigationCode = "NAV0000008", NavigationText = "Content", SiteId = site.SiteId, NavigationTypeId = 1, CreatedById = 1, CreatedOn = DateTime.UtcNow, IsAnomynousAccess = false, DisplayOrder = 8, IsActive = true }; eCollabroDbContext.Repository<Navigation>().Insert(navigationSetup); eCollabroDbContext.Repository<Navigation>().Insert(navigationContent); eCollabroDbContext.Save(); eCollabroDbContext.Repository<Navigation>().Insert(new Navigation { NavigationCode = "NAV0000004", NavigationText = "Roles", SiteId = site.SiteId, NavigationParentId = navigationSetup.NavigationId, NavigationTypeId = 3, FeatureId = 1, CreatedById = 1, CreatedOn = DateTime.UtcNow, IsAnomynousAccess = false, DisplayOrder = 4, IsActive = true }); eCollabroDbContext.Repository<Navigation>().Insert(new Navigation { NavigationCode = "NAV0000005", NavigationText = "Users", SiteId = site.SiteId, NavigationParentId = navigationSetup.NavigationId, NavigationTypeId = 3, FeatureId = 2, CreatedById = 1, CreatedOn = DateTime.UtcNow, IsAnomynousAccess = false, DisplayOrder = 5, IsActive = true }); eCollabroDbContext.Repository<Navigation>().Insert(new Navigation { NavigationCode = "NAV0000006", NavigationText = "Navigations", SiteId = site.SiteId, NavigationParentId = navigationSetup.NavigationId, NavigationTypeId = 3, FeatureId = 3, CreatedById = 1, CreatedOn = DateTime.UtcNow, IsAnomynousAccess = false, DisplayOrder = 6, IsActive = true }); eCollabroDbContext.Repository<Navigation>().Insert(new Navigation { NavigationCode = "NAV0000007", NavigationText = "Site Settings", SiteId = site.SiteId, NavigationParentId = navigationSetup.NavigationId, NavigationTypeId = 3, FeatureId = 4, CreatedById = 1, CreatedOn = DateTime.UtcNow, IsAnomynousAccess = false, DisplayOrder = 7, IsActive = true }); eCollabroDbContext.Repository<Navigation>().Insert(new Navigation { NavigationCode = "NAV0000009", NavigationText = "Pages", SiteId = site.SiteId, NavigationParentId = navigationContent.NavigationId, NavigationTypeId = 3, FeatureId = 5, CreatedById = 1, CreatedOn = DateTime.UtcNow, IsAnomynousAccess = false, DisplayOrder = 9, IsActive = true }); eCollabroDbContext.Repository<Navigation>().Insert(new Navigation { NavigationCode = "NAV0000010", NavigationText = "Blogs", SiteId = site.SiteId, NavigationParentId = navigationContent.NavigationId, NavigationTypeId = 3, FeatureId = 6, CreatedById = 1, CreatedOn = DateTime.UtcNow, IsAnomynousAccess = false, DisplayOrder = 10, IsActive = true }); eCollabroDbContext.Repository<Navigation>().Insert(new Navigation { NavigationCode = "NAV0000011", NavigationText = "Document Libraries", SiteId = site.SiteId, NavigationParentId = navigationContent.NavigationId, NavigationTypeId = 3, FeatureId = 7, CreatedById = 1, CreatedOn = DateTime.UtcNow, IsAnomynousAccess = false, DisplayOrder = 11, IsActive = true }); eCollabroDbContext.Repository<Navigation>().Insert(new Navigation { NavigationCode = "NAV0000012", NavigationText = "Image Galleries", SiteId = site.SiteId, NavigationParentId = navigationContent.NavigationId, NavigationTypeId = 3, FeatureId = 8, CreatedById = 1, CreatedOn = DateTime.UtcNow, IsAnomynousAccess = false, DisplayOrder = 12, IsActive = true }); eCollabroDbContext.Repository<Navigation>().Insert(new Navigation { NavigationCode = "NAV0000013", NavigationText = "Announcements", SiteId = site.SiteId, NavigationParentId = navigationContent.NavigationId, NavigationTypeId = 3, FeatureId = 9, CreatedById = 1, CreatedOn = DateTime.UtcNow, IsAnomynousAccess = false, DisplayOrder = 13, IsActive = true }); eCollabroDbContext.Repository<UserRole>().Insert(new UserRole { RoleId = site.Roles.FirstOrDefault().RoleId, SiteId = site.SiteId, UserId = adminUser.UserId, CreatedById = 1, CreatedOn = DateTime.UtcNow, IsActive = true }); //Feature Permission //Role for (int ctr = 1; ctr <= 6; ctr++) { if (ctr != 2) eCollabroDbContext.Repository<FeaturePermission>().Insert(new FeaturePermission { FeatureId = 1, PermissionId = ctr }); } //User for (int ctr = 1; ctr <= 7; ctr++) eCollabroDbContext.Repository<FeaturePermission>().Insert(new FeaturePermission { FeatureId = 2, PermissionId = ctr }); //Navigation for (int ctr = 1; ctr <= 6; ctr++) { if (ctr != 2) eCollabroDbContext.Repository<FeaturePermission>().Insert(new FeaturePermission { FeatureId = 3, PermissionId = ctr }); } //Site Settings eCollabroDbContext.Repository<FeaturePermission>().Insert(new FeaturePermission { FeatureId = 4, PermissionId = 1 }); eCollabroDbContext.Repository<FeaturePermission>().Insert(new FeaturePermission { FeatureId = 4, PermissionId = 5 }); //Content Page for (int ctr = 1; ctr <= 7; ctr++) eCollabroDbContext.Repository<FeaturePermission>().Insert(new FeaturePermission { FeatureId = 5, PermissionId = ctr }); //Blogs for (int ctr = 1; ctr <= 7; ctr++) eCollabroDbContext.Repository<FeaturePermission>().Insert(new FeaturePermission { FeatureId = 6, PermissionId = ctr }); //Document Library for (int ctr = 1; ctr <= 7; ctr++) eCollabroDbContext.Repository<FeaturePermission>().Insert(new FeaturePermission { FeatureId = 7, PermissionId = ctr }); //Image Gallery for (int ctr = 1; ctr <= 7; ctr++) eCollabroDbContext.Repository<FeaturePermission>().Insert(new FeaturePermission { FeatureId = 8, PermissionId = ctr }); //Announcement for (int ctr = 1; ctr <= 7; ctr++) eCollabroDbContext.Repository<FeaturePermission>().Insert(new FeaturePermission { FeatureId = 9, PermissionId = ctr }); //Content Setting eCollabroDbContext.Repository<FeatureContentSetting>().Insert(new FeatureContentSetting { FeatureId = 2, ContentSettingId = 1 }); //User,ApprovalRequired eCollabroDbContext.Repository<FeatureContentSetting>().Insert(new FeatureContentSetting { FeatureId = 5, ContentSettingId = 1 }); //Content Page,ApprovalRequired eCollabroDbContext.Repository<FeatureContentSetting>().Insert(new FeatureContentSetting { FeatureId = 6, ContentSettingId = 1 }); //Blog,ApprovalRequired eCollabroDbContext.Repository<FeatureContentSetting>().Insert(new FeatureContentSetting { FeatureId = 7, ContentSettingId = 1 }); //Document Library,ApprovalRequired eCollabroDbContext.Repository<FeatureContentSetting>().Insert(new FeatureContentSetting { FeatureId = 8, ContentSettingId = 1 }); //Image Gallery,ApprovalRequired eCollabroDbContext.Repository<FeatureContentSetting>().Insert(new FeatureContentSetting { FeatureId = 9, ContentSettingId = 1 }); //Announcement,ApprovalRequired // add all features to primary site for (int ctr = 1; ctr <= 9; ctr++) eCollabroDbContext.Repository<SiteFeature>().Insert(new SiteFeature { SiteId = site.SiteId, FeatureId = ctr, CreatedById = 1, CreatedOn = DateTime.UtcNow }); eCollabroDbContext.Save(); ExecuteScripts(); } }