예제 #1
0
        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));
        }
예제 #2
0
        public string GetUser(long id)
        {
            var command = $"SELECT * FROM Nutzerdaten WHERE Id={id}";
            var r       = DatabaseManager.ExecuteReader(command);

            return(DatabaseManager.ReadFirstAsJsonObject(GetUserKeyTableDictionary(), r, null));
        }
예제 #3
0
        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));
        }
예제 #4
0
 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));
     }
 }
예제 #5
0
        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));
            }
        }
예제 #7
0
        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));
        }
예제 #8
0
        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);
            }
        }
예제 #11
0
        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 }
                }));
            }
        }
예제 #12
0
        public string GetCalendar(long id)
        {
            var r = DatabaseManager.ExecuteReader($"SELECT * FROM Kalender WHERE Id={id}");

            return(DatabaseManager.ReadFirstAsJsonObject(GetCalendarKeyTableDictionary(), r, null));
        }