예제 #1
0
 public QuestionVM(TestSetupModel info)
 {
     try
     {
         selectionID    = info.Selection.id;
         timer          = new DispatcherTimer();
         timer.Interval = new TimeSpan(0, 0, 0, 1, 0);
         timer.Tick    += Timer_Tick;
         timer.Start();
         resourceName = "question";
         questionInfo = new QuestionModel();
     }
     catch
     {
         resourceName = "setup";
         var ts = new TestSetupVM();
         return;
     }
 }
예제 #2
0
        public BaseVM Authenticate(LoginModel loginInfo)
        {
            loginInfo.Password = BoundPasswordBox.Password;
            IRepository <User> userRepository = RepositoryFactory.Get <User>();
            User userInDB = null;

            using (var ctx = new TestingSystemModel())
            {
                userInDB = userRepository.FindBy(user => user.nickname.Equals(loginInfo.Username), ctx).FirstOrDefault();
            }
            if (userInDB != null && userInDB.password.Equals(loginInfo.Password))
            {
                MainWindowVM.CurrentUser = userInDB;
                BaseVM result = new TestSetupVM();
                result.ResourceName = "setup";
                return(result);
            }
            else
            {
                BaseVM result = new LoginVM(loginInfo, "Проблем с автентикацията на потребителя!!!");
                result.ResourceName = "login";
                return(result);
            }
        }