public override void LoadData() { NavigationHelper.IsBusy = true; BackgroundProcessFactory.RunAsync(null, (o, e) => { e.Result = DBDataSource.GeTestAttempts(); }, (o, e) => { NavigationHelper.IsBusy = false; if (e.Error != null) { return; } else { var attemts = e.Result as List <TestAttempt>; if (attemts != null) { ResultList = new ObservableCollection <TestAttempt>(attemts); _cv = CollectionViewSource.GetDefaultView(ResultList); _cv.Filter = FilterValid; _cv.Refresh(); } } }); }
public override void LoadData() { NavigationHelper.IsBusy = true; BackgroundProcessFactory.RunAsync(null, (o, e) => { e.Result = DBDataSource.GetTestGradeLimit(NavigationHelper.CurrrentTest.Id); }, (o, e) => { NavigationHelper.IsBusy = false; if (e.Error != null) { return; } else { _limits = e.Result as List <TestGradeLimit>; if (_limits != null) { foreach (Grade grade in Enum.GetValues(typeof(Grade))) { var limit = _limits.FirstOrDefault(l => l.Grade == (int)grade); if (limit != null) { switch (grade) { case Grade.Poor: PoorMaxValue = limit.ToPer; break; case Grade.Satisfactory: SatisfyMinValue = limit.FromPer; SatisfyMaxValue = limit.ToPer; break; case Grade.Good: GoodMinValue = limit.FromPer; GoodMaxValue = limit.ToPer; break; case Grade.Excellent: ExcellentMinValue = limit.FromPer; ExcellentMaxValue = limit.ToPer; break; } } } MinuteLimitCount = NavigationHelper.CurrrentTest.MinuteTimeLimit; QuestionCount = NavigationHelper.CurrrentTest.QuestionCount; } } }); }
public override void LoadData() { NavigationHelper.IsBusy = true; BackgroundProcessFactory.RunAsync(null, (o, e) => { e.Result = DBDataSource.GetQuestions(); }, (o, e) => { NavigationHelper.IsBusy = false; if (e.Error != null) { return; } else { var questions = e.Result as List <Question>; if (questions != null) { QuestionCollection = new ObservableCollection <Question>(questions); } } }); }
public override void LoadData() { NavigationHelper.IsBusy = true; BackgroundProcessFactory.RunAsync(null, (o, e) => { e.Result = DBDataSource.GetCurrentTest(); }, (o, e) => { NavigationHelper.IsBusy = false; if (e.Error != null) { return; } else { var test = e.Result as TestInstance; if (test != null) { NavigationHelper.CurrrentTest = test; } } }); }
private void ExecuteSaveCommand(Object parameter) { if (GradeLimitValidation()) { //КОД корректировки лимитов foreach (Grade grade in Enum.GetValues(typeof(Grade))) { var limit = _limits.FirstOrDefault(l => l.Grade == (int)grade); if (limit == null) { limit = new TestGradeLimit() { TestId = NavigationHelper.CurrrentTest.Id }; limit.Grade = (int)grade; _limits.Add(limit); } switch (grade) { case Grade.Poor: limit.FromPer = 0; limit.ToPer = PoorMaxValue; break; case Grade.Satisfactory: limit.FromPer = SatisfyMinValue; limit.ToPer = SatisfyMaxValue; break; case Grade.Good: limit.FromPer = GoodMinValue; limit.ToPer = GoodMaxValue; break; case Grade.Excellent: limit.FromPer = ExcellentMinValue; limit.ToPer = ExcellentMaxValue; break; } } NavigationHelper.CurrrentTest.MinuteTimeLimit = MinuteLimitCount; NavigationHelper.CurrrentTest.QuestionCount = QuestionCount; //Работа с БД NavigationHelper.IsBusy = true; BackgroundProcessFactory.RunAsync(null, (o, e) => { DBDataSource.SaveTestParam(NavigationHelper.CurrrentTest, _limits.ToArray()); }, (o, e) => { NavigationHelper.IsBusy = false; if (e.Error != null) { return; } else { var functionsView = new TeacherFunctionsView(); var vm = new TeacherFunctionsViewModel(); vm.LoadData(); functionsView.DataContext = vm; NavigationHelper.NavigateTo(functionsView); } }); } else { MessageBox.Show("Не верно указаны параметры", "Не верно указаны параметры", MessageBoxButton.OK, MessageBoxImage.Stop); } }