public static GetDefaultAppId ( int zoneId ) : int | ||
zoneId | int | |
Результат | int |
internal static void RemoveApp(int zoneId, int appId, PortalSettings ps, int userId) { if (zoneId != ZoneHelpers.GetZoneID(ps.PortalId)) { throw new Exception("This app does not belong to portal " + ps.PortalId); } //var sexy = new SxcInstance(zoneId, appId);// 2016-03-26 2dm this used to have a third parameter false = don't enable caching, which hasn't been respected for a while; removed it var eavContext = EavDataController.Instance(zoneId, appId); if (appId != eavContext.AppId) // this only happens if there is some kind of id-fallback { throw new Exception("An app can only be removed inside of it's own context."); } if (appId == AppHelpers.GetDefaultAppId(zoneId)) { throw new Exception("The default app of a zone cannot be removed."); } var sexyApp = new App(zoneId, appId, ps); // Delete folder if (!String.IsNullOrEmpty(sexyApp.Folder) && Directory.Exists(sexyApp.PhysicalPath)) { Directory.Delete(sexyApp.PhysicalPath, true); } // Delete the app eavContext.App.DeleteApp(appId); }
public static Zone AddZone(string zoneName) { return(EavDataController.Instance(Constants.DefaultZoneId, AppHelpers.GetDefaultAppId(Constants.DefaultZoneId)).Zone .AddZone(zoneName).Item1); //return // new SxcInstance(Constants.DefaultZoneId, AppHelpers.GetDefaultAppId(Constants.DefaultZoneId)).EavAppContext.Zone // .AddZone(zoneName).Item1; }
/// <summary> /// Will create a new app in the system and initialize the basic settings incl. the /// app-definition /// </summary> /// <param name="zoneId"></param> /// <param name="appName"></param> /// <param name="ownerPS"></param> /// <returns></returns> internal static App AddBrandNewApp(int zoneId, string appName, PortalSettings ownerPS) { if (appName == Constants.ContentAppName || appName == "Default" || String.IsNullOrEmpty(appName) || !Regex.IsMatch(appName, "^[0-9A-Za-z -_]+$")) { throw new ArgumentOutOfRangeException("appName '" + appName + "' not allowed"); } // Adding app to EAV var eavContext = EavDataController.Instance(zoneId, AppHelpers.GetDefaultAppId(zoneId)); var app = eavContext.App.AddApp(Guid.NewGuid().ToString()); eavContext.SqlDb.SaveChanges(); EnsureAppIsConfigured(zoneId, app.AppID, appName); return(new App(zoneId, app.AppID, ownerPS)); }
/// <summary> /// Returns all DNN Cultures with active / inactive state /// </summary> public static List <CulturesWithActiveState> GetCulturesWithActiveState(int portalId, int zoneId) { //var DefaultLanguageID = ContentContext.GetLanguageId(); var AvailableEAVLanguages = EavDataController.Instance(zoneId, AppHelpers.GetDefaultAppId(zoneId)).Dimensions.GetLanguages(); // var AvailableEAVLanguages = new SxcInstance(zoneId, AppHelpers.GetDefaultAppId(zoneId)).EavAppContext.Dimensions.GetLanguages(); var DefaultLanguageCode = new PortalSettings(portalId).DefaultLanguage; var DefaultLanguage = AvailableEAVLanguages.Where(p => p.ExternalKey == DefaultLanguageCode).FirstOrDefault(); var DefaultLanguageIsActive = DefaultLanguage != null && DefaultLanguage.Active; return((from c in LocaleController.Instance.GetLocales(portalId) select new CulturesWithActiveState { Code = c.Value.Code, Text = c.Value.Text, Active = AvailableEAVLanguages.Any(a => a.Active && a.ExternalKey == c.Value.Code && a.ZoneID == zoneId), // Allow State Change only if // 1. This is the default language and default language is not active or // 2. This is NOT the default language and default language is active AllowStateChange = (c.Value.Code == DefaultLanguageCode && !DefaultLanguageIsActive) || (DefaultLanguageIsActive && c.Value.Code != DefaultLanguageCode) }).OrderByDescending(c => c.Code == DefaultLanguageCode).ThenBy(c => c.Code).ToList()); }
public static List <Zone> GetZones() { return(EavDataController.Instance(Constants.DefaultZoneId, AppHelpers.GetDefaultAppId(Constants.DefaultZoneId)).Zone.GetZones()); //return new SxcInstance(Constants.DefaultZoneId, AppHelpers.GetDefaultAppId(Constants.DefaultZoneId)).EavAppContext.Zone.GetZones(); }