public StudentProfile(TEFLProfile profile) { Profile = profile; if (DataLayer.DbContext.GetProfilePic(profile.ID, out DataLayer.DbProfilePic pic)) { ProfilePic = Helpers.Functions.LoadImage(pic.ImageBytes); } else { ProfilePic = DefaultPic; } InitializeComponent(); AssignModuleScoreLists(ModuleNum.Mod1, Profile.Mod1QuizScores.Split(',').Where(x => !string.IsNullOrEmpty(x)).ToArray()); AssignModuleScoreLists(ModuleNum.Mod2, Profile.Mod2QuizScores.Split(',').Where(x => !string.IsNullOrEmpty(x)).ToArray()); AssignModuleScoreLists(ModuleNum.Mod3, Profile.Mod3QuizScores.Split(',').Where(x => !string.IsNullOrEmpty(x)).ToArray()); AssignModuleScoreLists(ModuleNum.Mod4, Profile.Mod4QuizScores.Split(',').Where(x => !string.IsNullOrEmpty(x)).ToArray()); AssignModuleScoreLists(ModuleNum.FinalExam, Profile.ExamScores.Split(',').Where(x => !string.IsNullOrEmpty(x)).ToArray()); FinalExamPassedText.Content = Helpers.Functions.HighestExamScore(Profile.ExamScores) > Helpers.Globals.QuizScorePassMark ? PageText.Passed : ""; if (Profile.LessonPlanSubmitted) { AssignmentText.Content = PageText.LessonPlanSubmitted; Button downloadBtn = new Button { Content = PageText.Download, HorizontalAlignment = HorizontalAlignment.Center, Style = FindResource("MainButtonStyle") as Style, Margin = new Thickness(0, 15, 0, 0), }; downloadBtn.Click += DownloadAssignment; AssignmentStackPanel.Children.Add(downloadBtn); } else { AssignmentText.Content = PageText.LessonPlanNotSubmitted; } if (Profile.CertificateID > 0) { TEFlCertText.Content = PageText.TEFLCertificate; } else { TEFlCertText.Content = " - "; } }
public static bool PasswordsCompare(string givenPassword, TEFLProfile profile) { if (profile.AppPassword == null || profile.AppPassword.Length == 0) { return(true); } else { byte[] passwordHash = GeneratePasswordHash(givenPassword); return(ByteArraysEqual(passwordHash, profile.AppPassword)); } }
public static void ShowStudentProfile(TEFLProfile profile) { try { Views.General.PopupWindow popUp = new Views.General.PopupWindow(profile.Name); popUp.Content = new Views.Student.StudentProfile(profile); popUp.Show(); } catch (Exception e) { ShowErrorMessageDialog(e); } }