November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
using System;
using EPiServer;
using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.Filters;
using EPiServer.Personalization;
using EPiServer.PlugIn;
using EPiServer.Security;
namespace testsite.Plugins
{
[GuiPlugIn("AbonnentListe", "Hvem abonnerer på hva?", PlugInArea.AdminMenu, "~/Plugins/AbonnentListe.aspx")]
public partial class AbonnentListe : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ListeTekst.Text = "";
SidCollection sids = GetAllUsers();
PageDataCollection sPages = GetSubscriberPages();
FindSubscriptions(sids, sPages);
DataBind();
}
private void FindSubscriptions(SidCollection sids, PageDataCollection sPages)
{
foreach (PageData page in sPages)
{
ListeTekst.Text += string.Format("{0} - {1} ", page.PageName, page.LinkURL);
foreach (UserSid sid in sids)
{
PersonalizedData pData = PersonalizedData.Load(sid.ID);
SubscriptionInfo subInfo= new SubscriptionInfo(pData);
if(subInfo.IsSubscribingTo(page.PageLink))
{
ListeTekst.Text += String.Format("{0} {1} {2} {3} ", sid.FirstName, sid.LastName, sid.Email, sid.Name);
}
}
}
}
private static PageDataCollection GetSubscriberPages()
{
PageDataCollection oPages;
PropertyCriteriaCollection col = new PropertyCriteriaCollection();
Statsbygg.Intranet.Custom.Library.CommonFunctions.addPropertyCriteria(col, "EPSUBSCRIBE", "true", PropertyDataType.Boolean,
CompareCondition.Equal);
oPages = EPiServer.Global.EPDataFactory.FindPagesWithCriteria(Global.EPConfig.StartPage, col, AccessLevel.Read);
return oPages;
}
private static SidCollection GetAllUsers()
{
SidCollection subscribingSids = new SidCollection();
SidCollection foundUsers = UserSid.Search(SecurityIdentityType.AnyUserSid, false, null, null, null, null, null);
foreach (UserSid sid in foundUsers)
{
subscribingSids.Add(sid);
}
return subscribingSids;
}
}
}