Пример #1
0
 private string GetArchivedMailBody(BaseScoreCard scoreCard)
 {
     return(this.expirationCheckerSettings.ArchivedMailMessage
            .Replace("[journalscoreurl]", this.expirationCheckerSettings.JournalScoreUrl.TrimEnd('/'))
            .Replace("[newline]", "\r\n")
            .Replace("[username]", scoreCard.UserProfile.DisplayName)
            .Replace("[journaltitle]", scoreCard.Journal.Title)
            .Replace("[journalid]", scoreCard.JournalId.ToString(CultureInfo.InvariantCulture)));
 }
 private string GetArchivedMailBody(BaseScoreCard scoreCard)
 {
     return this.expirationCheckerSettings.ArchivedMailMessage
                .Replace("[journalscoreurl]", this.expirationCheckerSettings.JournalScoreUrl.TrimEnd('/'))
                .Replace("[newline]", "\r\n")
                .Replace("[username]", scoreCard.UserProfile.DisplayName)
                .Replace("[journaltitle]", scoreCard.Journal.Title)
                .Replace("[journalid]", scoreCard.JournalId.ToString(CultureInfo.InvariantCulture));
 }
Пример #3
0
        private MailMessage CreateMailMessage(BaseScoreCard scoreCard, Func <BaseScoreCard, string> mailBodyFunc, string mailSubject)
        {
            Requires.NotNull(scoreCard, "scoreCard");
            Requires.NotNull(mailBodyFunc, "mailBodyFunc");
            Requires.NotNullOrEmpty(mailSubject, "mailSubject");

            return(new MailMessage(this.GetMailSender(), new MailAddress(scoreCard.UserProfile.Email))
            {
                Body = mailBodyFunc(scoreCard),
                Subject = mailSubject
            });
        }
        private MailMessage CreateMailMessage(BaseScoreCard scoreCard, Func<BaseScoreCard, string> mailBodyFunc, string mailSubject)
        {
            Requires.NotNull(scoreCard, nameof(scoreCard));
            Requires.NotNull(mailBodyFunc, nameof(mailBodyFunc));
            Requires.NotNullOrEmpty(mailSubject, "mailSubject");

            return new MailMessage(this.GetMailSender(), new MailAddress(scoreCard.UserProfile.Email))
            {
                Body = mailBodyFunc(scoreCard),
                Subject = mailSubject
            };
        }
Пример #5
0
        public static BaseScoreCardViewModel ToBaseScoreCardViewModel(this BaseScoreCard scoreCard)
        {
            Requires.NotNull(scoreCard, "scoreCard");

            return(new BaseScoreCardViewModel
            {
                Id = scoreCard.JournalId,
                Remarks = scoreCard.Remarks,
                Submitted = scoreCard.Submitted,
                Editor = scoreCard.Editor,
                Journal = scoreCard.Journal.ToViewModel(),
                State = scoreCard.State,
                QuestionScores = scoreCard.QuestionScores.Select(ToViewModel).ToList()
            });
        }
Пример #6
0
        public static ScoreCardDto ConvertScoreCardDto(BaseScoreCard entity)
        {
            if (entity == null)
            {
                return(null);
            }

            if (entity is SortAndEvaluateScoreCard)
            {
                return(ConvertScoreCardDto(entity as SortAndEvaluateScoreCard));
            }
            else if (entity is KPExplorerQuestionnaireScoreCard)
            {
                return(ConvertScoreCardDto(entity as KPExplorerQuestionnaireScoreCard));
            }
            else if (entity is ReflectionScoreCard)
            {
                return(ConvertScoreCardDto(entity as ReflectionScoreCard));
            }
            else if (entity is GoalScoreCard)
            {
                return(ConvertScoreCardDto(entity as GoalScoreCard));
            }
            else if (entity is PromiseScoreCard)
            {
                return(ConvertScoreCardDto(entity as PromiseScoreCard));
            }
            else if (entity is VideoExerciseScoreCard)
            {
                return(ConvertScoreCardDto(entity as VideoExerciseScoreCard));
            }
            else if (entity is QuestionAnswerScoreCard)
            {
                return(ConvertScoreCardDto(entity as QuestionAnswerScoreCard));
            }
            else
            {
                return new ScoreCardDto
                       {
                           IsCompleted         = entity.IsCompleted,
                           ModuleId            = entity.Module != null ? new Guid?(entity.Module.ModuleReferenceId) : null,
                           ExerciseDescription = entity.ExerciseDescription,
                           ExerciseId          = entity.ExerciseId
                       }
            };
        }
Пример #7
0
        public void UpdateScoreCard(BaseScoreCard scoreCard, TimeSpan scoreCardLifeTime)
        {
            foreach (var questionScore in scoreCard.QuestionScores)
            {
                questionScore.Score = this.QuestionScores.First(q => q.Id == questionScore.Id).Score;
            }

            scoreCard.Score     = new BaseScoreCardScore(scoreCard.QuestionScores);
            scoreCard.Remarks   = this.Remarks;
            scoreCard.Submitted = this.Submitted;
            scoreCard.Editor    = this.Editor;

            if (this.Publish)
            {
                scoreCard.State          = ScoreCardState.Published;
                scoreCard.DatePublished  = DateTime.Now;
                scoreCard.DateExpiration = DateTime.Now + scoreCardLifeTime;
            }
        }
Пример #8
0
 public MailMessage CreateArchivedMailMessage(BaseScoreCard scoreCard)
 {
     return(this.CreateMailMessage(scoreCard, this.GetArchivedMailBody, this.expirationCheckerSettings.ArchivedMailSubject));
 }
Пример #9
0
 private string GetAlmostArchivedMailBody(BaseScoreCard scoreCard)
 {
     return(this.GetToBeArchivedMailBody(scoreCard, this.expirationCheckerSettings.AlmostArchivedMailMessage));
 }
Пример #10
0
 private BaseJournalPrice CreateNewBaseJournalPrice(BaseScoreCard scoreCard)
 {
     return(new BaseJournalPrice {
         BaseScoreCardId = scoreCard.Id, JournalId = scoreCard.JournalId, UserProfileId = this.Authentication.CurrentUserId, DateAdded = DateTime.Now,
     });
 }
 private string GetSoonToBeArchivedMailBody(BaseScoreCard scoreCard)
 {
     return this.GetToBeArchivedMailBody(scoreCard, this.expirationCheckerSettings.SoonToBeArchivedMailMessage);
 }
 public MailMessage CreateSoonToBeExpiredMailMessage(BaseScoreCard scoreCard)
 {
     return this.CreateMailMessage(scoreCard, this.GetSoonToBeArchivedMailBody, this.expirationCheckerSettings.SoonToBeArchivedMailSubject);
 }
 public MailMessage CreateAlmostExpiredMailMessage(BaseScoreCard scoreCard)
 {
     return this.CreateMailMessage(scoreCard, this.GetAlmostArchivedMailBody, this.expirationCheckerSettings.AlmostArchivedMailSubject);
 }