Beispiel #1
0
        public static int UpdatePortalGroup(Components.PortalGroupInfo portalGroup)
        {
            PortalGroupController portalGroupController = new PortalGroupController();
            UserCopiedCallback    callback = delegate { };
            var g = portalGroupController.GetPortalGroups().Single(pg => pg.PortalGroupId == portalGroup.PortalGroupId);

            g.PortalGroupName        = portalGroup.PortalGroupName;
            g.AuthenticationDomain   = portalGroup.AuthenticationDomain;
            g.PortalGroupDescription = portalGroup.Description;
            portalGroupController.UpdatePortalGroup(g);
            var currentPortals = PortalsOfGroup(portalGroup.PortalGroupId, portalGroup.MasterPortal.PortalID).ToList();

            foreach (var portal in currentPortals)
            {
                if (portalGroup.Portals == null || portalGroup.Portals.All(p => p.PortalID != portal.PortalID))
                {
                    portalGroupController.RemovePortalFromGroup(portal, g, false, callback);
                }
            }

            if (portalGroup.Portals != null)
            {
                foreach (var portal in portalGroup.Portals)
                {
                    if (currentPortals.All(p => p.PortalID != portal.PortalID))
                    {
                        var p = new PortalController().GetPortal(portal.PortalID);
                        portalGroupController.AddPortalToGroup(p, g, callback);
                    }
                }
            }
            return(g.PortalGroupId);
        }
Beispiel #2
0
 public static int Save(Components.PortalGroupInfo portalGroup)
 {
     if (portalGroup.PortalGroupId == -1)
     {
         return(AddPortalGroup(portalGroup));
     }
     else
     {
         return(UpdatePortalGroup(portalGroup));
     }
 }
Beispiel #3
0
        public static List <Components.PortalGroupInfo> GetSiteGroup(int PortalGroupId)
        {
            List <Components.PortalGroupInfo> info = new List <Components.PortalGroupInfo>();
            PortalGroupController             portalGroupController = new PortalGroupController();
            List <MasterPortal> portals = new List <MasterPortal>();

            if (PortalGroupId == -1)
            {
                Components.PortalGroupInfo portalGroupInfo = new Components.PortalGroupInfo();
                portalGroupInfo.PortalGroupId = PortalGroupId;
                portalGroupInfo.Portals       = Portals(PortalGroupId);
                info.Add(portalGroupInfo);
            }
            else
            {
                info = SiteGroups().Where(p => p.PortalGroupId == PortalGroupId).ToList();
            }

            return(info);
        }
Beispiel #4
0
        public static int AddPortalGroup(Components.PortalGroupInfo portalGroup)
        {
            PortalGroupController portalGroupController = new PortalGroupController();
            UserCopiedCallback    callback = delegate { };
            var group = new DotNetNuke.Entities.Portals.PortalGroupInfo
            {
                AuthenticationDomain   = portalGroup.AuthenticationDomain,
                MasterPortalId         = portalGroup.MasterPortal.PortalID,
                PortalGroupDescription = portalGroup.Description,
                PortalGroupName        = portalGroup.PortalGroupName
            };

            portalGroupController.AddPortalGroup(@group);
            if (portalGroup.Portals != null)
            {
                foreach (var portal in portalGroup.Portals)
                {
                    var p = new PortalController().GetPortal(portal.PortalID);
                    portalGroupController.AddPortalToGroup(p, @group, callback);
                }
            }
            return(@group.PortalGroupId);
        }
Beispiel #5
0
        public static List <Components.PortalGroupInfo> SiteGroups()
        {
            List <Components.PortalGroupInfo> info = new List <Components.PortalGroupInfo>();
            PortalGroupController             portalGroupController = new PortalGroupController();

            foreach (var item in portalGroupController.GetPortalGroups())
            {
                Components.PortalGroupInfo portalGroupInfo = new Components.PortalGroupInfo();
                portalGroupInfo.PortalGroupId        = item.PortalGroupId;
                portalGroupInfo.AuthenticationDomain = item.AuthenticationDomain;
                portalGroupInfo.Description          = item.PortalGroupDescription;
                portalGroupInfo.PortalGroupName      = item.PortalGroupName;

                MasterPortal masterPortal = new MasterPortal();
                masterPortal.PortalID        = item.MasterPortalId;
                masterPortal.PortalName      = item.MasterPortalName;
                portalGroupInfo.MasterPortal = masterPortal;

                portalGroupInfo.Portals = Portals(item.PortalGroupId);

                info.Add(portalGroupInfo);
            }
            return(info);
        }
 public void Update(Components.PortalGroupInfo groupInfo)
 {
     SiteGroupManager.Save(groupInfo);
 }