public string GetAdmin(long id) { var command = $"SELECT * FROM Admins INNER JOIN Nutzerdaten ON Admins.Id=Nutzerdaten.Id WHERE Admins.Id={id}"; var r = DatabaseManager.ExecuteReader(command); return(DatabaseManager.ReadFirstAsJsonObject(GetAdminKeyTableDictionary(), r, null)); }
public string GetUser(long id) { var command = $"SELECT * FROM Nutzerdaten WHERE Id={id}"; var r = DatabaseManager.ExecuteReader(command); return(DatabaseManager.ReadFirstAsJsonObject(GetUserKeyTableDictionary(), r, null)); }
public string GetOrganizer(long id) { var command = $"SELECT * FROM Veranstalter INNER JOIN Nutzerdaten ON Veranstalter.Id=Nutzerdaten.Id WHERE Veranstalter.Id={id}"; var r = DatabaseManager.ExecuteReader(command); return(DatabaseManager.ReadFirstAsJsonObject(GetOrganizerKeyTableDictionary(), r, null)); }
public string GetBooking(long bookingId) { using (var reader = DatabaseManager.ExecuteReader($"SELECT * FROM Nutzerdaten INNER JOIN Buchungen ON Buchungen.Nutzer=Nutzerdaten.Id WHERE Buchungen.Id={bookingId}")) { return(DatabaseManager.ReadFirstAsJsonObject(GetKeyTableDictionary(), reader, null)); } }
public static string GetId(string queryCommand) { var id = DatabaseManager.ReadFirstAsJsonObject(new Dictionary <string, string> { { "id", "Id" } }, DatabaseManager.ExecuteReader(queryCommand), null); return(Json.GetKvpValue(id, "id", false)); }
public string GetEvent(long eventId) { var command = $"SELECT * FROM Veranstaltungen WHERE Veranstaltungen.Id={eventId}"; using (var reader = DatabaseManager.ExecuteReader(command)) { return(DatabaseManager.ReadFirstAsJsonObject(GetEventKeyTableDictionary(), reader, null)); } }
public bool ProcessBooking(long bookingId) { var result = String.Empty; using (var reader = DatabaseManager.ExecuteReader($"SELECT * FROM Nutzerdaten INNER JOIN Buchungen ON Buchungen.Nutzer=Nutzerdaten.Id WHERE Buchungen.Id={bookingId}")) { result = DatabaseManager.ReadFirstAsJsonObject(GetKeyTableDictionary(), reader, null); } return(ProcessBooking(result, bookingId)); }
public long GetCalendarId(string name) { if (name == null) { return(-1); } var command = $"SELECT * FROM Kalender WHERE Name={Json.SerializeString(name)}"; var r = DatabaseManager.ExecuteReader(command); var result = DatabaseManager.ReadFirstAsJsonObject(GetCalendarKeyTableDictionary(), r, null); if (result == null) { return(-1); } return(Convert.ToInt64(Json.GetValue(result, "id", false))); }
public string GetEvent(string uid) { var result = CalendarManager.GetEventAsJsonObject(uid); if (result == null) { return(null); } var command = $"SELECT * FROM Veranstaltungen WHERE Veranstaltungen.Uid=\"{uid}\""; using (var reader = DatabaseManager.ExecuteReader(command)) { result = Json.MergeObjects(new string[] { result, DatabaseManager.ReadFirstAsJsonObject(GetEventKeyTableDictionary(), reader, null) }, true); } return(result); }
public bool ProcessVerification(string code) { var dateTime = CalendarManager.GetDateTime(DateTime.Now); var reader = DatabaseManager.ExecuteReader($"SELECT * FROM Emailverifizierungen WHERE Code=\"{code}\" AND Zeitfrist>={dateTime}"); var r = DatabaseManager.ReadFirstAsJsonObject(new Dictionary <string, string> { { "nutzer", "Nutzer" } }, reader, null); var id = Convert.ToInt64(Json.GetKvpValue(r, "nutzer", false)); if (new NutzerModel().VerifyUser(id) > 0) { DeleteVerificationCode(GetVerificationCodeId(code)); return(true); } else { return(false); } }
public string GetCalendar(string name) { var command = "SELECT * FROM Kalender"; if (name != null) { command += $" WHERE Name={Json.SerializeString(name)}"; } var r = DatabaseManager.ExecuteReader(command); if (name != null) { return(DatabaseManager.ReadFirstAsJsonObject(GetCalendarKeyTableDictionary(), r, null)); } else { var result = DatabaseManager.ReadAsJsonArray(GetCalendarKeyTableDictionary(), r); return(Json.SerializeObject(new Dictionary <string, string> { { "kalender", result } })); } }
public string GetCalendar(long id) { var r = DatabaseManager.ExecuteReader($"SELECT * FROM Kalender WHERE Id={id}"); return(DatabaseManager.ReadFirstAsJsonObject(GetCalendarKeyTableDictionary(), r, null)); }