Пример #1
0
 public long getDataByColum(string col)
 {
     try
     {
         long problemsInContest = getQueryString("ProblemsInContest");
         return(long.Parse(CGlobal.getDataByColumn(problemsInContest, col, "ProblemsInContest")));
     }
     catch (Exception)
     {
         return(0);
     }
 }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                initForm();
                long _problemId = getQueryString(ProblemId);
                long _contestId = getQueryString(ContestId);


                if (_problemId <= 0 || _contestId <= 0)
                {
                    Response.Redirect("MyContests.aspx");
                }
                if (!objMyContest.CheckIsAccepted(_contestId))
                {
                    HELPER.Client.Alert(this, "KHÓA HỌC NÀY CHƯA ĐƯỢC PHÊ DUYỆT");
                    Response.Redirect("MyContests.aspx");
                }
                if (!objContest.CheckIsAvailable(_contestId))
                {
                    HELPER.Client.Alert(this, "KHÓA HỌC NÀY ĐÃ HẾT HIỆU LỰC");
                    Response.Redirect("MyContests.aspx");
                }


                txtProblemName.Text = CGlobal.getDataByColumn(_problemId, "Name", "Problems");

                string _contestURL = CGlobal.getDataByColumn(_contestId, "Url", "Contests");
                string _ProblemURL = CGlobal.getDataByColumn(_problemId, "Url", "Problems");
                string _Username   = CGlobal.getDataByColumn(CGlobal.GetUserID(), "UserName", "Users");

                hdfUrl.Add(ContestsUrl, _contestURL);
                hdfUrl.Add(ProblemsUrl, _ProblemURL);
                hdfUrl.Add(UserName, _Username);
                hdfUrl.Add(ProblemId, _problemId);
                hdfUrl.Add(ContestId, _contestId);
                hdfUrl.Add(SubmissionId, -1);
                hdfUrl.Add(Point, 0);
                hdfUrl.Add(UserID, CGlobal.GetUserID());

                hdfUrl.Add(PathFolderSave, getPathFolderSave());

                hdfUrl.Add(CompilerID, 0);
                hdfUrl.Add(FolderTestCase, Server.MapPath(CConstant.C_DIRECTORY_TESTCASES));
                hdfUrl.Add(TextCode, string.Empty);
            }
        }
Пример #3
0
        private void initFuncMode()
        {
            FMode = getMode();
            HELPER.CWebPage.ResetPanel(pnEdit);
            if (FMode == CGlobal.FunctionMode.AddMode || FMode == CGlobal.FunctionMode.EditMode)
            {
                pnMain.Visible = false;
                pnEdit.Visible = true;
                if (FMode == CGlobal.FunctionMode.EditMode)
                {
                    long      id = getHdf(hdfID);
                    DataTable dt = objContest.LoadByID(id);

                    HELPER.CWebPage.BindPanel(pnEdit, dt);
                    try
                    {
                        if (!string.IsNullOrEmpty(CGlobal.getDataByColumn(id, "StartTime", "Contests")))
                        {
                            DateTime start = DateTime.Parse(CGlobal.getDataByColumn(id, "StartTime", "Contests"));
                            DateTime end   = DateTime.Parse(CGlobal.getDataByColumn(id, "EndTime", "Contests"));
                            txtStartTime.Value = start;
                            dteStartTime.Value = start;
                            txtEndTime.Value   = end;
                            dteEndTime.Value   = end;
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
                else //AddMode
                {
                    chkIsVisible.Checked = true;
                }
                objProb.LoadToCheckList(cblProblems);
            }
            else if (FMode == CGlobal.FunctionMode.CloseMode || FMode == CGlobal.FunctionMode.SearchMode)
            {
                pnMain.Visible = true;
                pnEdit.Visible = false;
                Response.Redirect(Request.RawUrl);
            }
        }
Пример #4
0
        protected void grvContests_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e)
        {
            long id = long.Parse(grvContests.GetRowValues(e.VisibleIndex, grvContests.KeyFieldName).ToString());

            if (e.ButtonID == "GridEdit")
            {
                setHdf(hdfID, id);
                setMode(CGlobal.FunctionMode.EditMode);
                if (!string.IsNullOrEmpty(CGlobal.getDataByColumn(id, "StartTime", "Contests")))
                {
                    txtIsLimitTime.Checked = true;
                    txtIsLimitTime_CheckedChanged(new object(), new EventArgs());
                }

                initFuncMode();
            }
            else if (e.ButtonID == "GridDelete")
            {
                try
                {
                    objContest.Delete(id);
                    setMode(CGlobal.FunctionMode.SearchMode);
                    initFuncMode();
                }
                catch (Exception ex)
                {
                    HELPER.CError.ErrorType err = HELPER.CError.Parse(ex.Message);
                    if (err == CError.ErrorType.InUse)
                    {
                        HELPER.Client.Alert(this, "Dữ liệu đã được sử dụng. Không thể xóa được!");
                    }
                    else
                    {
                        HELPER.Client.Alert(this, "Lỗi xóa dữ liệu!");
                    }
                }
            }
        }