private static void Log(Change diff) { var line = DateTime.Now.ToString() + " Object: " + diff.Tag + " Changed: " + diff.Label + " From: " + diff.From + " To: " + diff.To + " By: " + Gradebook.CurrentUser; File.AppendAllText("diff.log", line + Environment.NewLine); }
internal static void LogDiff(Change change) { LogDiffs(new List<Change>() { change }); }
internal void UnApprove() { var oldStage = ApprovalStage; var newStage = (ApprovalStage)((int)ApprovalStage - 1); var change = new Change(this, "Unapproval", oldStage.ToString(), newStage.ToString()); ApprovalStage = newStage; Save(new List<Change>() { change }); ChangeStage(); }
internal static ValidationEnum SetPassword(string userName, string unhashedPassword1, string unhashedPassword2) { var user = Maintenance.Users.SingleOrDefault(u => u.Name.ToUpper() == userName.ToUpper()); if (user == null) return ValidationEnum.FailedUserNotFound; if (string.IsNullOrWhiteSpace(unhashedPassword1)) return ValidationEnum.PasswordRequired; if (unhashedPassword1 != unhashedPassword2) return ValidationEnum.PasswordsDoNotMatch; user.HashedPassword = User.Hash(user.Name, unhashedPassword1); var change = new Change(user, "password", "old", "new"); ChangeLog.LogDiff(change); Maintenance.SaveUsers(); ValidateUser(userName, unhashedPassword1); return ValidationEnum.PasswordChanged; }
internal void Approve() { var oldStage = ApprovalStage; var newStage = (ApprovalStage)((int)ApprovalStage + 1); if (UserViewModel.CurrentUser.HasClassroomRights && newStage == ApprovalStage.Instructor) newStage = ApprovalStage.Classroom; var change = new Change(this, "Approval", oldStage.ToString(), newStage.ToString()); ApprovalStage = newStage; Save(new List<Change>() { change }); ChangeStage(); }