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


C# Link.CreateLinkXML方法代码示例

本文整理汇总了C#中Link.CreateLinkXML方法的典型用法代码示例。如果您正苦于以下问题:C# Link.CreateLinkXML方法的具体用法?C# Link.CreateLinkXML怎么用?C# Link.CreateLinkXML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Link的用法示例。


在下文中一共展示了Link.CreateLinkXML方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateLinksList

        /// <summary>
        /// Accesses DB and creates Links List.
        /// Links created by users.
        /// </summary>
        /// <param name="userID">The user of the links to get</param>
        /// <param name="siteID">Site of the links</param>
        /// <param name="skip">number of links to skip</param>
        /// <param name="show">number to show</param>
        /// <param name="showPrivate">Indicates whether private links should be included.</param>
        /// <returns>Whether created ok</returns>
        public bool CreateLinksList(int userID, int siteID, int skip, int show, bool showPrivate)
        {
            // check object is not already initialised
            if (userID <= 0 || show <= 0)
            {
                return false;
            }

            XmlElement list = AddElementTag(RootElement, "LINKS-LIST");
            AddAttribute(list, "SKIP", skip);
            AddAttribute(list, "SHOW", show);

            using (IDnaDataReader dataReader = InputContext.CreateDnaDataReader("getmorelinks"))
            {
                dataReader.AddParameter("userid", userID);
                dataReader.AddParameter("linkgroup", String.Empty);
                dataReader.AddParameter("showprivate", showPrivate);
                dataReader.AddParameter("siteid", InputContext.CurrentSite.SiteID);

                // Get +1 so we know if there are more left
                dataReader.AddParameter("skip", skip);
                dataReader.AddParameter("show", show + 1);

                dataReader.Execute();

                if (dataReader.HasRows)
                {
                    //1st Result set gets user details.
                    if (dataReader.Read())
                    {
                        User user = new User(InputContext);
                        user.AddUserXMLBlock(dataReader, userID, list);
                        dataReader.NextResult();
                    }

                    //Paged List of Links / Clippings / Bookmarks .
                    int count = 0;
                    Link link = new Link(InputContext);
                    while (dataReader.Read() && count < show)
                    {
                        //Delegate creation of XML to Link class.
                        link.CreateLinkXML(dataReader, list, true, false);
                        ++count;
                    }

                    // Add More Attribute Indicating there are more rows.
                    if (dataReader.Read() && count > 0)
                    {
                        AddAttribute(list, "MORE", 1);
                    }
                }
            }
            return true;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:64,代码来源:LinksList.cs


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