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)); }
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 }; }
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() }); }
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 } }; }
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; } }
public MailMessage CreateArchivedMailMessage(BaseScoreCard scoreCard) { return(this.CreateMailMessage(scoreCard, this.GetArchivedMailBody, this.expirationCheckerSettings.ArchivedMailSubject)); }
private string GetAlmostArchivedMailBody(BaseScoreCard scoreCard) { return(this.GetToBeArchivedMailBody(scoreCard, this.expirationCheckerSettings.AlmostArchivedMailMessage)); }
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); }