コード例 #1
0
        private void LoadTask(Task task = null)
        {
            IsRightResult = false;
            UserQuery     = "";
            ResultList    = null;

            if (task != null)
            {
                _sheme = TrainSQL_Commands.GetDbSheme(task.dbID);

                TaskInfo = $"#{task.TaskID} " + task.TaskText;
                if (_sheme != null)
                {
                    DBImage = Helper.BytesToBitmapImage(_sheme.ShemeImg);
                    DBInfo  = _sheme.Info;
                }
            }
            else
            {
                if (tasks.Count() > 1)
                {
                    TrainSQL_Commands.AddUserProgress(CurrentUser.Login, _rightAnswersCount, tasks.Count());

                    MessageBox.Show($"Ваш результат: {_rightAnswersCount}/{tasks.Count()}");
                }
                Mediator.Inform("LoadUserMainPage", CurrentUser.Login);
            }
        }
コード例 #2
0
        /// <summary>
        /// Получить
        /// </summary>
        /// <param name="dbID"></param>
        /// <returns></returns>
        public static Sheme GetDbSheme(int dbID = 0)
        {
            Sheme sheme = null;

            try
            {
                using (var context = new TrainSQL_Entities())
                {
                    TestDatabas testDB = context.TestDatabases.FirstOrDefault(x => x.dbID == dbID);
                    if (testDB != null)
                    {
                        sheme = context.Shemes.FirstOrDefault(x => x.ShemeID == testDB.ShemeID);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            return(sheme);
        }