From f6fb0e5406e57edf6ed149c8710aaa4bbce1ac45 Mon Sep 17 00:00:00 2001 From: YuSeop Choung Date: Sun, 6 Jun 2021 08:04:09 +0900 Subject: [PATCH] edit something --- Client/Panels/PanelSchedule.Designer.cs | 15 ++++++++++++- Client/Panels/PanelSchedule.cs | 29 ++++++++++++++++++++++++- OSTLibrary/Classes/Schedule.cs | 4 +++- Server/Classes/Client.cs | 2 +- Server/Classes/Database.cs | 8 ++++--- 5 files changed, 51 insertions(+), 7 deletions(-) diff --git a/Client/Panels/PanelSchedule.Designer.cs b/Client/Panels/PanelSchedule.Designer.cs index 0125b5f..d534389 100644 --- a/Client/Panels/PanelSchedule.Designer.cs +++ b/Client/Panels/PanelSchedule.Designer.cs @@ -41,6 +41,7 @@ private void InitializeComponent() this.cmbScope = new MetroFramework.Controls.MetroComboBox(); this.picClose = new System.Windows.Forms.PictureBox(); this.txtTitle = new MetroFramework.Controls.MetroTextBox(); + this.cmbTarget = new MetroFramework.Controls.MetroComboBox(); ((System.ComponentModel.ISupportInitialize)(this.picClose)).BeginInit(); this.SuspendLayout(); // @@ -149,7 +150,7 @@ private void InitializeComponent() this.cmbScope.ItemHeight = 23; this.cmbScope.Location = new System.Drawing.Point(60, 206); this.cmbScope.Name = "cmbScope"; - this.cmbScope.Size = new System.Drawing.Size(240, 29); + this.cmbScope.Size = new System.Drawing.Size(112, 29); this.cmbScope.TabIndex = 21; this.cmbScope.UseSelectable = true; // @@ -203,10 +204,21 @@ private void InitializeComponent() this.txtTitle.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109))))); this.txtTitle.WaterMarkFont = new System.Drawing.Font("맑은 고딕", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129))); // + // cmbTarget + // + this.cmbTarget.FormattingEnabled = true; + this.cmbTarget.ItemHeight = 23; + this.cmbTarget.Location = new System.Drawing.Point(189, 206); + this.cmbTarget.Name = "cmbTarget"; + this.cmbTarget.Size = new System.Drawing.Size(111, 29); + this.cmbTarget.TabIndex = 23; + this.cmbTarget.UseSelectable = true; + // // PanelSchedule // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.cmbTarget); this.Controls.Add(this.txtTitle); this.Controls.Add(this.cmbScope); this.Controls.Add(this.txtContent); @@ -239,5 +251,6 @@ private void InitializeComponent() private MetroFramework.Controls.MetroTextBox txtContent; private MetroFramework.Controls.MetroComboBox cmbScope; private MetroFramework.Controls.MetroTextBox txtTitle; + private MetroFramework.Controls.MetroComboBox cmbTarget; } } diff --git a/Client/Panels/PanelSchedule.cs b/Client/Panels/PanelSchedule.cs index d5e25bb..2dd3d15 100644 --- a/Client/Panels/PanelSchedule.cs +++ b/Client/Panels/PanelSchedule.cs @@ -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) { @@ -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) @@ -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); diff --git a/OSTLibrary/Classes/Schedule.cs b/OSTLibrary/Classes/Schedule.cs index 2ea4b0f..a70908c 100644 --- a/OSTLibrary/Classes/Schedule.cs +++ b/OSTLibrary/Classes/Schedule.cs @@ -10,10 +10,11 @@ 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; @@ -21,6 +22,7 @@ public Schedule(int author, string title, DateTime start, DateTime end,string sc this.end = end; this.scope = scope; this.contents = contents; + this.target = target; } } } diff --git a/Server/Classes/Client.cs b/Server/Classes/Client.cs index 7b052e1..c33733f 100644 --- a/Server/Classes/Client.cs +++ b/Server/Classes/Client.cs @@ -138,7 +138,7 @@ public void Recieve() Program.roomEmps.Add(room.id, new List(new int[] { employee.id })); room.lastChat = Database.GetLastChat(room); - } + } 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 72a23fc..51302b5 100644 --- a/Server/Classes/Database.cs +++ b/Server/Classes/Database.cs @@ -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()) { @@ -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 { @@ -166,7 +167,7 @@ public static List GetSchedule(Employee emp) { List schedules = new List(); - 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()) @@ -180,7 +181,8 @@ public static List GetSchedule(Employee emp) rdr.GetDateTime("start"), rdr.GetDateTime("end"), rdr.GetString("scope"), - rdr.GetString("contents"))); + rdr.GetString("contents"), + rdr.GetString("target"))); } } return schedules;