Beispiel #1
0
        public static List <User> getUsers(OjDBContext ctx)
        {
            var users    = new List <User>();
            var password = HashUtility.MD5Hash("password");

            users.Add(new User()
            {
                UserName = "******",
                Email    = "*****@*****.**",
                Password = password,
                UserType = ctx.UserTypes.Find(UserTypeEnum.Admin)
            });

            users.Add(new User()
            {
                UserName = "******",
                Email    = "*****@*****.**",
                Password = password,
                UserType = ctx.UserTypes.Find(UserTypeEnum.User)
            });

            users.Add(new User()
            {
                UserName = "******",
                Email    = "*****@*****.**",
                Password = password,
                UserType = ctx.UserTypes.Find(UserTypeEnum.Judge)
            });

            return(users);
        }
Beispiel #2
0
        public static List <Problem> getProblems(OjDBContext ctx)
        {
            var user     = ctx.Users.First(x => x.UserName == "admin");
            var problems = new List <Problem>();

            for (int i = 1; i <= 30; i++)
            {
                var a = new Problem()
                {
                    Title          = "Problem #" + i,
                    TestCaseInput  = ProblemDummyData.intput,
                    TestCaseOutput = ProblemDummyData.expected_output,
                    TimeLimit      = 1,
                    MemoryLimit    = 25,
                    CreateDate     = DateTime.Now,
                    Creator        = user,
                    IsPublic       = true
                };


                problems.Add(a);
            }


            return(problems);
        }
Beispiel #3
0
        // only for develpment purposes
        public static List <Submission> getSubmissions(OjDBContext ctx)
        {
            var array = new List <Submission>();

            var admin   = ctx.Users.First(x => x.UserName == "admin");
            var problem = ctx.Problems.First();

//            for(int i = 1; i <= 40; i++){
//                array.Add(new Submission(){
//                    Submitter = admin,
//                    Problem = problem,
//                    ProgrammingLanguage = ctx.ProgrammingLanguages.Find(ProgrammingLanguageEnum.Cpp11),
//                    Status = ctx.SubmissionStatus.Find(Verdict.Accepted),
//                });
//            }


            return(array);
        }
Beispiel #4
0
        public static List <Contest> GetContests(OjDBContext ctx)
        {
            var past = DateTime.Now;

            past = past.Subtract(TimeSpan.FromHours(5));

            var present = DateTime.Now;

            var future = DateTime.Now;

            future = future.AddHours(5);


            return(new List <Contest>()
            {
                CreateContes(ctx, "Contest 1", past, present),             // past contest
                CreateContes(ctx, "Contest 2", past, future),              // running contest
                CreateContes(ctx, "Contest 3", future, DateTime.MaxValue), // upcomping contest
            });
        }
Beispiel #5
0
        // only for develpment purposes
        public static List <Announcement> getAnnouncements(OjDBContext ctx)
        {
            var array = new List <Announcement>();

            var admin = ctx.Users.First(x => x.UserName == "admin");

            for (int i = 1; i <= 40; i++)
            {
                array.Add(new Announcement()
                {
                    Title       = "Site Notice #" + i,
                    Description = "Notice description goes here",
                    CreateDate  = DateTime.Now,
                    Creator     = admin
                });
            }


            return(array);
        }
Beispiel #6
0
        // create one cotnest entry using given start and end_time dates
        public static Contest CreateContes(OjDBContext ctx, string title, DateTime start_time, DateTime end_time)
        {
            Problem problem = ctx.Problems.First();

            var contest = new Contest()
            {
                Title       = title,
                Description = "Contest Contest",
                Creator     = ctx.Users.First(),
                Password    = "******",
                IsPublic    = false,
                StartDate   = start_time,
                EndDate     = end_time,
            };


            for (int i = 0; i < 5; i++)
            {
                ContestProblem contest_problem = new ContestProblem()
                {
                    Order   = i,
                    Contest = contest,
                    Problem = problem,
                };
                contest.Problems.Add(contest_problem);
            }


            for (int i = 0; i < 1; i++)
            {
                Contestant contestant = new Contestant(ctx.Users.First());
                contest.Contestants.Add(contestant);
            }

            return(contest);
        }