Skip to content

Commit

Permalink
fixxing addschedule, getschedule
Browse files Browse the repository at this point in the history
  • Loading branch information
elfaka committed Jun 3, 2021
1 parent 5303d5d commit f866a92
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Server/Classes/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -166,7 +166,7 @@ public static List<Schedule> GetSchedule(Employee emp)
{
List<Schedule> schedules = new List<Schedule>();

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())
Expand All @@ -176,10 +176,10 @@ public static List<Schedule> 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")));
}
}
Expand All @@ -190,7 +190,7 @@ public static List<Schedule> 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);
Expand Down

0 comments on commit f866a92

Please sign in to comment.