Developer's Guide - EPiServer World
Developer's Guide - EPiServer World
Developer's Guide - EPiServer World
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Tutorials | 107<br />
Import Necessary Namespaces<br />
First, import the necessary namespaces that will be used to display the state of referrals. The namespaces<br />
StarCommunity.Core, StarCommunity.Core.Modules.Security and StarCommunity.Modules.StarViral are described by<br />
clicking on their respective names. Make sure you add the assembly as a reference, mentioned in section 1.1.1.<br />
using StarCommunity.Core;<br />
using StarCommunity.Core.Modules.Security;<br />
using StarCommunity.Modules.StarViral;<br />
Display the State of Referrals<br />
The referrals can be retrieved easily by using the code below. If the boolean property HasRegistered is set to true, the<br />
referred user has registered, if false, the user has not registered.<br />
IUser user = (IUser)StarCommunitySystem.<br />
CurrentContext.DefaultSecurity.CurrentUser;<br />
//Get all referrals a user has made to display in a listing<br />
int totalHits = 0;<br />
ReferralCollection referrals = StarViralHandler.GetReferrals(user, 1, 10, out<br />
totalHits,<br />
new ReferralSortOrder(ReferralSortField.ReferralDate,<br />
SortDirection.Descending)<br />
);<br />
//Get the total number of referrals a user has made<br />
int myReferralCount = StarViralHandler.GetNumberOfReferrals(user, false);<br />
© <strong>EPiServer</strong> AB