string EvalAchievement(IEmployeeAchievement achievement, string objectName) { // TODO: Bind via viewmodel? if (objectName == "Type") { return(((achievement.Achievement != null)? achievement.Achievement.AchievementType : achievement.AchievementType) .Localize(ResourceFileRoot)); } if (objectName == NameOf(() => achievement.Title)) { return((achievement.Achievement != null) ? achievement.Achievement.Title : achievement.Title); } if (objectName == "Years") { return(UniversityFormatHelper.FormatYears( achievement.YearBegin, achievement.YearEnd, GetString("AtTheMoment.Text"))); } if (objectName == NameOf(() => achievement.TitleSuffix)) { return(achievement.TitleSuffix); } if (objectName == NameOf(() => achievement.IsTitle)) { return(achievement.IsTitle ? GetString("Yes") : string.Empty); } if (objectName == NameOf(() => achievement.Description)) { return(achievement.Description); } if (objectName == "DocumentUrl") { switch (Globals.GetURLType(achievement.DocumentURL)) { case TabType.Tab: return(Globals.NavigateURL(int.Parse(achievement.DocumentURL))); case TabType.File: return(GetFullFileUrl(int.Parse(achievement.DocumentURL.ToUpperInvariant().Replace("FILEID=", "")))); default: return(achievement.DocumentURL); } } return(null); }