private void Page_Load(object sender, EventArgs e)
        {
            fileContent.Visible = reportGrid.Visible = false;
            int    sid  = 0;
            string sstr = "";

            try
            {
                sstr = Page.Request.QueryString["sid"];
                sid  = int.Parse(sstr);
            }
            catch (FormatException)
            {
                throw new NeJudgeInvalidParametersException("sid");
            }
            catch (ArgumentNullException)
            {
                throw new NeJudgeInvalidParametersException("sid");
            }
            BaseDb db = DbFactory.ConstructDatabase();

            if (!db.CheckSid(sid))
            {
                throw new NeJudgeInvalidParametersException("sid");
            }
            string mode = Page.Request.QueryString["mode"];

            if (mode == null)
            {
                throw new NeJudgeInvalidParametersException("mode");
            }
            mode = mode.ToLower();
            Submission s = db.GetSubmission(sid);

            if (mode == "comp-report")
            {
                fileContent.Visible = true;
                if (s.Result.Code == Result.WAIT || s.Result.Code == Result.RU)
                {
                    ShowError("–ешение еще провер¤етс¤");
                    return;
                }
                if (!BaseDb.IsAdmin(Page.User))
                {
                    if (s.UID != db.GetUid(Page.User.Identity.Name) || s.Result.Code != Result.CE)
                    {
                        throw new NeJudgeSecurityException("Identity");                         //TODO: срочно пределать
                    }
                }
                string report = DfTest.GetReportFilename(sid.ToString());
                ShowFile(report);
            }
            else if (mode == "error-report")
            {
                fileContent.Visible = true;
                if (s.UID != db.GetUid(Page.User.Identity.Name) || s.Result.Code != Result.FA)
                {
                    throw new NeJudgeSecurityException("Identity");
                }
                string errfile = Path.Combine(
                    Path.Combine(Config.SubmissionsDirectory, sid.ToString()), "error.desc");
                ShowFile(errfile);
            }
            else if (mode == "test-report")
            {
            }
            else
            {
                throw new NeJudgeInvalidParametersException("mode");
            }
        }