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

C# Internals.Core类代码示例

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

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



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

示例1: ApplyRestrictions

        public static void ApplyRestrictions(Core core, Classifications classification)
        {
            if (core == null)
            {
                throw new NullCoreException();
            }

            switch (classification)
            {
                case Classifications.Restricted:
                    if (core.Session.LoggedInMember.Profile.Age < 18)
                    {
                        // TODO: Restricted content notice
                        core.Functions.Generate403();
                        return;
                    }
                    break;
                case Classifications.Mature:
                    if (core.Session.LoggedInMember.Profile.Age < 13)
                    {
                        // TODO: Restricted content notice
                        core.Functions.Generate403();
                        return;
                    }
                    else if (core.Session.LoggedInMember.Profile.Age < 15)
                    {
                        // TODO: click-through message for 13/14 year olds
                        // TODO: Restricted content notice
                        core.Functions.Generate403();
                        return;
                    }
                    break;
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:34,代码来源:Classification.cs


示例2: Category

        public Category(Core core, DataRow categoryRow)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(Category_ItemLoad);

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


示例3: HelpTopic

        public HelpTopic(Core core, DataRow helpRow)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(HelpTopic_ItemLoad);

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


示例4: Show

        public static void Show(Core core, UPage page)
        {
            core.Template.SetTemplate("GuestBook", "viewguestbook");

            page.User.LoadProfileInfo();

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

            /* pages */
            core.Display.ParsePageList(page.Owner, true);

            core.Template.Parse("PAGE_TITLE", string.Format(core.Prose.GetString("USERS_GUEST_BOOK"), page.Owner.DisplayNameOwnership));

            if (core.Session.IsLoggedIn)
            {
                if (page.User.Access.Can("COMMENT"))
                {
                    core.Template.Parse("CAN_COMMENT", "TRUE");
                }
            }

            core.Template.Parse("IS_USER_GUESTBOOK", "TRUE");

            List<string[]> breadCrumbParts = new List<string[]>();
            breadCrumbParts.Add(new string[] { "profile", core.Prose.GetString("PROFILE") });
            breadCrumbParts.Add(new string[] { "comments", core.Prose.GetString("GUEST_BOOK") });

            core.Display.DisplayComments(core.Template, page.User, page.User, UserGuestBookHook);
            core.Display.ParsePagination("COMMENT_PAGINATION", core.Hyperlink.BuildGuestBookUri(page.User), 10, page.User.Comments);
            page.User.ParseBreadCrumbs(breadCrumbParts);
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:35,代码来源:GuestBook.cs


示例5: ApplicationError

        public ApplicationError(Core core, DataRow errorRow)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(ApplicationError_ItemLoad);

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


示例6: SpamReport

        public SpamReport(Core core, DataRow reportRow)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(SpamReport_ItemLoad);

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


示例7: ReferralKey

        public ReferralKey(Core core, DataRow referralRow)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(ReferralKey_ItemLoad);

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


示例8: EventEmailInvite

        public EventEmailInvite(Core core, System.Data.Common.DbDataReader eventInviteDataRow)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(EventEmailInvite_ItemLoad);

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


示例9: NumberedItemsCache

        public NumberedItemsCache(Core core)
        {
            this.core = core;
            this.db = core.Db;

            if (itemsPersisted == null)
            {
                object o = core.Cache.GetCached("NumberedItems");

                if (o != null && o is Dictionary<NumberedItemId, NumberedItem>)
                {
                    itemsPersisted = (Dictionary<NumberedItemId, NumberedItem>)o;
                }
                else
                {
                    itemsPersisted = new Dictionary<NumberedItemId, NumberedItem>(32);
                }
            }

            if (itemsPersisted != null)
            {
                foreach (NumberedItemId nii in itemsPersisted.Keys)
                {
                    itemsCached.Add(nii, itemsPersisted[nii]);
                }
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:27,代码来源:NumberedItemsCache.cs


示例10: PrimitiveApplicationInfo

        public PrimitiveApplicationInfo(Core core, Primitive owner, long applicationId)
            : base(core)
        {
            this.owner = owner;
            ItemLoad += new ItemLoadHandler(PrimitiveApplicationInfo_ItemLoad);

            SelectQuery query = new SelectQuery(PrimitiveApplicationInfo.GetTable(typeof(PrimitiveApplicationInfo)));
            query.AddFields(PrimitiveApplicationInfo.GetFieldsPrefixed(core, typeof(PrimitiveApplicationInfo)));
            query.AddCondition("application_id", applicationId);
            query.AddCondition("item_id", owner.Id);
            query.AddCondition("item_type_id", owner.TypeId);

            DataTable appDataTable = db.Query(query);

            if (appDataTable.Rows.Count == 1)
            {
                DataRow appRow = appDataTable.Rows[0];
                try
                {
                    loadItemInfo(appRow);
                }
                catch (InvalidItemException)
                {
                    throw new InvalidPrimitiveAppInfoException();
                }
            }
            else
            {
                throw new InvalidPrimitiveAppInfoException();
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:31,代码来源:PrimitiveApplicationInfo.cs


示例11: InviteKey

        public InviteKey(Core core, DataRow inviteRow)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(InviteKey_ItemLoad);

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


示例12: RateLimit

        public RateLimit(Core core, System.Data.Common.DbDataReader rateLimitRow)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(RateLimit_ItemLoad);

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


示例13: GroupMember

        public GroupMember(Core core, UserGroup group, long userId)
            : base(core)
        {
            this.db = db;

            SelectQuery query = GetSelectQueryStub(core, UserLoadOptions.All);
            query.AddCondition("user_keys.user_id", userId);
            query.AddCondition("group_members.group_id", group.GroupId);

            System.Data.Common.DbDataReader memberReader = db.ReaderQuery(query);

            if (memberReader.HasRows)
            {
                memberReader.Read();

                loadItemInfo(memberReader);
                loadUserInfo(memberReader);
                loadUserIcon(memberReader);

                memberReader.Close();
                memberReader.Dispose();
            }
            else
            {
                memberReader.Close();
                memberReader.Dispose();

                throw new InvalidUserException();
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:30,代码来源:GroupMember.cs


示例14: ItemViewCountByHour

        public ItemViewCountByHour(Core core, DataRow viewRow)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(ItemViewCountByHour_ItemLoad);

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


示例15: PublishPost

        public static bool PublishPost(Core core, Job job)
        {
            core.LoadUserProfile(job.UserId);
            User owner = core.PrimitiveCache[job.UserId];
            ItemKey sharedItemKey = new ItemKey(job.ItemId, job.ItemTypeId);
            IActionableItem sharedItem = null;

            core.ItemCache.RequestItem(sharedItemKey);
            try
            {
                sharedItem = (IActionableItem)core.ItemCache[sharedItemKey];
            }
            catch
            {
                try
                {
                    sharedItem = (IActionableItem)NumberedItem.Reflect(core, sharedItemKey);
                    HttpContext.Current.Response.Write("<br />Fallback, had to reflect: " + sharedItemKey.ToString());
                }
                catch
                {
                    job.Cancel = true;
                    return true; // Item is probably deleted, report success to delete from queue
                }
            }

            UpdateQuery uQuery = new UpdateQuery(typeof(ItemInfo));
            uQuery.AddCondition("info_item_id", sharedItemKey.Id);
            uQuery.AddCondition("info_item_type_id", sharedItemKey.TypeId);

            try
            {
                if (owner.UserInfo.TumblrAuthenticated) // are we still authenticated
                {
                    string postDescription = job.Body;

                    Tumblr t = new Tumblr(core.Settings.TumblrApiKey, core.Settings.TumblrApiSecret);
                    TumblrPost post = t.StatusesUpdate(new TumblrAccessToken(owner.UserInfo.TumblrToken, owner.UserInfo.TumblrTokenSecret), owner.UserInfo.TumblrHostname, sharedItem.PostType, string.Empty, postDescription, sharedItem.Info.ShareUri, sharedItem.Data, sharedItem.DataContentType);

                    if (post != null)
                    {
                        uQuery.AddField("info_tumblr_post_id", post.Id);
                    }

                    core.Db.Query(uQuery);
                }
            }
            catch (System.Net.WebException ex)
            {
                HttpWebResponse response = (HttpWebResponse)ex.Response;
                if (response.StatusCode == HttpStatusCode.Forbidden)
                {
                    return true; // This request cannot succeed, so remove it from the queue
                }
                job.Error = ex.ToString();
                return false; // Failed for other reasons, retry
            }

            return true; // success
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:60,代码来源:Tumblr.cs


示例16: PublishPost

        public static bool PublishPost(Core core, Job job)
        {
            core.LoadUserProfile(job.UserId);
            User owner = core.PrimitiveCache[job.UserId];
            ItemKey sharedItemKey = new ItemKey(job.ItemId, job.ItemTypeId);
            IActionableItem sharedItem = null;

            core.ItemCache.RequestItem(sharedItemKey);
            try
            {
                sharedItem = (IActionableItem)core.ItemCache[sharedItemKey];
            }
            catch
            {
                try
                {
                    sharedItem = (IActionableItem)NumberedItem.Reflect(core, sharedItemKey);
                    HttpContext.Current.Response.Write("<br />Fallback, had to reflect: " + sharedItemKey.ToString());
                }
                catch
                {
                    return true; // Item is probably deleted, report success to delete from queue
                }
            }

            UpdateQuery uQuery = new UpdateQuery(typeof(ItemInfo));
            uQuery.AddCondition("info_item_id", sharedItemKey.Id);
            uQuery.AddCondition("info_item_type_id", sharedItemKey.TypeId);

            try
            {
                if (owner.UserInfo.FacebookAuthenticated) // are we still authenticated
                {
                    string postDescription = job.Body;

                    Facebook fb = new Facebook(core.Settings.FacebookApiAppid, core.Settings.FacebookApiSecret);

                    FacebookAccessToken token = fb.OAuthAppAccessToken(core, owner.UserInfo.FacebookUserId);
                    FacebookPost post = fb.StatusesUpdate(token, postDescription, sharedItem.Info.ShareUri, owner.UserInfo.FacebookSharePermissions);

                    if (post != null)
                    {
                        uQuery.AddField("info_facebook_post_id", post.PostId);
                    }

                    core.Db.Query(uQuery);
                }
            }
            catch (System.Net.WebException ex)
            {
                HttpWebResponse response = (HttpWebResponse)ex.Response;
                if (response.StatusCode == HttpStatusCode.Forbidden)
                {
                    return true; // This request cannot succeed, so remove it from the queue
                }
                return false; // Failed for other reasons, retry
            }

            return true; // success
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:60,代码来源:Facebook.cs


示例17: GuestBookCommentCount

        public GuestBookCommentCount(Core core, DataRow countRow)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(GuestBookCommentCount_ItemLoad);

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


示例18: Show

        public static void Show(Core core)
        {
            string path = core.Http.Query["path"];
            long ownerId = core.Functions.RequestLong("owner_id", 0);
            long ownerTypeId = core.Functions.RequestLong("owner_type_id", 0);
            ItemKey ownerKey = new ItemKey(ownerId, ownerTypeId);

            try
            {
                core.PrimitiveCache.LoadPrimitiveProfile(ownerKey);
                Primitive owner = core.PrimitiveCache[ownerKey];

                Page thePage = new Page(core, owner, path);

                JsonSerializer js;
                StringWriter jstw;
                JsonTextWriter jtw;

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

                js.NullValueHandling = NullValueHandling.Ignore;

                core.Http.WriteJson(js, thePage);
            }
            catch (PageNotFoundException)
            {

            }
            catch
            {
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:34,代码来源:Default.cs


示例19: ListType

        public ListType(Core core, DataRow typeRow)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(ListType_ItemLoad);

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


示例20: ActionItem

        public ActionItem(Core core, long actionId, long itemId, long itemTypeId)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(ActionItem_ItemLoad);

            SelectQuery query = ActionItem.GetSelectQueryStub(core, typeof(ActionItem));
            query.AddCondition("action_id", actionId);
            query.AddCondition("item_id", itemId);
            query.AddCondition("item_type_id", itemTypeId);

            System.Data.Common.DbDataReader actionReader = db.ReaderQuery(query);

            if (actionReader.HasRows)
            {
                actionReader.Read();

                loadItemInfo(actionReader);

                actionReader.Close();
                actionReader.Dispose();
            }
            else
            {
                actionReader.Close();
                actionReader.Dispose();

                throw new InvalidActionItemException();
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:29,代码来源:ActionItem.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Internals.ItemKey类代码示例发布时间:2022-05-24
下一篇:
C# Dynamics.Body类代码示例发布时间: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