Skip to content

Commit

Permalink
clear addSchedule
Browse files Browse the repository at this point in the history
  • Loading branch information
elfaka committed Jun 5, 2021
1 parent d30259f commit c07696d
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions Server/Classes/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,25 +132,20 @@ public static bool Register(Employee employee)
// 일정
public static bool AddSchedule(Schedule schedule)
{

DateTime Start = schedule.start;
DateTime End = schedule.end;
MySqlCommand cmd = new MySqlCommand(
"INSERT INTO schedule VALUES (@author, @title, @start, @end, @scope, @contents);",
con);
using(MemoryStream ms = new MemoryStream())
{
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 = 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.Add(contents);
}

cmd.Parameters.AddWithValue("@author", schedule.author);
cmd.Parameters.AddWithValue("@title", schedule.title);
cmd.Parameters.Add("@start", MySqlDbType.DateTime, 50).Value = Start;
cmd.Parameters.Add("@end", MySqlDbType.DateTime, 50).Value = End;
cmd.Parameters.AddWithValue("@scope", schedule.scope);
cmd.Parameters.AddWithValue("@contents", schedule.contents);

try
{
cmd.ExecuteNonQuery();
Expand Down

0 comments on commit c07696d

Please sign in to comment.