From f866a92e21ac810f10e59e78fc0dd941618bd457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=84=A0=EA=B7=9C?= Date: Fri, 4 Jun 2021 00:22:47 +0900 Subject: [PATCH] fixxing addschedule, getschedule --- Server/Classes/Database.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Server/Classes/Database.cs b/Server/Classes/Database.cs index 2024a71..77f498e 100644 --- a/Server/Classes/Database.cs +++ b/Server/Classes/Database.cs @@ -140,15 +140,15 @@ public static bool AddSchedule(Schedule schedule) MySqlParameter start = new MySqlParameter("@start", MySqlDbType.DateTime, (int)ms.Length); MySqlParameter end = new MySqlParameter("@end", MySqlDbType.DateTime, (int)ms.Length); MySqlParameter contents = new MySqlParameter("@contents", MySqlDbType.LongText, (int)ms.Length); - start.Value = ms.ToArray(); // MetroDateTime 연결할 것 - end.Value = ms.ToArray(); // MetroDateTime 연결할 것 - contents.Value = ms.ToArray(); + start.Value = schedule.start; // MetroDateTime 연결할 것 + end.Value = schedule.end; // MetroDateTime 연결할 것 + contents.Value = schedule.contents; cmd.Parameters.AddWithValue("@author", schedule.author); cmd.Parameters.AddWithValue("@title", schedule.title); cmd.Parameters.Add(start); cmd.Parameters.Add(end); - cmd.Parameters.AddWithValue("@scope", schedule.scope); + cmd.Parameters.AddWithValue("@scope", schedule.range); cmd.Parameters.Add(contents); } try @@ -166,7 +166,7 @@ public static List GetSchedule(Employee emp) { List schedules = new List(); - string sql = $"SELECT author, title, start, end, scope, contents FROM employee WHERE id={emp}"; + string sql = $"SELECT author, title, start, end, range, contents FROM employee WHERE id={emp}"; MySqlCommand cmd = new MySqlCommand(sql, con); using (MySqlDataReader rdr = cmd.ExecuteReader()) @@ -176,10 +176,10 @@ public static List GetSchedule(Employee emp) using (MemoryStream ms = new MemoryStream()) schedules.Add(new Schedule( rdr.GetInt32("author"), - rdr.GetString("scope"), + rdr.GetString("title"), rdr.GetDateTime("start"), rdr.GetDateTime("end"), - rdr.GetInt32("scope"), + rdr.GetString("range"), rdr.GetString("contents"))); } } @@ -190,7 +190,7 @@ public static List GetSchedule(Employee emp) public static bool AddRoom(Room room) { MySqlCommand cmd = new MySqlCommand( - "INSERT INTO room VALUES (@id, @scope, @target);", + "INSERT INTO room VALUES (@id, @range, @target);", con); cmd.Parameters.AddWithValue("@id", room.id);