Exemplo n.º 1
0
        private void Page_Load(object sender, EventArgs e)
        {
            int tid;

            try
            {
                tid = int.Parse(Page.Request.QueryString["TID"]);
            }
            catch
            {
                tid = -1;
            }
            BaseDb db = DbFactory.ConstructDatabase();

            if (db.CheckTid(tid))
            {
                PlaceHolder1.Controls.Add(new LiteralControl("<div align='center'><h1 style='color:#418ade;'>" + db.GetContest(tid).Name + "</h1></div><hr>"));
                ArrayList a = db.GetProblems(tid);
                foreach (Problem p in a)
                {
                    Control c = LoadControl("PageModules/printproblem.ascx");
                    ((printproblem)c).PID = p.PID;
                    PlaceHolder1.Controls.Add(c);
                    PlaceHolder1.Controls.Add(new LiteralControl("<br>"));
                }
            }
            else
            {
                throw new NeJudgeInvalidParametersException("tid");
            }
        }
Exemplo n.º 2
0
 private void Page_Load(object sender, EventArgs e)
 {
     if (!BaseDb.IsAdmin(Page.User))
     {
         throw new NeJudgeSecurityException("Administrator");
     }
     if (!IsPostBack)
     {
         try
         {
             pid = int.Parse(Request.QueryString["pid"]);
         }
         catch
         {
             pid = -1;
         }
         try
         {
             tid = int.Parse(Request.QueryString["tid"]);
         }
         catch
         {
             tid = -1;
         }
         BaseDb db = DbFactory.ConstructDatabase();
         if (db.CheckPid(pid))
         {
             tid = db.GetTid(pid);
             Problem p = db.GetProblem(pid);
             problemNameTextBox.Text  = Server.HtmlDecode(p.Name);
             problemTextTextBox.Text  = Server.HtmlDecode(p.Text);
             inputFormatTextBox.Text  = Server.HtmlDecode(p.InputFormat);
             outputFormatTextBox.Text = Server.HtmlDecode(p.OutputFormat);
             inputSampleTextbox.Text  = Server.HtmlDecode(p.InputSample);
             outputSampleTextbox.Text = Server.HtmlDecode(p.OutputSample);
             authorTextBox.Text       = Server.HtmlDecode(p.Author);
         }
         else if (db.CheckTid(tid))
         {
             pid = -1;
             finishButton.Text = "Добавить задачу";
             if (db.GetContest(tid).Old)
             {
                 throw new NeJudgeInvalidParametersException("tid");
             }
         }
         else
         {
             throw new NeJudgeInvalidParametersException("tid");
         }
         db.Close();
     }
 }
Exemplo n.º 3
0
/*
 *              private void Hide(string mess)
 *              {
 *                      outerror.InnerHtml = "<FONT COLOR='Red'><b>" + mess + "</b></FONT>";
 *                      Table3.Visible = false;
 *                      Table4.Visible = false;
 *              }
 */

        private void Page_Load(object sender, EventArgs e)
        {
            if (!BaseDb.IsAdmin(Page.User))
            {
                throw new NeJudgeSecurityException("Administrator");
            }
            if (!IsPostBack)
            {
                try
                {
                    if (tid == -1)
                    {
                        tid = int.Parse(Request.QueryString["tid"]);
                    }
                }
                catch
                {
                    tid = -1;
                }
                if (db.CheckTid(tid))
                {
                    Contest t = db.GetContest(tid);
                    beginningTextBox.Text = t.Beginning.ToString("dd.MM.yyyy H:mm");
                    endingTextBox.Text    = t.Ending.ToString("dd.MM.yyyy H:mm");
                    nameTextbox.Text      = t.Name;
                    if (t.Now)
                    {
                        beginningTextBox.Enabled = false;
                        //deleteButton.Visible = false;
                        //HideRemoveCheckBox();
                    }
                    if (t.Old)
                    {
                        beginningTextBox.Enabled = false;
                        endingTextBox.Enabled    = false;
                        addButton.Visible        = false;
                        //deleteButton.Visible = false;
                        //HideRemoveCheckBox();
                    }
                    RedrawRepeater();
                }
                else
                {
                    tid = -1;
                    addButton.Visible    = false;
                    deleteButton.Visible = false;
                    finishButton.Text    = "—оздать соревнование";
                }
            }
        }