Skip to content

Commit

Permalink
edit something (print schedule...)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuseop-choung committed Jun 5, 2021
1 parent e05b258 commit e2b82f7
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 42 deletions.
16 changes: 0 additions & 16 deletions Client/Forms/ControlSchedule.Designer.cs

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

16 changes: 0 additions & 16 deletions Client/Forms/ControlSchedule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,5 @@ private void picContent_Click(object sender, EventArgs e)
//'+' ์•„์ด์ฝ˜ ํด๋ฆญ ์‹œ ์ผ์ • ๋‚ด์šฉ ๋ฉ”์„ธ์ง€๋ฐ•์Šค๋กœ ์ถœ๋ ฅ
MessageBox.Show(ctent, "์Šค์ผ€์ค„ ๋‚ด์šฉ", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

private void picDelete_Click(object sender, EventArgs e)
{
//ํด๋ฆญ ์‹œ ์Šค์ผ€์ค„ ์ˆ˜๋™ ์‚ญ์ œ
//๊ธฐ๊ฐ„ ๋งŒ๊ธฐ ์‹œ ์ž๋™์‚ญ์ œ๋Š” ์–ด๋””์„œํ•ด์•ผํ• ๊นŒ?
var result = MessageBox.Show(
"์ผ์ •์„ ์‚ญ์ œํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?",
"Caption",
MessageBoxButtons.OKCancel,
MessageBoxIcon.Question
);
if(result == DialogResult.OK)
{
//์ปจํŠธ๋กค ์‚ญ์ œ ์ฝ”๋“œ
}
}
}
}
2 changes: 1 addition & 1 deletion Client/Forms/ControlSchedule.resx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACq
BwAAAk1TRnQBSQFMAgEBBAEAAVABAAFQAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
BwAAAk1TRnQBSQFMAgEBBAEAAVgBAAFYAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
Expand Down
12 changes: 8 additions & 4 deletions Client/Forms/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public partial class FormMain : MetroForm
{
Dictionary<string, FormRoom> formChats; // ์ผœ์ ธ์žˆ๋Š” ์ฑ„ํŒ…๋ฐฉ๋“ค
Dictionary<string, ControlRoomCard> roomCards; // ๋‚˜์˜ ์ฑ„ํŒ…๋ฐฉ ์นด๋“œ๋“ค
Dictionary<int, ControlSchedule> scheduleCards; //๋‚˜์˜ ์Šค์ผ€์ค„ ์นด๋“œ๋“ค

public FormMain()
{
Expand Down Expand Up @@ -53,7 +52,7 @@ private void FormMain_Shown(object sender, EventArgs e)
formChats = new Dictionary<string, FormRoom>();
roomCards = new Dictionary<string, ControlRoomCard>();
// ์Šค์ผ€์ค„ ๊ด€๋ จ ์ปจํŠธ๋กค๋“ค ๋ฐฐ์—ด ์ดˆ๊ธฐํ™”
scheduleCards = new Dictionary<int, ControlSchedule>();
List<Schedule> scheduleCards = new List<Schedule>();

// ์ตœ์ดˆ ๋ฃธ ๋ชจ๋‘ ์ถ”๊ฐ€
Program.rooms.ForEach(AddRoomCard);
Expand Down Expand Up @@ -268,8 +267,13 @@ void AddRoomCard(Room room)
void AddScheduleCard(Schedule schedule) //์Šค์ผ€์ค„์นด๋“œ ์ƒ์„ฑ
{
ControlSchedule Cardschedule = new ControlSchedule(schedule);

scheduleCards.Add(Program.employee.id, Cardschedule);
List<Schedule> ScheduleCards = new List<Schedule>();
//์Šค์ผ€์ค„ ์นด๋“œ ์ถ”๊ฐ€
if (DateTime.Now < schedule.end)
{
tpSchedule.Controls.Add(Cardschedule);
ScheduleCards.Add(schedule);
}
}
void ReceiveRoom(Packet p)
{
Expand Down
7 changes: 7 additions & 0 deletions Client/Panels/PanelSchedule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ private void picClose_Click(object sender, EventArgs e)
private void tleSubmit_Click(object sender, EventArgs e)
{
// Panel -> Client.cs(Server)
if(dtpStart.Value < DateTime.Now || dtpStart.Value > dtpEnd.Value)
{
MessageBox.Show("์ž˜๋ชป๋œ ๋‚ ์งœ ํ˜•์‹์ž…๋‹ˆ๋‹ค. ๋‚ ์งœ๋ฅผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ๋‹ค์‹œ ์„ค์ •ํ•ด์ฃผ์‹ญ์‹œ์˜ค.",
"์˜ค๋ฅ˜", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}

try
{
Program.Send(new SchedulePacket(new Schedule(Program.employee.id, txtTitle.Text, dtpStart.Value, dtpEnd.Value,
Expand Down
1 change: 0 additions & 1 deletion Server/Classes/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ public void Recieve()
}

List<Schedule> mySchedule = Database.GetSchedule(emp);

p = new LoginPacket(true, Program.employees, myRooms, mySchedule);
}

Expand Down
4 changes: 2 additions & 2 deletions Server/Classes/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public static List<Schedule> GetSchedule(Employee emp)
{
List<Schedule> schedules = new List<Schedule>();

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

using (MySqlDataReader rdr = cmd.ExecuteReader())
Expand All @@ -179,7 +179,7 @@ public static List<Schedule> GetSchedule(Employee emp)
rdr.GetString("title"),
rdr.GetDateTime("start"),
rdr.GetDateTime("end"),
rdr.GetString("range"),
rdr.GetString("scope"),
rdr.GetString("contents")));
}
}
Expand Down
2 changes: 0 additions & 2 deletions Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class Program

public static Dictionary<int, Client> clients; // ๋กœ๊ทธ์ธ ํ›„ ํด๋ผ์ด์–ธํŠธ๋“ค
public static Dictionary<int, Employee> employees; // ์‚ฌ์›๋“ค ์ •๋ณด
public static Dictionary<int, Schedule> schedules; // ์Šค์ผ€์ค„ ์ •๋ณด๋“ค
public static Dictionary<string, List<int>> roomEmps; // ๊ฐ ๋ฃธ์— ์žˆ๋Š” ์ ‘์†๋œ ์‚ฌ์› ๋ฒˆํ˜ธ

static void Main(string[] args)
Expand All @@ -25,7 +24,6 @@ static void Main(string[] args)
clients = new Dictionary<int, Client>();
unloginedClients = new List<Client>();
roomEmps = new Dictionary<string, List<int>>();
schedules = new Dictionary<int, Schedule>();

// ๋ฐ์ดํ„ฐ ๋ฒ ์ด์Šค ์ ‘์†
if (Database.Connect())
Expand Down

0 comments on commit e2b82f7

Please sign in to comment.