Skip to content

Commit

Permalink
fixxing GetSchedule
Browse files Browse the repository at this point in the history
  • Loading branch information
elfaka committed Jun 3, 2021
1 parent ecb968a commit 03d95d9
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Server/Classes/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ public static bool AddSchedule(Schedule schedule)
using(MemoryStream ms = new MemoryStream())
{
MySqlParameter start = new MySqlParameter("@start", MySqlDbType.DateTime, (int)ms.Length);
MySqlParameter end = new MySqlParameter("@start", MySqlDbType.DateTime, (int)ms.Length);
MySqlParameter contents = new MySqlParameter("@start", MySqlDbType.LongText, (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 연결할 것
end.Value = ms.ToArray();
contents.Value = ms.ToArray();

cmd.Parameters.AddWithValue("@author", schedule.author);
cmd.Parameters.AddWithValue("@title", schedule.title);
Expand All @@ -162,29 +162,30 @@ public static bool AddSchedule(Schedule schedule)
return false;
}
}
public static Schedule GetSchedule(int authorID)
public static List<Schedule> GetSchedule(Employee emp)
{
string sql = $"SELECT author, title, start, end, scope, contents FROM employee WHERE id={authorID}";
List<Schedule> schedules = new List<Schedule>();

string sql = $"SELECT author, title, start, end, scope, contents FROM employee WHERE id={emp}";
MySqlCommand cmd = new MySqlCommand(sql, con);

using (MySqlDataReader rdr = cmd.ExecuteReader())
{
if (rdr.Read())
{
using (MemoryStream ms = new MemoryStream())
return new Schedule(
schedules.Add(new Schedule(
rdr.GetInt32("author"),
rdr.GetString("scope"),
rdr.GetDateTime("start"),
rdr.GetDateTime("end"),
rdr.GetInt32("scope"),
rdr.GetString("contents"));
rdr.GetString("contents")));
}
}
return null;
return schedules;

}

// 채팅
public static bool AddRoom(Room room)
{
Expand Down

0 comments on commit 03d95d9

Please sign in to comment.