/// <summary> /// writes all knwo data form a session to the server /// </summary> public void writeHistory() { if (Authentication.rights != Authentication.Rights.PATIENT) { return; } var stat = new HistoryStats(Statistics, identifier.name, messages); if (alreadySaved != null) { server.exception(identifier, "Overwriting history [session already saved]"); history.Remove(alreadySaved); } alreadySaved = stat; history.Add(stat); stat.historyID = history.Count - 1; server.WriteSessions(history); }
public void loadHistory(HistoryStats stats) { foreach (var existing in loadedHistory) { if (existing.historyID == stats.historyID) { return; } } loadedHistory.Add(stats); if (messages != null) { var ident = new HistoryIdentifier(stats.historyID, stats.ToString2(), Authentication.Rights.UNKNOWN); var otherident = new HistoryIdentifier(stats.historyID, client.name, Authentication.Rights.UNKNOWN); foreach (var message in stats.messages) { if (message != null) { if (message.source.rights == Authentication.Rights.PATIENT) { message.source = ident; message.target = otherident; } else { message.target = ident; message.source = otherident; } client.messages.Add(message); } } targets.Items.Add(ident); } }