/// <summary>
        /// 获取私人/团队报表
        /// </summary>
        /// <param name="db">数据库连接对象</param>
        /// <returns>返回私人/团队报表</returns>
        public PageResult<RersonalAndTeamReportExport> GetRersonalAndTeamReports(IModelToDbContextOfReport db)
        {
            if (this.PageIndex < 1) { this.PageIndex = 1; }
            SettingOfBase settingOfBase = new SettingOfBase(db);
            int startRow = settingOfBase.PageSizeForAdmin * (this.PageIndex - 1);

            if (this.TOS == TeamOrSelf.Self)
            {
                if (this.MOD == MonthOrDay.Month)
                {
                    #region 单月个人报表

                    Expression<Func<RersonalReportForOneMonth, bool>> predicate1 = x => x.Id > 0;
                    Expression<Func<RersonalReportForOneMonth, bool>> predicate2 = x => x.Id > 0;
                    Expression<Func<RersonalReportForOneMonth, bool>> predicate3 = x => x.Id > 0;
                    Expression<Func<RersonalReportForOneMonth, bool>> predicate4 = x => x.Id > 0;

                    if (this.KeywordOfUsername != null)
                    {
                        this.KeywordOfUsername = VerifyHelper.EliminateSpaces(this.KeywordOfUsername);
                        string[] keywords = this.KeywordOfUsername.Split(new char[] { ' ' });
                        predicate1 = x => keywords.All(kw => x.Owner.Username.Contains(kw));
                    }
                    if (this.UserId != null)
                    {
                        int userId = (int)this.UserId;
                        predicate2 = x => x.Owner.Id == userId;
                    }
                    if (this.BeginTime != null)
                    {
                        DateTime beginTime = (DateTime)this.BeginTime;
                        predicate3 = x => x.Time >= beginTime;
                    }
                    if (this.EndTime != null)
                    {
                        DateTime endtime = (DateTime)this.EndTime;
                        predicate4 = x => x.Time <= endtime;
                    }

                    int countOfAllMessages = db.RersonalReportForOneMonths
                        .Where(predicate1)
                        .Where(predicate2)
                        .Where(predicate3)
                        .Where(predicate4)
                        .Count();
                    var tList = db.RersonalReportForOneMonths
                        .Where(predicate1)
                        .Where(predicate2)
                        .Where(predicate3)
                        .Where(predicate4)
                        .OrderByDescending(x => x.Id)
                        .Skip(startRow)
                        .Take(settingOfBase.PageSizeForAdmin)
                        .ToList()
                        .ConvertAll(x => new RersonalAndTeamReportExport(x));

                    return new PageResult<RersonalAndTeamReportExport>(this.PageIndex, countOfAllMessages, settingOfBase.PageSizeForAdmin, tList);

                    #endregion
                }
                else
                {
                    #region 单日个人报表

                    Expression<Func<RersonalReportForOneDay, bool>> predicate1 = x => x.Id > 0;
                    Expression<Func<RersonalReportForOneDay, bool>> predicate2 = x => x.Id > 0;
                    Expression<Func<RersonalReportForOneDay, bool>> predicate3 = x => x.Id > 0;
                    Expression<Func<RersonalReportForOneDay, bool>> predicate4 = x => x.Id > 0;

                    if (this.KeywordOfUsername != null)
                    {
                        this.KeywordOfUsername = VerifyHelper.EliminateSpaces(this.KeywordOfUsername);
                        string[] keywords = this.KeywordOfUsername.Split(new char[] { ' ' });
                        predicate1 = x => keywords.All(kw => x.Owner.Username.Contains(kw));
                    }
                    if (this.UserId != null)
                    {
                        int userId = (int)this.UserId;
                        predicate2 = x => x.Owner.Id == userId;
                    }
                    if (this.BeginTime != null)
                    {
                        DateTime beginTime = (DateTime)this.BeginTime;
                        predicate3 = x => x.Time >= beginTime;
                    }
                    if (this.EndTime != null)
                    {
                        DateTime endtime = (DateTime)this.EndTime;
                        predicate4 = x => x.Time <= endtime;
                    }

                    int countOfAllMessages = db.RersonalReportForOneDays
                        .Where(predicate1)
                        .Where(predicate2)
                        .Where(predicate3)
                        .Where(predicate4)
                        .Count();
                    var tList = db.RersonalReportForOneDays
                        .Where(predicate1)
                        .Where(predicate2)
                        .Where(predicate3)
                        .Where(predicate4)
                        .OrderByDescending(x => x.Id)
                        .Skip(startRow)
                        .Take(settingOfBase.PageSizeForAdmin)
                        .ToList()
                        .ConvertAll(x => new RersonalAndTeamReportExport(x));

                    return new PageResult<RersonalAndTeamReportExport>(this.PageIndex, countOfAllMessages, settingOfBase.PageSizeForAdmin, tList);

                    #endregion
                }
            }
            else
            {
                if (this.MOD == MonthOrDay.Month)
                {
                    #region 单月团队人报表

                    Expression<Func<TeamReportForOneMonth, bool>> predicate1 = x => x.Id > 0;
                    Expression<Func<TeamReportForOneMonth, bool>> predicate2 = x => x.Id > 0;
                    Expression<Func<TeamReportForOneMonth, bool>> predicate3 = x => x.Id > 0;
                    Expression<Func<TeamReportForOneMonth, bool>> predicate4 = x => x.Id > 0;

                    if (this.KeywordOfUsername != null)
                    {
                        this.KeywordOfUsername = VerifyHelper.EliminateSpaces(this.KeywordOfUsername);
                        string[] keywords = this.KeywordOfUsername.Split(new char[] { ' ' });
                        predicate1 = x => keywords.All(kw => x.Owner.Username.Contains(kw));
                    }
                    if (this.UserId != null)
                    {
                        int userId = (int)this.UserId;
                        predicate2 = x => x.Owner.Id == userId;
                    }
                    if (this.BeginTime != null)
                    {
                        DateTime beginTime = (DateTime)this.BeginTime;
                        predicate3 = x => x.Time >= beginTime;
                    }
                    if (this.EndTime != null)
                    {
                        DateTime endtime = (DateTime)this.EndTime;
                        predicate4 = x => x.Time <= endtime;
                    }

                    int countOfAllMessages = db.TeamReportForOneMonths
                        .Where(predicate1)
                        .Where(predicate2)
                        .Where(predicate3)
                        .Where(predicate4)
                        .Count();
                    var tList = db.TeamReportForOneMonths
                        .Where(predicate1)
                        .Where(predicate2)
                        .Where(predicate3)
                        .Where(predicate4)
                        .OrderByDescending(x => x.Id)
                        .Skip(startRow)
                        .Take(settingOfBase.PageSizeForAdmin)
                        .ToList()
                        .ConvertAll(x => new RersonalAndTeamReportExport(x));

                    return new PageResult<RersonalAndTeamReportExport>(this.PageIndex, countOfAllMessages, settingOfBase.PageSizeForAdmin, tList);

                    #endregion
                }
                else
                {
                    #region 单月团队人报表

                    Expression<Func<TeamReportForOneDay, bool>> predicate1 = x => x.Id > 0;
                    Expression<Func<TeamReportForOneDay, bool>> predicate2 = x => x.Id > 0;
                    Expression<Func<TeamReportForOneDay, bool>> predicate3 = x => x.Id > 0;
                    Expression<Func<TeamReportForOneDay, bool>> predicate4 = x => x.Id > 0;

                    if (this.KeywordOfUsername != null)
                    {
                        this.KeywordOfUsername = VerifyHelper.EliminateSpaces(this.KeywordOfUsername);
                        string[] keywords = this.KeywordOfUsername.Split(new char[] { ' ' });
                        predicate1 = x => keywords.All(kw => x.Owner.Username.Contains(kw));
                    }
                    if (this.UserId != null)
                    {
                        int userId = (int)this.UserId;
                        predicate2 = x => x.Owner.Id == userId;
                    }
                    if (this.BeginTime != null)
                    {
                        DateTime beginTime = (DateTime)this.BeginTime;
                        predicate3 = x => x.Time >= beginTime;
                    }
                    if (this.EndTime != null)
                    {
                        DateTime endtime = (DateTime)this.EndTime;
                        predicate4 = x => x.Time <= endtime;
                    }

                    int countOfAllMessages = db.TeamReportForOneDays
                        .Where(predicate1)
                        .Where(predicate2)
                        .Where(predicate3)
                        .Where(predicate4)
                        .Count();
                    var tList = db.TeamReportForOneDays
                        .Where(predicate1)
                        .Where(predicate2)
                        .Where(predicate3)
                        .Where(predicate4)
                        .OrderByDescending(x => x.Id)
                        .Skip(startRow)
                        .Take(settingOfBase.PageSizeForAdmin)
                        .ToList()
                        .ConvertAll(x => new RersonalAndTeamReportExport(x));

                    return new PageResult<RersonalAndTeamReportExport>(this.PageIndex, countOfAllMessages, settingOfBase.PageSizeForAdmin, tList);

                    #endregion
                }
            }
        }
        /// <summary>
        /// 获取站点统计
        /// </summary>
        /// <param name="db">数据库连接对象</param>
        /// <returns>返回站点统计</returns>
        public PageResult<SiteReportExpot> GetSiteReports(IModelToDbContextOfReport db)
        {
            if (this.PageIndex < 1) { this.PageIndex = 1; }
            SettingOfBase settingOfBase = new SettingOfBase(db);
            int startRow = settingOfBase.PageSizeForAdmin * (this.PageIndex - 1);

            if (this.MOD == MonthOrDay.Month)
            {
                #region 单月报表

                Expression<Func<SiteReportForOneMonth, bool>> predicate1 = x => x.Id > 0;
                Expression<Func<SiteReportForOneMonth, bool>> predicate2 = x => x.Id > 0;

                if (this.BeginTime != null)
                {
                    DateTime beginTime = (DateTime)this.BeginTime;
                    predicate1 = x => x.Time >= beginTime;
                }
                if (this.EndTime != null)
                {
                    DateTime endtime = (DateTime)this.EndTime;
                    predicate2 = x => x.Time <= endtime;
                }

                int countOfAllMessages = db.SiteReportForOneMonths
                    .Where(predicate1)
                    .Where(predicate2)
                    .Count();
                var tList = db.SiteReportForOneMonths
                    .Where(predicate1)
                    .Where(predicate2)
                    .OrderByDescending(x => x.Id)
                    .Skip(startRow)
                    .Take(settingOfBase.PageSizeForAdmin)
                    .ToList()
                    .ConvertAll(x => new SiteReportExpot(x));

                return new PageResult<SiteReportExpot>(this.PageIndex, countOfAllMessages, settingOfBase.PageSizeForAdmin, tList);

                #endregion
            }
            else
            {
                #region 单日报表

                Expression<Func<SiteReportForOneDay, bool>> predicate1 = x => x.Id > 0;
                Expression<Func<SiteReportForOneDay, bool>> predicate2 = x => x.Id > 0;

                if (this.BeginTime != null)
                {
                    DateTime beginTime = (DateTime)this.BeginTime;
                    predicate1 = x => x.Time >= beginTime;
                }
                if (this.EndTime != null)
                {
                    DateTime endtime = (DateTime)this.EndTime;
                    predicate2 = x => x.Time <= endtime;
                }

                int countOfAllMessages = db.SiteReportForOneDays
                    .Where(predicate1)
                    .Where(predicate2)
                    .Count();
                var tList = db.SiteReportForOneDays
                    .Where(predicate1)
                    .Where(predicate2)
                    .OrderByDescending(x => x.Id)
                    .Skip(startRow)
                    .Take(settingOfBase.PageSizeForAdmin)
                    .ToList()
                    .ConvertAll(x => new SiteReportExpot(x));

                return new PageResult<SiteReportExpot>(this.PageIndex, countOfAllMessages, settingOfBase.PageSizeForAdmin, tList);

                #endregion
            }
        }
        /// <summary>
        /// 获取私人/团队报表
        /// </summary>
        /// <param name="db">数据库连接对象</param>
        /// <returns>返回私人/团队报表</returns>
        public PageResult<RersonalAndTeamReportExport> GetRersonalAndTeamReports(IModelToDbContextOfReport db)
        {
            if (this.PageIndex < 1) { this.PageIndex = 1; }
            SettingOfBase settingOfBase = new SettingOfBase(db);
            int startRow = settingOfBase.PageSizeForClient * (this.PageIndex - 1);

            if (this.TOS == TeamOrSelf.Self)
            {
                if (this.MOD == MonthOrDay.Month)
                {
                    #region 单月个人报表

                    Expression<Func<RersonalReportForOneMonth, bool>> predicate1 = x => x.Owner.Id == this.Self.Id;

                    int countOfAllMessages = db.RersonalReportForOneMonths
                        .Where(predicate1)
                        .Count();
                    var tList = db.RersonalReportForOneMonths
                        .Where(predicate1)
                        .OrderByDescending(x => x.Id)
                        .Skip(startRow)
                        .Take(settingOfBase.PageSizeForClient)
                        .ToList()
                        .ConvertAll(x => new RersonalAndTeamReportExport(x));

                    return new PageResult<RersonalAndTeamReportExport>(this.PageIndex, countOfAllMessages, settingOfBase.PageSizeForClient, tList);

                    #endregion
                }
                else
                {
                    #region 单日个人报表

                    Expression<Func<RersonalReportForOneDay, bool>> predicate1 = x => x.Owner.Id == this.Self.Id;

                    int countOfAllMessages = db.RersonalReportForOneDays
                        .Where(predicate1)
                        .Count();
                    var tList = db.RersonalReportForOneDays
                        .Where(predicate1)
                        .OrderByDescending(x => x.Id)
                        .Skip(startRow)
                        .Take(settingOfBase.PageSizeForClient)
                        .ToList()
                        .ConvertAll(x => new RersonalAndTeamReportExport(x));

                    return new PageResult<RersonalAndTeamReportExport>(this.PageIndex, countOfAllMessages, settingOfBase.PageSizeForClient, tList);

                    #endregion
                }
            }
            else
            {
                if (this.MOD == MonthOrDay.Month)
                {
                    #region 单月团队人报表

                    Expression<Func<TeamReportForOneMonth, bool>> predicate1 = x => x.Owner.Id == this.Self.Id;

                    int countOfAllMessages = db.TeamReportForOneMonths
                        .Where(predicate1)
                        .Count();
                    var tList = db.TeamReportForOneMonths
                        .Where(predicate1)
                        .OrderByDescending(x => x.Id)
                        .Skip(startRow)
                        .Take(settingOfBase.PageSizeForClient)
                        .ToList()
                        .ConvertAll(x => new RersonalAndTeamReportExport(x));

                    return new PageResult<RersonalAndTeamReportExport>(this.PageIndex, countOfAllMessages, settingOfBase.PageSizeForClient, tList);

                    #endregion
                }
                else
                {
                    #region 单月团队人报表

                    Expression<Func<TeamReportForOneDay, bool>> predicate1 = x => x.Owner.Id == this.Self.Id;

                    int countOfAllMessages = db.TeamReportForOneDays
                        .Where(predicate1)
                        .Count();
                    var tList = db.TeamReportForOneDays
                        .Where(predicate1)
                        .OrderByDescending(x => x.Id)
                        .Skip(startRow)
                        .Take(settingOfBase.PageSizeForClient)
                        .ToList()
                        .ConvertAll(x => new RersonalAndTeamReportExport(x));

                    return new PageResult<RersonalAndTeamReportExport>(this.PageIndex, countOfAllMessages, settingOfBase.PageSizeForClient, tList);

                    #endregion
                }
            }
        }