override protected IEnumerable <XElement> getSpecificData(WebContext context)
        {
            PageOuter             pageOuter = PageOuter.createUnlimited(context.userSettings.usersPerPage);
            IEnumerable <Account> accounts  = Account.LoadByIds(
                from stringId in Config.instance.mainConnection.LoadIdsByConditions(
                    Account.TableSpec.instance,
                    new Web.Core.DB.conditions.ComparisonCondition(
                        Account.TableSpec.instance.getColumnSpec(Account.TableSpec.FIELD_NEEDSMIGRATION),
                        Web.Core.DB.conditions.ComparisonType.EQUAL,
                        "0"
                        ),
                    pageOuter
                    ) select int.Parse(stringId)
                );

            return(new XElement[] {
                new XElement("users",
                             from account in accounts
                             select account.user.exportToXmlForViewing(
                                 context,
                                 new XElement(
                                     "actualPosts",
                                     Config.instance.mainConnection.GetCountByConditions(
                                         Post.TableSpec.instance,
                                         new ComplexCondition(
                                             ConditionsJoinType.AND,
                                             new ComparisonCondition(
                                                 Post.TableSpec.instance.getColumnSpec(Post.TableSpec.FIELD_POSTERID),
                                                 ComparisonType.EQUAL,
                                                 account.user.id.ToString()
                                                 ),
                                             new ComparisonCondition(
                                                 Post.TableSpec.instance.getIdSpec(),
                                                 ComparisonType.GREATEROREQUAL,
                                                 Thread.FORMALREADMIN.ToString()
                                                 )
                                             )
                                         )
                                     )
                                 )
                             )
            });
        }
Esempio n. 2
0
        override protected IEnumerable <XElement> getSpecificData(WebContext context)
        {
            PageOuter             pageOuter = PageOuter.createUnlimited(context.userSettings.usersPerPage);
            IEnumerable <Session> sessions  =
                from stringId in Config.instance.mainConnection.LoadIdsByConditions(
                    Session.TableSpec.instance,
                    new ComplexCondition(
                        ConditionsJoinType.AND,
                        new ComparisonCondition(
                            Session.TableSpec.instance.getColumnSpec(Session.TableSpec.FIELD_LASTHUMANACTIVITY),
                            Web.Core.DB.conditions.ComparisonType.GREATEROREQUAL,
                            DateTime.Now.Subtract(Config.instance.ActivityThreshold).ToUTCString()
                            ),
                        new     ComparisonCondition(
                            Session.TableSpec.instance.getColumnSpec(Session.TableSpec.FIELD_ISDELETED),
                            Web.Core.DB.conditions.ComparisonType.EQUAL,
                            "0"
                            )
                        ),
                    pageOuter,
                    new JoinSpec[0],
                    new SortSpec[] {
                new SortSpec(
                    Session.TableSpec.instance.getColumnSpec(Session.TableSpec.FIELD_LASTHUMANACTIVITY),
                    false
                    ),
            }
                    ) select Session.LoadByKey(stringId);

            return(new XElement[] {
                new XElement("users",
                             from session in sessions
                             let account = session.account
                                           where !account.isStatusHidden
                                           select account.user.exportToXmlForViewing(
                                 context,
                                 new XElement("lastActivity", session.lastHumanActivity.ToXml()),
                                 !account.isDetailedStatusHidden ? new XElement("lastUrl", new XElement("url", session.lastUrl), new XElement("title", UrlManager.TryGetTitle(session.lastUrl))) : null
                                 )
                             )
            });
        }