• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Internals.User类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中BoxSocial.Internals.User的典型用法代码示例。如果您正苦于以下问题:C# User类的具体用法?C# User怎么用?C# User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



User类属于BoxSocial.Internals命名空间,在下文中一共展示了User类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: Viewed

 /// <summary>
 /// Increment the number of views
 /// </summary>
 /// <param name="viewer">Person viewing the gallery item</param>
 public void Viewed(User viewer)
 {
     if (viewer != null)
     {
         if (owner is User)
         {
             if (viewer.UserId == ((User)owner).UserId)
             {
                 return;
             }
         }
         db.UpdateQuery(string.Format("UPDATE blog_postings SET post_views = post_views + 1 WHERE post_id = {0};",
             postId));
         // otherwise just update the view count
     }
     return;
 }
开发者ID:smithydll,项目名称:boxsocial,代码行数:21,代码来源:BlogEntry.cs


示例17: ShowMore

        public static void ShowMore(Core core, User owner)
        {
            long newestId = core.Functions.RequestLong("newest-id", 0);
            long oldestId = core.Functions.RequestLong("oldest-id", 0);
            long newerId = 0;

            bool moreContent = false;
            long lastId = 0;

            List<Action> feedActions = null;

            if (newestId > 0)
            {
                feedActions = CombinedFeed.GetNewerItems(core, owner, newestId);
            }
            else
            {
                feedActions = CombinedFeed.GetItems(core, owner, 1, 20, oldestId, out moreContent);
            }

            if (feedActions != null)
            {
                JsonSerializer js;
                StringWriter jstw;
                JsonTextWriter jtw;

                js = new JsonSerializer();
                jstw = new StringWriter();
                jtw = new JsonTextWriter(jstw);

                js.NullValueHandling = NullValueHandling.Ignore;

                core.Http.WriteJson(js, feedActions);
            }

            if (core.Db != null)
            {
                core.Db.CloseConnection();
            }

            core.Http.End();
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:42,代码来源:CombinedFeed.cs


示例18: UserSettings

 public UserSettings(User user)
 {
     this.user = user;
 }
开发者ID:smithydll,项目名称:boxsocial,代码行数:4,代码来源:UserSettings.cs


示例19: ItemSubscribedEventArgs

 public ItemSubscribedEventArgs(User rater, ItemKey itemKey)
 {
     this.rater = rater;
     this.itemKey = itemKey;
 }
开发者ID:smithydll,项目名称:boxsocial,代码行数:5,代码来源:Subscription.cs


示例20: Show

        public static void Show(Core core, TPage page, User owner)
        {
            if (core == null)
            {
                throw new NullCoreException();
            }

            if (!owner.Access.Can("VIEW"))
            {
                core.Functions.Generate403();
                return;
            }

            if (core.ResponseFormat == ResponseFormats.Xml)
            {
                ShowMore(core, page, owner);
                return;
            }

            core.Template.SetTemplate("Profile", "viewfeed");

            if (core.Session.IsLoggedIn && owner == core.Session.LoggedInMember)
            {
                core.Template.Parse("OWNER", "TRUE");

            }

            core.Template.Parse("PAGE_TITLE", core.Prose.GetString("FEED"));

            PermissionGroupSelectBox permissionSelectBox = new PermissionGroupSelectBox(core, "permissions", owner.ItemKey);

            core.Template.Parse("S_STATUS_PERMISSIONS", permissionSelectBox);

            bool moreContent;
            long lastId = 0;
            bool first = true;

            List<Action> feedActions = CombinedFeed.GetItems(core, owner, page.TopLevelPageNumber, 20, page.TopLevelPageOffset, out moreContent);

            foreach (Action feedAction in feedActions)
            {
                if (first)
                {
                    first = false;
                    core.Template.Parse("NEWEST_ID", feedAction.Id.ToString());
                }

                VariableCollection feedItemVariableCollection = core.Template.CreateChild("feed_days_list.feed_item");

                core.Display.ParseBbcode(feedItemVariableCollection, "TITLE", feedAction.FormattedTitle);
                core.Display.ParseBbcode(feedItemVariableCollection, "TEXT", feedAction.Body, core.PrimitiveCache[feedAction.OwnerId], true, string.Empty, string.Empty);

                feedItemVariableCollection.Parse("USER_DISPLAY_NAME", feedAction.Owner.DisplayName);

                feedItemVariableCollection.Parse("ID", feedAction.ActionItemKey.Id);
                feedItemVariableCollection.Parse("TYPE_ID", feedAction.ActionItemKey.TypeId);

                if (feedAction.ActionItemKey.GetType(core).Likeable)
                {
                    feedItemVariableCollection.Parse("LIKEABLE", "TRUE");

                    if (feedAction.Info.Likes > 0)
                    {
                        feedItemVariableCollection.Parse("LIKES", string.Format(" {0:d}", feedAction.Info.Likes));
                        feedItemVariableCollection.Parse("DISLIKES", string.Format(" {0:d}", feedAction.Info.Dislikes));
                    }
                }

                if (feedAction.ActionItemKey.GetType(core).Commentable)
                {
                    feedItemVariableCollection.Parse("COMMENTABLE", "TRUE");

                    if (feedAction.Info.Comments > 0)
                    {
                        feedItemVariableCollection.Parse("COMMENTS", string.Format(" ({0:d})", feedAction.Info.Comments));
                    }
                }

                //Access access = new Access(core, feedAction.ActionItemKey, true);
                if (feedAction.PermissiveParent.Access.IsPublic())
                {
                    feedItemVariableCollection.Parse("IS_PUBLIC", "TRUE");
                    if (feedAction.ActionItemKey.GetType(core).Shareable)
                    {
                        feedItemVariableCollection.Parse("SHAREABLE", "TRUE");
                        //feedItemVariableCollection.Parse("U_SHARE", feedAction.ShareUri);

                        if (feedAction.Info.SharedTimes > 0)
                        {
                            feedItemVariableCollection.Parse("SHARES", string.Format(" {0:d}", feedAction.Info.SharedTimes));
                        }
                    }
                }
                else
                {
                    feedItemVariableCollection.Parse("IS_PUBLIC", "FALSE");
                    feedItemVariableCollection.Parse("SHAREABLE", "FALSE");
                }

                if (feedAction.Owner is User)
//.........这里部分代码省略.........
开发者ID:smithydll,项目名称:boxsocial,代码行数:101,代码来源:CombinedFeed.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Internal.ServerCall类代码示例发布时间:2022-05-24
下一篇:
C# Internals.Primitive类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap