private void Page_Load(object sender, EventArgs e) { BaseDb db = DbFactory.ConstructDatabase(); if (db.CheckPid(pid)) { Problem p = db.GetProblem(pid); if (db.GetContest(p.TID).Future) { Hide("Соревнование, задачу с которого вы хотите просмотреть, ещё не началось. Попробуйте позже."); } else { nameLiteral.Text = "<h1> Задача " + p.ShortName + " ( #"+ pid + " ). "+ p.Name + "</h1>"; Limits l = DfTest.GetLimits(pid.ToString()); tlLiteral.Text += l.Time + " секунды"; mlLiteral.Text += l.Memory + " КБ"; olLiteral.Text += l.Output + " байт"; if (p.Text == "") { textLiteral.Visible = false; } else { textLiteral.Text += p.Text; } if (p.InputFormat == "") { infoLiteral.Visible = false; } else { infoLiteral.Text += p.InputFormat; } if (p.OutputFormat == "") { outfoLiteral.Visible = false; } else { outfoLiteral.Text += p.OutputFormat; } string str = ""; if (p.InputSample == "") { inexLiteral.Visible = false; } else { StringReader str_rdr = new StringReader(p.InputSample); while ((str = str_rdr.ReadLine()) != null) { inexLiteral.Text += str + "<br>"; } inexLiteral.Text += "</code>"; } if (p.OutputSample == "") { outexLiteral.Visible = false; } else { StringReader str_rdr2 = new StringReader(p.OutputSample); while ((str = str_rdr2.ReadLine()) != null) { outexLiteral.Text += str + "<br>"; } outexLiteral.Text += "</code>"; } if (p.Author == "") { authorLiteral.Visible = false; } else { authorLiteral.Text += p.Author; authorLiteral.Text += "<hr>"; } } } else { throw new NeJudgeInvalidParametersException("pid"); } db.Close(); }
private void FillLiterals(Problem p) { nameLiteral.Text = "<h1> Задача " + p.ShortName + " ( #" + p.PID + " ). " + p.Name + "</h1>"; Limits l = DfTest.GetLimits(p.PID.ToString()); tlLiteral.Text += l.Time + " секунды"; mlLiteral.Text += l.Memory + " КБ"; olLiteral.Text += l.Output + " байт"; if (p.Text == "") { textLiteral.Visible = false; } else { textLiteral.Text += p.Text; } if (p.InputFormat == "") { infoLiteral.Visible = false; } else { infoLiteral.Text += p.InputFormat; } if (p.OutputFormat == "") { outfoLiteral.Visible = false; } else { outfoLiteral.Text += p.OutputFormat; } string str = ""; if (p.InputSample == "") { inexLiteral.Visible = false; } else { inexLiteral.Text += "<code>"; StringReader str_rdr = new StringReader(p.InputSample); while ((str = str_rdr.ReadLine()) != null) { inexLiteral.Text += str + "<br>"; } inexLiteral.Text += "</code>"; } if (p.OutputSample == "") { outexLiteral.Visible = false; } else { outexLiteral.Text += "<code>"; StringReader str_rdr2 = new StringReader(p.OutputSample); while ((str = str_rdr2.ReadLine()) != null) { outexLiteral.Text += str + "<br>"; } outexLiteral.Text += "</code>"; } if (p.Author == "") { authorLiteral.Visible = false; } else { authorLiteral.Text += p.Author; } }