private void filterButton_Click(object sender, EventArgs e) { int tid = int.Parse(contestDropDownList.SelectedValue); string redirect_url = String.Format("{0}?tid={1}", _url, tid); if (BaseDb.IsJudge(Page.User)) { int uid = int.Parse(userDropDownList.SelectedValue); if (uid != 0) { redirect_url += String.Format("&uid={0}", uid); } } if (snameDropDownList.SelectedValue != "ALL") { BaseDb db = DbFactory.ConstructDatabase(); if (db.GetPidByShortName(tid, snameDropDownList.SelectedValue) == -1) { noSuchProb.Visible = true; return; } redirect_url += String.Format("&sname={0}", snameDropDownList.SelectedValue); } if (resultDropDownList.SelectedValue != "ALL") { redirect_url += String.Format("&result={0}", resultDropDownList.SelectedValue); } Page.Response.Redirect(redirect_url); }
private void Page_Load(object sender, EventArgs e) { if (BaseDb.IsAnonymous(Page.User)) { throw new NeJudgeSecurityException("User, Administrator, Judge"); } if (!IsPostBack) { Page.Response.AddHeader("Refresh", "90"); ArrayList sids = new ArrayList(); int page = 0; #region параметры _rp = new RequirementsProcessor(this.GetType(), Context); _rp.ProcessRequirements(); if (Page.Request.QueryString["sname"] != null) { problem = Page.Request.QueryString["sname"]; } if (Page.Request.QueryString["result"] != null) { result = Page.Request.QueryString["result"]; } try { page = int.Parse(Page.Request.QueryString["page"]); } catch { page = 0; } using (BaseDb db = DbFactory.ConstructDatabase()) { if (_rp.UidDefined) { if (BaseDb.IsJudge(Page.User)) { filter.UserID = _rp.UserID; } else { throw new NeJudgeSecurityException("Judge"); } } if (_rp.TidDefined) { //filter.ContestID = _rp.ContestID; if (db.GetContest(_rp.ContestID).Future) { Hide("Невозможно просмотреть submissions будущего соревнования"); } else { int pid = -1; if (problem != "") { pid = db.GetPidByShortName(_rp.ContestID, problem); if (pid == -1) { throw new NeJudgeInvalidParametersException("sname"); } else { if (!Page.IsPostBack) { filter.ProblemID = problem[0]; } } } if (result != "") { try { Result r = (Result)Enum.Parse (typeof(Result), result); if (!Page.IsPostBack) { filter.Result = r; } } catch (ArgumentException) { throw new NeJudgeInvalidParametersException("result"); } } #endregion foreach (Submission s in db.GetSubmissions(_rp.ContestID, _rp.UidDefined ? _rp.UserID : 0, (problem == "") ? 0 : pid, result)) { sids.Add(s.SID); } if (sids.Count == 0) { //Hide("В этом соревновании нет ни одного submission"); } sids.Reverse(); statusGrid.VirtualItemCount = sids.Count; if (sids.Count - page * statusGrid.PageSize < 0) { page = sids.Count / statusGrid.PageSize; } statusGrid.CurrentPageIndex = page; ArrayList arr = new ArrayList(); int l; if (sids.Count - page * statusGrid.PageSize < statusGrid.PageSize) { l = sids.Count; } else { l = page * statusGrid.PageSize + statusGrid.PageSize; } for (int i = page * statusGrid.PageSize; i < l; i++) { arr.Add(sids[i]); } Bind(arr); HtmlFunctions.BeautifyDataGrid(statusGrid); } } else { Hide(null); } } } }