Exemple #1
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public AssignmentDisplayProviderFactory(
     ITimeZoneProvider timeZoneProvider,
     IAssignmentUrlProvider assignmentUrlProvider)
 {
     _timeZoneProvider      = timeZoneProvider;
     _assignmentUrlProvider = assignmentUrlProvider;
 }
        /// <summary>
        /// Constructor.
        /// </summary>
        public QuestionSubmissionViewModel(
            QuestionSubmissionResult result,
            IAssignmentUrlProvider urlProvider,
            ITimeZoneProvider timeZoneProvider)
        {
            var submissionUrl = urlProvider.GetQuestionSubmissionUrl(
                result.AssignmentId,
                result.QuestionId,
                result.SubmissionDate,
                result.UserId);

            SubmissionDate = GetLink
                             (
                submissionUrl,
                result.SubmissionDate.FormatShortDateTime(timeZoneProvider),
                preventWrapping: true
                             );

            Score = GetColoredText
                    (
                "black",
                $"{result.Score} / {result.QuestionPoints}",
                bold: false,
                preventWrapping: true
                    );

            Status = GetColoredText
                     (
                result.Status.GetColor(),
                result.Status.GetText(),
                result.Status.GetBold(),
                preventWrapping: true
                     );
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 protected AssignmentDisplayProvider(
     ITimeZoneProvider timeZoneProvider,
     IAssignmentUrlProvider assignmentUrlProvider)
 {
     TimeZoneProvider      = timeZoneProvider;
     AssignmentUrlProvider = assignmentUrlProvider;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 public CombinedSubmissionsDisplayProvider(
     ITimeZoneProvider timeZoneProvider,
     IAssignmentUrlProvider assignmentUrlProvider,
     CombinedSubmissionsAssignmentResult result)
     : base(timeZoneProvider, assignmentUrlProvider)
 {
     _result = result;
 }
Exemple #5
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public SeparateSubmissionsDisplayProvider(
     ITimeZoneProvider timeZoneProvider,
     IAssignmentUrlProvider assignmentUrlProvider,
     SeparateSubmissionsAssignmentResult result)
     : base(timeZoneProvider, assignmentUrlProvider)
 {
     _result = result;
 }
        /// <summary>
        /// Constructor.
        /// </summary>
        public AssignmentSubmissionViewModel(
            AssignmentSubmissionResult result,
            IAssignmentUrlProvider urlProvider,
            ITimeZoneProvider timeZoneProvider)
        {
            var submissionUrl = urlProvider.GetAssignmentSubmissionUrl(
                result.AssignmentId,
                result.SubmissionDate,
                result.UserId);

            SubmissionDate = GetLink
                             (
                submissionUrl,
                result.SubmissionDate.FormatShortDateTime(timeZoneProvider),
                preventWrapping: true
                             );

            Score = GetColoredText
                    (
                "black",
                $"{result.Score} / {result.AssignmentPoints}",
                bold: false,
                preventWrapping: true
                    );

            Status = GetColoredText
                     (
                result.Status.GetColor(),
                result.Status.GetText(),
                result.Status.GetBold(),
                preventWrapping: true
                     );

            QuestionResults = result.QuestionResults
                              .Select
                              (
                qr => new StudentQuestionResultViewModel
                (
                    qr,
                    urlProvider,
                    timeZoneProvider
                )
                              ).ToList();
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        public StudentQuestionResultViewModel(
            StudentQuestionResult questionResult,
            IAssignmentUrlProvider urlProvider,
            ITimeZoneProvider timeZoneProvider)
        {
            var name = questionResult.QuestionName;

            QuestionName = GetColoredText
                           (
                "black",
                name,
                bold: false,
                preventWrapping: true
                           );

            ScoreText = GetColoredText
                        (
                "black",
                $"{questionResult.Score} / {questionResult.QuestionPoints}",
                bold: false,
                preventWrapping: true
                        );

            Status = GetColoredText
                     (
                questionResult.Status.GetColor(),
                questionResult.Status.GetText(),
                questionResult.Status.GetBold(),
                preventWrapping: true
                     );

            Submissions = questionResult
                          .SubmissionResults
                          ?.Select
                          (
                qsr => new QuestionSubmissionViewModel
                (
                    qsr,
                    urlProvider,
                    timeZoneProvider
                )
                          ).ToList();
        }