Example #1
0
        public ActionResult Submit(Int32 id, FormCollection form)
        {
            ContestEntity contest = ViewData["Contest"] as ContestEntity;
            ProblemEntity problem = ContestProblemManager.GetProblem(contest.ContestID, id);

            SolutionEntity entity = new SolutionEntity()
            {
                ProblemID        = problem.ProblemID,
                ContestID        = contest.ContestID,
                ContestProblemID = id,
                SourceCode       = form["code"],
                LanguageType     = LanguageType.FromLanguageID(form["lang"])
            };

            Dictionary <String, Byte> supportLanguages = LanguageManager.GetSupportLanguages(contest.SupportLanguage);

            if (!supportLanguages.ContainsValue(entity.LanguageType.ID))
            {
                return(RedirectToErrorMessagePage("This contest does not support this programming language."));
            }

            String userip = this.GetCurrentUserIP();

            if (!SolutionManager.InsertSolution(entity, userip))
            {
                return(RedirectToErrorMessagePage("Failed to submit your solution!"));
            }

            return(RedirectToAction("List", "Status", new { area = "Contest", cid = contest.ContestID }));
        }
Example #2
0
        public ActionResult Show(Int32 id = -1)
        {
            ContestEntity contest = ViewData["Contest"] as ContestEntity;
            ProblemEntity entity  = ContestProblemManager.GetProblem(contest.ContestID, id);

            ViewBag.ContestProblemID = id.ToString();

            return(View(entity));
        }
Example #3
0
        public ActionResult Submit(Int32 id = -1)
        {
            ContestEntity contest = ViewData["Contest"] as ContestEntity;
            ProblemEntity problem = ContestProblemManager.GetProblem(contest.ContestID, id);
            IEnumerable <SelectListItem> items = this.GetLanguageItems(contest.SupportLanguage);

            ViewBag.Languages        = items;
            ViewBag.ContestProblemID = id.ToString();

            return(View(problem));
        }
Example #4
0
        public ActionResult Set()
        {
            ContestEntity        contest = ViewData["Contest"] as ContestEntity;
            List <ProblemEntity> list    = ContestProblemManager.GetProblemSet(contest.ContestID);

            Dictionary <Int32, Int16> userSubmits = SolutionManager.GetUserContestSubmit(contest.ContestID);

            ViewBag.UserSubmits = userSubmits;

            return(View(list));
        }
Example #5
0
        public ActionResult List()
        {
            ContestEntity contest = ViewData["Contest"] as ContestEntity;

            List <RankItem>             ranklist = ContestManager.GetContestRanklist(contest);
            List <ContestProblemEntity> problems = ContestProblemManager.GetContestProblemList(contest.ContestID);

            ViewBag.Problems = problems;

            return(View(ranklist));
        }
Example #6
0
        public ActionResult Statistics()
        {
            ContestEntity contest = ViewData["Contest"] as ContestEntity;

            IDictionary <Int32, ContestProblemStatistic> statistics = SolutionManager.GetContestStatistic(contest.ContestID);
            List <ContestProblemEntity> problems = ContestProblemManager.GetContestProblemList(contest.ContestID);
            Dictionary <String, Byte>   langs    = LanguageManager.GetSupportLanguages(contest.SupportLanguage);

            ViewBag.Problems  = problems;
            ViewBag.Languages = langs;

            return(View(statistics));
        }