Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var theme       = ServerModel.DB.Load <TblThemes>(ThemeId);
        var currentUser = ServerModel.User.Current;

        if (currentUser != null)
        {
            var user = ServerModel.DB.Load <TblUsers>(UserId);

            SetHeaderText(theme.Name, CurriculumnName, StageName, user.DisplayName);

            int totalPageRank = 0;
            int totalUserRank = 0;

            var userResults = StatisticManager.GetStatisticForThemeForUser(user.ID, theme.ID);

            foreach (var ur in userResults)
            {
                if (ur.Status != ResultStatus.NotIncluded)
                {
                    totalUserRank += ur.UserRank;
                    totalPageRank += ur.PageRank;

                    var row = new TableRow();

                    SetPageName(row, ur.Page.PageName);
                    SetStatus(row, ur.Status);
                    SetUserRank(row, ur.UserRank);
                    SetPageRank(row, (int)ur.Page.PageRank);
                    SetUserAnswersLink(row, ur.Page.ID, user.ID);

                    if (ServerModel.User.Current.Islector())
                    {
                        SetCorrectAnswersLink(row, ur.Page.ID);
                    }

                    if (StatisticManager.IsContainCompiledQuestions(ur.Page))
                    {
                        SetCompiledDetailsLink(row, ur.Page.ID, user.ID);
                    }

                    _resultTable.Rows.Add(row);
                }
            }
            SetTotalRow(totalPageRank, (totalUserRank < 0) ? 0 : totalUserRank);
        }
    }