예제 #1
0
        public NewProblemViewModel()
        {
            var repository = new EFRepository();

            TimeLimit = 2;
            MemoryLimit = 65536;

            List<SelectListItem> tempList = new List<SelectListItem>();
            StdCheckers.Checkers.ForEach(ch =>
                {
                    if (ch.Available)
                    {
                        tempList.Add(new SelectListItem()
                            {
                                Value = ch.CheckerID.ToString(),
                                Text = ch.Description
                            });
                    }
                });

            tempList.Add(new SelectListItem() { Text = "Другой", Value = "other" /* Must be in lower case for clientside validation*/ });

            CheckerList = tempList;

            ProblemTypesList = new List<SelectListItem>()
                {
                    new SelectListItem() { Value = ((int)ProblemTypes.Standart).ToString(), Text = "Стандартная задача (стандартные потоки ввода/вывода)" },
                    //new SelectListItem() { Value = ((int)ProblemTypes.Interactive).ToString(), Text = "Интерактивная задача (взаимодействие с программой интерактором)" },
                    new SelectListItem() { Value = ((int)ProblemTypes.Open).ToString(), Text = "Открытая задача (только ответ на задачу)" }
                };

            ProblemTagsList = new List<SelectListItem>();
            repository.ProblemTags.Each(t => ProblemTagsList.Add(new SelectListItem() { Text = t.Name, Value = t.ProblemTagID.ToString() }));
        }
예제 #2
0
 public void OnActionExecuted(ActionExecutedContext filterContext)
 {
     if (!(filterContext.Result is PartialViewResult) && !(filterContext.Result is JsonResult))
     {
         var repository = new EFRepository();
         var user = repository.Users.FirstOrDefault(u => u.UserId == WebSecurity.CurrentUserId);
         if (user != null)
         {
             user.LastAccessTime = DateTime.Now.Truncate(TimeSpan.FromSeconds(1));
             repository.UpdateUserProfile(user);
         }
     }
 }
예제 #3
0
        public AddSolutionViewModel()
        {
            List<SelectListItem> tempList = new List<SelectListItem>();

            var repository = new EFRepository();
            repository.ProgrammingLanguages.Each(pl =>
                {
                    if (repository.IsProgrammingLanguageEnable(pl.ProgrammingLanguageID))
                        tempList.Add(new SelectListItem() { Text = pl.Title, Value = ((int)pl.ProgrammingLanguageID).ToString() });
                });

            ProgrammingLanguagesList = tempList;
        }