diff --git a/Client/Forms/ControlSchedule.Designer.cs b/Client/Forms/ControlSchedule.Designer.cs index 33d9b6f..8e02949 100644 --- a/Client/Forms/ControlSchedule.Designer.cs +++ b/Client/Forms/ControlSchedule.Designer.cs @@ -35,10 +35,8 @@ private void InitializeComponent() this.lblStart = new MetroFramework.Controls.MetroLabel(); this.lblEnd = new MetroFramework.Controls.MetroLabel(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); - this.picDelete = new System.Windows.Forms.PictureBox(); this.picContent = new System.Windows.Forms.PictureBox(); this.picRangeColor = new System.Windows.Forms.PictureBox(); - ((System.ComponentModel.ISupportInitialize)(this.picDelete)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picContent)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picRangeColor)).BeginInit(); this.SuspendLayout(); @@ -80,17 +78,6 @@ private void InitializeComponent() this.imageList1.Images.SetKeyName(2, "rank3"); this.imageList1.Images.SetKeyName(3, "rank4"); // - // picDelete - // - this.picDelete.Image = global::Client.Properties.Resources.trash; - this.picDelete.Location = new System.Drawing.Point(292, 5); - this.picDelete.Name = "picDelete"; - this.picDelete.Size = new System.Drawing.Size(25, 25); - this.picDelete.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picDelete.TabIndex = 5; - this.picDelete.TabStop = false; - this.picDelete.Click += new System.EventHandler(this.picDelete_Click); - // // picContent // this.picContent.Image = global::Client.Properties.Resources.add; @@ -115,7 +102,6 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.picDelete); this.Controls.Add(this.picContent); this.Controls.Add(this.lblEnd); this.Controls.Add(this.lblStart); @@ -123,7 +109,6 @@ private void InitializeComponent() this.Controls.Add(this.picRangeColor); this.Name = "ControlSchedule"; this.Size = new System.Drawing.Size(320, 80); - ((System.ComponentModel.ISupportInitialize)(this.picDelete)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picContent)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picRangeColor)).EndInit(); this.ResumeLayout(false); @@ -139,6 +124,5 @@ private void InitializeComponent() private MetroFramework.Controls.MetroLabel lblEnd; private System.Windows.Forms.ImageList imageList1; private System.Windows.Forms.PictureBox picContent; - private System.Windows.Forms.PictureBox picDelete; } } diff --git a/Client/Forms/ControlSchedule.cs b/Client/Forms/ControlSchedule.cs index c9b6d63..0f6d382 100644 --- a/Client/Forms/ControlSchedule.cs +++ b/Client/Forms/ControlSchedule.cs @@ -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) - { - //컨트롤 삭제 코드 - } - } } } diff --git a/Client/Forms/ControlSchedule.resx b/Client/Forms/ControlSchedule.resx index 9bf2736..92722c5 100644 --- a/Client/Forms/ControlSchedule.resx +++ b/Client/Forms/ControlSchedule.resx @@ -125,7 +125,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACq - BwAAAk1TRnQBSQFMAgEBBAEAAVABAAFQAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + BwAAAk1TRnQBSQFMAgEBBAEAAVgBAAFYAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/Client/Forms/FormMain.cs b/Client/Forms/FormMain.cs index 00c7c31..afdf78f 100644 --- a/Client/Forms/FormMain.cs +++ b/Client/Forms/FormMain.cs @@ -16,7 +16,6 @@ public partial class FormMain : MetroForm { Dictionary formChats; // 켜져있는 채팅방들 Dictionary roomCards; // 나의 채팅방 카드들 - Dictionary scheduleCards; //나의 스케줄 카드들 public FormMain() { @@ -53,7 +52,7 @@ private void FormMain_Shown(object sender, EventArgs e) formChats = new Dictionary(); roomCards = new Dictionary(); // 스케줄 관련 컨트롤들 배열 초기화 - scheduleCards = new Dictionary(); + List scheduleCards = new List(); // 최초 룸 모두 추가 Program.rooms.ForEach(AddRoomCard); @@ -268,8 +267,13 @@ void AddRoomCard(Room room) void AddScheduleCard(Schedule schedule) //스케줄카드 생성 { ControlSchedule Cardschedule = new ControlSchedule(schedule); - - scheduleCards.Add(Program.employee.id, Cardschedule); + List ScheduleCards = new List(); + //스케줄 카드 추가 + if (DateTime.Now < schedule.end) + { + tpSchedule.Controls.Add(Cardschedule); + ScheduleCards.Add(schedule); + } } void ReceiveRoom(Packet p) { diff --git a/Client/Panels/PanelSchedule.cs b/Client/Panels/PanelSchedule.cs index b2a08d6..3ce0cd6 100644 --- a/Client/Panels/PanelSchedule.cs +++ b/Client/Panels/PanelSchedule.cs @@ -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, diff --git a/Server/Classes/Client.cs b/Server/Classes/Client.cs index 379517b..7b052e1 100644 --- a/Server/Classes/Client.cs +++ b/Server/Classes/Client.cs @@ -141,7 +141,6 @@ public void Recieve() } List mySchedule = Database.GetSchedule(emp); - p = new LoginPacket(true, Program.employees, myRooms, mySchedule); } diff --git a/Server/Classes/Database.cs b/Server/Classes/Database.cs index 2e4f1ef..72a23fc 100644 --- a/Server/Classes/Database.cs +++ b/Server/Classes/Database.cs @@ -166,7 +166,7 @@ public static List GetSchedule(Employee emp) { List schedules = new List(); - 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()) @@ -179,7 +179,7 @@ public static List GetSchedule(Employee emp) rdr.GetString("title"), rdr.GetDateTime("start"), rdr.GetDateTime("end"), - rdr.GetString("range"), + rdr.GetString("scope"), rdr.GetString("contents"))); } } diff --git a/Server/Program.cs b/Server/Program.cs index feb9253..b3ca321 100644 --- a/Server/Program.cs +++ b/Server/Program.cs @@ -15,7 +15,6 @@ class Program public static Dictionary clients; // 로그인 후 클라이언트들 public static Dictionary employees; // 사원들 정보 - public static Dictionary schedules; // 스케줄 정보들 public static Dictionary> roomEmps; // 각 룸에 있는 접속된 사원 번호 static void Main(string[] args) @@ -25,7 +24,6 @@ static void Main(string[] args) clients = new Dictionary(); unloginedClients = new List(); roomEmps = new Dictionary>(); - schedules = new Dictionary(); // 데이터 베이스 접속 if (Database.Connect())