コード例 #1
0
        public async Task <IEnumerable <TestResultModel> > Gettest(TestInfoModel para)
        {
            var data = await this._testRepository.GetTest();

            var result = _mapper.Map <IEnumerable <TestDataModel>, IEnumerable <TestResultModel> >(data);

            return(result);
        }
コード例 #2
0
 private static async void ChangeStyleOfLabelsAsync(TestInfoModel model, bool change)
 {
     if (change)
     {
         await Task.Run(() => {
             model.LabelNameColor    = GetColor(Filter == FilterMode.Name);
             model.LabelDateColor    = GetColor(Filter == FilterMode.Date);
             model.LabelSubjectColor = GetColor(Filter == FilterMode.Subject);
         });
     }
 }
コード例 #3
0
        public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            TestInfoModel model = value as TestInfoModel;

            if (model == null)
            {
                return(Visibility.Collapsed);
            }
            if (model.Valid == TestState.Error)
            {
                return(IsError ? Visibility.Visible : Visibility.Collapsed);
            }
            return(IsError ? Visibility.Collapsed : Visibility.Visible);
        }
コード例 #4
0
        TestInfoModel GetValidTestInfoModel(int rowHandle)
        {
            if (!Grid.IsValidRowHandle(rowHandle) || Grid.IsGroupRowHandle(rowHandle))
            {
                return(null);
            }
            TestInfoModel testInfoModel = Grid.GetRow(rowHandle) as TestInfoModel;

            if (testInfoModel == null || testInfoModel.Valid == TestState.Error)
            {
                return(null);
            }
            return(testInfoModel);
        }
コード例 #5
0
        public ActionResult ExamsInfo(int Employeeid)
        {
            fillUserData();
            var employee = db
                           .Employees
                           .Where(e => e.Id == Employeeid)
                           .FirstOrDefault();

            var registrations = db
                                .Registrations
                                .Include("Test")
                                .Include("Test.TestXQuestions")
                                .Include("Test.TestXQuestions.Question")
                                .Include("TestXPapers")
                                .Where(reg => reg.EmployeeId == Employeeid);

            List <TestInfoModel> tests = new List <TestInfoModel>();

            foreach (var reg in registrations)
            {
                TestInfoModel test = new TestInfoModel()
                {
                    TestId     = reg.TestId,
                    TestName   = reg.Test.Name,
                    TotalMark  = reg.Test.TestXQuestions.Take(reg.Test.QuestionLimit).Sum(txq => txq.Question.points),
                    MarkScored = reg.TestXPapers.Sum(txp => txp.MarkScored)
                };

                tests.Add(test);
            }

            ExamsInfoViewModel examsInfoViewModel = new ExamsInfoViewModel()
            {
                EmployeeId   = Employeeid,
                EmployeeName = employee.Name,
                Tests        = tests
            };

            return(View(examsInfoViewModel));
        }
コード例 #6
0
        private static bool FilterBy(TestInfoModel model, string keyword, FilterMode filter)
        {
            var itContain = false;

            switch (filter)
            {
            case FilterMode.Name:
                itContain = model.Name.ToLower().Contains(keyword.ToLower());
                break;

            case FilterMode.Subject:
                itContain = model.Subject.ToLower().Contains(keyword.ToLower());
                break;

            case FilterMode.Date:
                itContain = model.Date.ToLower().Contains(keyword.ToLower());
                break;
            }

            ChangeStyleOfLabelsAsync(model, itContain);

            return(itContain);
        }