本文整理汇总了C#中BoxSocial.Internals.User类的典型用法代码示例。如果您正苦于以下问题:C# User类的具体用法?C# User怎么用?C# User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
User类属于BoxSocial.Internals命名空间,在下文中一共展示了User类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BirthdayEvent
public BirthdayEvent(Core core, User owner, User user, int year)
: base(core)
{
this.owner = owner;
this.user = user;
if (!user.IsFriend(owner.ItemKey))
{
throw new InvalidEventException();
}
UnixTime tz = new UnixTime(core, user.UserInfo.TimeZoneCode);
this.eventId = ~user.Id;
this.subject = user.TitleNameOwnership + " birthday";
this.description = string.Empty;
this.views = 0;
this.attendeeCount = 0;
this.ownerKey = new ItemKey(owner.Id, owner.TypeId);
this.userId = user.Id;
this.startTimeRaw = tz.GetUnixTimeStamp(new DateTime(year, user.Profile.DateOfBirth.Month, user.Profile.DateOfBirth.Day, 0, 0, 0));
this.endTimeRaw = tz.GetUnixTimeStamp(new DateTime(year, user.Profile.DateOfBirth.Month, user.Profile.DateOfBirth.Day, 23, 59, 59));
this.allDay = true;
this.invitees = 0;
this.category = 0;
this.location = string.Empty;
}
示例2: UserGuestBook
public UserGuestBook(Core core, User owner)
: base(core)
{
this.db = core.Db;
this.owner = owner;
}
示例3: FriendGroup
public FriendGroup(Core core, User owner, DataRow friendGroupRow)
: base(core)
{
ItemLoad += new ItemLoadHandler(FriendGroup_ItemLoad);
this.owner = owner;
loadItemInfo(friendGroupRow);
}
示例4: ForumMember
public ForumMember(Core core, Primitive owner, User user)
: base(core)
{
ItemLoad += new ItemLoadHandler(ForumMember_ItemLoad);
// load the info into a the new object being created
this.userInfo = user.UserInfo;
this.userProfile = user.Profile;
this.userStyle = user.Style;
this.userId = user.UserId;
this.userName = user.UserName;
this.domain = user.UserDomain;
this.emailAddresses = user.EmailAddresses;
SelectQuery sQuery = ForumMember.GetSelectQueryStub(core, typeof(ForumMember));
sQuery.AddCondition("user_id", user.Id);
sQuery.AddCondition("item_id", owner.Id);
sQuery.AddCondition("item_type_id", owner.TypeId);
try
{
System.Data.Common.DbDataReader memberReader = core.Db.ReaderQuery(sQuery);
if (memberReader.HasRows)
{
memberReader.Read();
loadItemInfo(memberReader);
memberReader.Close();
memberReader.Dispose();
}
else
{
memberReader.Close();
memberReader.Dispose();
throw new InvalidForumMemberException();
}
}
catch (InvalidItemException)
{
throw new InvalidForumMemberException();
}
}
示例5: TopicReplied
public TopicReplied(Core core, User user, long topicId)
: base(core)
{
ItemLoad += new ItemLoadHandler(TopicReplied_ItemLoad);
SelectQuery query = GetSelectQueryStub();
query.AddCondition("topic_id", topicId);
query.AddCondition("user_id", user.Id);
DataTable itemTable = db.Query(query);
if (itemTable.Rows.Count == 1)
{
loadItemInfo(itemTable.Rows[0]);
}
else
{
throw new InvalidTopicReadStatusException();
}
}
示例6: MusicianMember
public MusicianMember(Core core, Musician owner, User user)
: base(core)
{
// load the info into a the new object being created
this.userInfo = user.UserInfo;
this.userProfile = user.Profile;
this.userStyle = user.Style;
this.userId = user.UserId;
this.userName = user.UserName;
this.domain = user.UserDomain;
this.emailAddresses = user.EmailAddresses;
SelectQuery sQuery = MusicianMember.GetSelectQueryStub(core, typeof(MusicianMember));
sQuery.AddCondition("user_id", user.Id);
sQuery.AddCondition("musician_id", owner.Id);
try
{
System.Data.Common.DbDataReader reader = core.Db.ReaderQuery(sQuery);
if (reader.HasRows)
{
reader.Read();
loadItemInfo(typeof(MusicianMember), reader);
reader.Close();
reader.Dispose();
}
else
{
reader.Close();
reader.Dispose();
throw new InvalidMusicianMemberException();
}
}
catch (InvalidItemException)
{
throw new InvalidMusicianMemberException();
}
}
示例7: GetFriendItems
public static List<StatusMessage> GetFriendItems(Core core, User owner, int limit, int page)
{
if (core == null)
{
throw new NullCoreException();
}
List<long> friendIds = owner.GetFriendIds();
List<StatusMessage> feedItems = new List<StatusMessage>();
if (friendIds.Count > 0)
{
SelectQuery query = StatusMessage.GetSelectQueryStub(core, typeof(StatusMessage));
query.AddSort(SortOrder.Descending, "status_time_ut");
query.AddCondition("user_id", ConditionEquality.In, friendIds);
query.LimitCount = limit;
query.LimitStart = (page - 1) * limit;
// if limit is less than 10, we will only get one for each member
if (limit < 10)
{
//query.AddGrouping("user_id");
// WHERE current
}
System.Data.Common.DbDataReader feedReader = core.Db.ReaderQuery(query);
core.LoadUserProfiles(friendIds);
while(feedReader.Read())
{
feedItems.Add(new StatusMessage(core, core.PrimitiveCache[(long)feedReader["user_id"]], feedReader));
}
feedReader.Close();
feedReader.Dispose();
}
return feedItems;
}
示例8: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
string profileUserName = Request.QueryString["un"];
User profileOwner;
try
{
profileOwner = new User(core, profileUserName);
}
catch
{
core.Functions.Generate404();
return;
}
Response.ContentType = "text/css";
Response.Clear();
// don't allow to load up external stylesheets
if (profileOwner.Style != null)
{
Response.Write(Regex.Replace(profileOwner.Style.RawCss, "\\@import(.+?)\\;", "", RegexOptions.IgnoreCase));
}
if (db != null)
{
db.CloseConnection();
}
core.Prose.Close();
//core.Dispose();
//core = null;
Response.End();
}
示例9: GetNewerItems
public static List<Action> GetNewerItems(Core core, User owner, long newerThanOffset)
{
List<Action> feedItems = new List<Action>(10);
SelectQuery query = Action.GetSelectQueryStub(core, typeof(Action));
query.AddSort(SortOrder.Descending, "action_time_ut");
query.LimitCount = 20;
List<long> friendIds = new List<long> { owner.Id };
QueryCondition qc1 = query.AddCondition("action_id", ConditionEquality.GreaterThan, newerThanOffset);
List<IPermissibleItem> tempMessages = new List<IPermissibleItem>(10);
List<Action> tempActions = new List<Action>(10);
System.Data.Common.DbDataReader feedReader = core.Db.ReaderQuery(query);
if (!feedReader.HasRows)
{
feedReader.Close();
feedReader.Dispose();
return feedItems;
}
while (feedReader.Read())
{
Action action = new Action(core, owner, feedReader);
tempActions.Add(action);
}
feedReader.Close();
feedReader.Dispose();
foreach (Action action in tempActions)
{
core.ItemCache.RequestItem(new ItemKey(action.ActionItemKey.GetType(core).ApplicationId, ItemType.GetTypeId(core, typeof(ApplicationEntry))));
}
foreach (Action action in tempActions)
{
core.ItemCache.RequestItem(action.ActionItemKey);
if (!action.ActionItemKey.Equals(action.InteractItemKey))
{
core.ItemCache.RequestItem(action.InteractItemKey);
}
}
foreach (Action action in tempActions)
{
tempMessages.Add(action.PermissiveParent);
}
if (tempMessages.Count > 0)
{
core.AcessControlCache.CacheGrants(tempMessages);
}
foreach (Action action in tempActions)
{
if (action.PermissiveParent.Access.Can("VIEW"))
{
if (feedItems.Count == 10)
{
break;
}
else
{
feedItems.Add(action);
}
}
}
return feedItems;
}
示例10: GetCan
public void GetCan(ushort accessBits, User viewer, out bool canRead, out bool canComment, out bool canCreate, out bool canChange)
{
bool isNetworkMember = IsNetworkMember(viewer.ItemKey);
switch (NetworkType)
{
case NetworkTypes.Country:
case NetworkTypes.Global:
if (isNetworkMember)
{
canRead = true;
canComment = true;
canCreate = true;
canChange = false;
}
else
{
canRead = true;
canComment = false;
canCreate = false;
canChange = false;
}
break;
case NetworkTypes.University:
case NetworkTypes.School:
case NetworkTypes.Workplace:
if (isNetworkMember)
{
canRead = true;
canComment = true;
canCreate = true;
canChange = false;
}
else
{
canRead = false;
canComment = false;
canCreate = false;
canChange = false;
}
break;
default:
canRead = false;
canComment = false;
canCreate = false;
canChange = false;
break;
}
}
示例11: CanModerateComments
public override bool CanModerateComments(User member)
{
return false;
}
示例12: Activate
/// <summary>
/// returns true on success
/// </summary>
/// <param name="page"></param>
/// <param name="member"></param>
/// <returns></returns>
public bool Activate(TPage page, User member, string activateKey)
{
long rowsChanged = db.UpdateQuery(string.Format("UPDATE network_members SET member_active = 1 WHERE network_id = {0} AND user_id = {1} AND member_activate_code = '{2}' AND member_active = 0;",
networkId, member.UserId, activateKey));
db.UpdateQuery(string.Format("UPDATE network_info SET network_members = network_members + {1} WHERE network_id = {0}",
networkId, rowsChanged));
if (rowsChanged == 1)
{
networkMemberCache.Add(member.ItemKey, true);
return true;
}
else
{
return false;
}
}
示例13: GetUserNetworks
public static List<Network> GetUserNetworks(Core core, User member)
{
List<Network> networks = new List<Network>();
SelectQuery query = Network.GetSelectQueryStub(core, NetworkLoadOptions.All);
query.AddJoin(JoinTypes.Inner, new DataField(typeof(Network), "network_id"), new DataField(typeof(NetworkMember), "network_id"));
query.AddCondition("user_id", member.Id);
DataTable networksTable = core.Db.Query(query);
foreach (DataRow dr in networksTable.Rows)
{
networks.Add(new Network(core, dr, NetworkLoadOptions.Common));
}
return networks;
}
示例14: GetNetworkMemberships
public static List<NetworkMember> GetNetworkMemberships(Core core, User member)
{
List<NetworkMember> memberships = new List<NetworkMember>();
SelectQuery query = NetworkMember.GetSelectQueryStub(core, UserLoadOptions.Key);
query.AddCondition("user_id", member.Id);
DataTable membershipsTable = core.Db.Query(query);
foreach (DataRow dr in membershipsTable.Rows)
{
memberships.Add(new NetworkMember(core, dr, UserLoadOptions.Key));
}
return memberships;
}
示例15: IsItemOwner
public override bool IsItemOwner(User member)
{
return false;
}