Exemplo n.º 1
0
        public XElement exportToXmlSimple(UserContext context, Board.SubboardsOptions subboardsOptions)
        {
            XElement result = new XElement("board",
                                           new XElement("id", this.id),
                                           new XElement("name", this.name),
                                           new XElement("description", this.description),
                                           new XElement("isTopicstarterModeration", this.isTopicstarterModeration.ToPlainString()),
                                           new XElement("isTransferTarget", this.isTransferTarget.ToPlainString())
                                           );

            if ((subboardsOptions & SubboardsOptions.FirstLevel) == SubboardsOptions.FirstLevel)
            {
                result.Add(new XElement("subBoards", from board in this.subBoards select board.exportToXmlSimple(context, (subboardsOptions == SubboardsOptions.AllLevels) ? SubboardsOptions.AllLevels : SubboardsOptions.None)));
            }
            return(result);
        }
Exemplo n.º 2
0
        public XElement exportToXml(UserContext context, Board.SubboardsOptions subboardsOptions, params XElement[] additional)
        {
            XElement result = new XElement("board",
                                           new XElement("id", this.id),
                                           new XElement("sortOrder", this.sortOrder),
                                           new XElement("categoryId", this.categoryId),
                                           new XElement("totalPosts", this.totalPosts),
                                           new XElement("totalThreads", this.totalThreads),
                                           new XElement("name", this.name),
                                           new XElement("description", this.description),
                                           new XElement("lastPostInfo", this.exportLastPostInfo(context)),
                                           new XElement("moderators", from moderator in Moderator.GetModerators(this) select moderator.user.exportToXmlForViewing(context)),
                                           new XElement("isTopicstarterModeration", this.isTopicstarterModeration.ToPlainString()),
                                           new XElement("isTransferTarget", this.isTransferTarget.ToPlainString()),
                                           new XElement("administrator", this.administrator.user.exportToXmlForViewing(context, new XElement("isAdministrator", "true")))
                                           );

            if (context.account != null)
            {
                result.Add(new XElement("hasNewPosts", this.hasNewPosts(context.account).ToPlainString()));
            }

            if ((subboardsOptions & SubboardsOptions.FirstLevel) == SubboardsOptions.FirstLevel)
            {
                result.Add(new XElement("subBoards",
                                        from board in this.subBoards select board.exportToXml(context, (subboardsOptions == SubboardsOptions.AllLevels) ? SubboardsOptions.AllLevels : SubboardsOptions.None)
                                        ));
            }

            if (additional.Length > 0)
            {
                result.Add(additional);
            }

            return(result);
        }