Skip to content

Commit

Permalink
edit something
Browse files Browse the repository at this point in the history
  • Loading branch information
yuseop-choung committed Jun 5, 2021
1 parent d30259f commit f6fb0e5
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 7 deletions.
15 changes: 14 additions & 1 deletion Client/Panels/PanelSchedule.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 28 additions & 1 deletion Client/Panels/PanelSchedule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ namespace Client.Panels
{
public partial class PanelSchedule : PanelSlider
{
public static string[] target1 = { "자원본부", "철강본부", "섬유본부", "영업본부" };
public static string[] target2 = { "자원1팀", "자원2팀", "자원3팀" };
public static string[] target3 = { "철강1팀", "철강2팀", "철강3팀" };
public static string[] target4 = { "섬유1팀", "섬유2팀", "섬유3팀" };
public static string[] target5 = { "영업1팀", "영업2팀", "영업3팀" };

FormMain owner;
public PanelSchedule(Form owner, SlidingType type) : base(owner, type)
{
Expand All @@ -23,6 +29,27 @@ public PanelSchedule(Form owner, SlidingType type) : base(owner, type)
private void PanelSchedule_Load(object sender, EventArgs e)
{
cmbScope.Items.AddRange(Room.Scope);
if (cmbScope.SelectedItem == null)
{
cmbTarget.Enabled = false;
}
else if (cmbScope.SelectedItem as string == "본부 전체")
{
cmbTarget.Items.AddRange(target1);
}
else if (cmbScope.SelectedItem as string == "팀 전체")
{
if (Program.employee.central == "자원본부")
cmbTarget.Items.AddRange(target2);
else if (Program.employee.central == "철강본부")
cmbTarget.Items.AddRange(target3);
else if (Program.employee.central == "섬유본부")
cmbTarget.Items.AddRange(target4);
else if (Program.employee.central == "영업본부")
cmbTarget.Items.AddRange(target5);
}
else
cmbTarget.Enabled = false;
}

private void pic_MouseEnter(object sender, EventArgs e)
Expand Down Expand Up @@ -51,7 +78,7 @@ private void tleSubmit_Click(object sender, EventArgs e)
try
{
Program.Send(new SchedulePacket(new Schedule(Program.employee.id, txtTitle.Text, dtpStart.Value, dtpEnd.Value,
cmbScope.SelectedItem as string, txtContent.Text)));
cmbScope.SelectedItem as string, txtContent.Text, cmbTarget.SelectedItem as string)));
}
catch (FormatException) { }
Swipe(false);
Expand Down
4 changes: 3 additions & 1 deletion OSTLibrary/Classes/Schedule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ public class Schedule
public DateTime end;
public string scope;
public string contents;
public string target;



public Schedule(int author, string title, DateTime start, DateTime end,string scope, string contents)
public Schedule(int author, string title, DateTime start, DateTime end,string scope, string contents, string target)
{
this.author = author;
this.title = title;
this.start = start;
this.end = end;
this.scope = scope;
this.contents = contents;
this.target = target;
}
}
}
2 changes: 1 addition & 1 deletion Server/Classes/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void Recieve()
Program.roomEmps.Add(room.id, new List<int>(new int[] { employee.id }));

room.lastChat = Database.GetLastChat(room);
}
}

List<Schedule> mySchedule = Database.GetSchedule(emp);
p = new LoginPacket(true, Program.employees, myRooms, mySchedule);
Expand Down
8 changes: 5 additions & 3 deletions Server/Classes/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public static bool Register(Employee employee)
public static bool AddSchedule(Schedule schedule)
{
MySqlCommand cmd = new MySqlCommand(
"INSERT INTO schedule VALUES (@author, @title, @start, @end, @scope, @contents);",
"INSERT INTO schedule VALUES (@author, @title, @start, @end, @scope, @contents, @target);",
con);
using(MemoryStream ms = new MemoryStream())
{
Expand All @@ -150,6 +150,7 @@ public static bool AddSchedule(Schedule schedule)
cmd.Parameters.Add(end);
cmd.Parameters.AddWithValue("@scope", schedule.scope);
cmd.Parameters.Add(contents);
cmd.Parameters.AddWithValue("@target", schedule.target); ;
}
try
{
Expand All @@ -166,7 +167,7 @@ public static List<Schedule> GetSchedule(Employee emp)
{
List<Schedule> schedules = new List<Schedule>();

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

using (MySqlDataReader rdr = cmd.ExecuteReader())
Expand All @@ -180,7 +181,8 @@ public static List<Schedule> GetSchedule(Employee emp)
rdr.GetDateTime("start"),
rdr.GetDateTime("end"),
rdr.GetString("scope"),
rdr.GetString("contents")));
rdr.GetString("contents"),
rdr.GetString("target")));
}
}
return schedules;
Expand Down

0 comments on commit f6fb0e5

Please sign in to comment.