当前位置: 首页>>代码示例>>C#>>正文


C# Internals.User类代码示例

本文整理汇总了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;
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:27,代码来源:BirthdayEvent.cs

示例2: UserGuestBook

        public UserGuestBook(Core core, User owner)
            : base(core)
        {
            this.db = core.Db;

            this.owner = owner;
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:7,代码来源:UserGuestBook.cs

示例3: FriendGroup

        public FriendGroup(Core core, User owner, DataRow friendGroupRow)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(FriendGroup_ItemLoad);
            this.owner = owner;

            loadItemInfo(friendGroupRow);
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:8,代码来源:FriendGroup.cs

示例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();
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:45,代码来源:ForumMember.cs

示例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();
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:20,代码来源:TopicReplied.cs

示例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();
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:41,代码来源:MusicianMember.cs

示例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;
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:40,代码来源:StatusFeed.cs

示例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();
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:36,代码来源:userstyle.aspx.cs

示例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;
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:74,代码来源:CombinedFeed.cs

示例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;
     }
 }
开发者ID:smithydll,项目名称:boxsocial,代码行数:48,代码来源:Network.cs

示例11: CanModerateComments

 public override bool CanModerateComments(User member)
 {
     return false;
 }
开发者ID:smithydll,项目名称:boxsocial,代码行数:4,代码来源:Network.cs

示例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;
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:24,代码来源:Network.cs

示例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;
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:17,代码来源:Network.cs

示例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;
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:16,代码来源:Network.cs

示例15: IsItemOwner

 public override bool IsItemOwner(User member)
 {
     return false;
 }
开发者ID:smithydll,项目名称:boxsocial,代码行数:4,代码来源:Network.cs


注:本文中的BoxSocial.Internals.User类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。