diff --git a/HKCard.sln b/HKCard.sln index b4bb9a0..a17db3b 100644 --- a/HKCard.sln +++ b/HKCard.sln @@ -17,9 +17,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UHFHelper", "UHFHelper\UHFH EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "test", "test\test.csproj", "{3AD252E2-6878-4ABC-8A3E-22CCFCE2E075}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HKLib", "HKLib\HKLib.csproj", "{471F95A5-B9E9-41CF-A8A3-E4B36FFDE84C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HKLib", "HKLib\HKLib.csproj", "{471F95A5-B9E9-41CF-A8A3-E4B36FFDE84C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HKCardManager", "HKCardManager\HKCardManager.csproj", "{96C17249-7F4A-4D25-B658-507A8E876582}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HKCardManager", "HKCardManager\HKCardManager.csproj", "{96C17249-7F4A-4D25-B658-507A8E876582}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -93,6 +93,14 @@ Global {471F95A5-B9E9-41CF-A8A3-E4B36FFDE84C}.Release|Any CPU.Build.0 = Release|Any CPU {471F95A5-B9E9-41CF-A8A3-E4B36FFDE84C}.Release|x86.ActiveCfg = Release|Any CPU {471F95A5-B9E9-41CF-A8A3-E4B36FFDE84C}.Release|x86.Build.0 = Release|Any CPU + {96C17249-7F4A-4D25-B658-507A8E876582}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {96C17249-7F4A-4D25-B658-507A8E876582}.Debug|Any CPU.Build.0 = Debug|Any CPU + {96C17249-7F4A-4D25-B658-507A8E876582}.Debug|x86.ActiveCfg = Debug|Any CPU + {96C17249-7F4A-4D25-B658-507A8E876582}.Debug|x86.Build.0 = Debug|Any CPU + {96C17249-7F4A-4D25-B658-507A8E876582}.Release|Any CPU.ActiveCfg = Release|Any CPU + {96C17249-7F4A-4D25-B658-507A8E876582}.Release|Any CPU.Build.0 = Release|Any CPU + {96C17249-7F4A-4D25-B658-507A8E876582}.Release|x86.ActiveCfg = Release|Any CPU + {96C17249-7F4A-4D25-B658-507A8E876582}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/HKCardManager/HKCardManager.csproj b/HKCardManager/HKCardManager.csproj index d0b1c2b..b84118e 100644 --- a/HKCardManager/HKCardManager.csproj +++ b/HKCardManager/HKCardManager.csproj @@ -12,4 +12,8 @@ + + + + \ No newline at end of file diff --git a/HKCardManager/InstitutionalEntry.Designer.cs b/HKCardManager/InstitutionalEntry.Designer.cs index 5295a5f..7ad315b 100644 --- a/HKCardManager/InstitutionalEntry.Designer.cs +++ b/HKCardManager/InstitutionalEntry.Designer.cs @@ -79,9 +79,9 @@ this.label2.Dock = System.Windows.Forms.DockStyle.Bottom; this.label2.Location = new System.Drawing.Point(0, 152); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(43, 17); + this.label2.Size = new System.Drawing.Size(32, 17); this.label2.TabIndex = 4; - this.label2.Text = "label2"; + this.label2.Text = "信息"; // // InstitutionalEntry // diff --git a/HKCardManager/InstitutionalEntry.cs b/HKCardManager/InstitutionalEntry.cs index ae9831b..61ba6c5 100644 --- a/HKCardManager/InstitutionalEntry.cs +++ b/HKCardManager/InstitutionalEntry.cs @@ -1,4 +1,5 @@ using BPA.Helper; +using HKLib.Logic; using System; using System.Collections.Generic; using System.ComponentModel; @@ -25,22 +26,21 @@ namespace HKCardManager private void button2_Click(object sender, EventArgs e) { - if (string.IsNullOrEmpty(textBox1.Text)) + string name = textBox1.Text.Trim(); + if (string.IsNullOrEmpty(name)) { label2.Text = "机构名不能为空"; return; } - if (Json.Data.InstitutionsInfo.Contains(textBox1.Text.Trim())) - { - label2.Text = "机构已存在"; - return; - } Task.Factory.StartNew(() => { - if (BaseHelper.GetInstance.AddInstitutions()) + if (ServiceHandler.GetOrgList().FirstOrDefault(p => p.Name == name) != null) + { + this.Invoke(() => { label2.Text = "机构已存在"; }); + return; + } + if (ServiceHandler.AddOrg(textBox1.Text.Trim())) { - Json.Data.InstitutionsInfo.Add(textBox1.Text.Trim()); - Json.Save(); this.Invoke(() => { this.Close(); }); } else diff --git a/HKCardManager/MealSegmentSet.Designer.cs b/HKCardManager/MealSegmentSet.Designer.cs index c59666b..720b5fa 100644 --- a/HKCardManager/MealSegmentSet.Designer.cs +++ b/HKCardManager/MealSegmentSet.Designer.cs @@ -29,19 +29,19 @@ private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker(); - this.label2 = new System.Windows.Forms.Label(); + this.dateTimePicker4 = new System.Windows.Forms.DateTimePicker(); this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker(); + this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.dateTimePicker3 = new System.Windows.Forms.DateTimePicker(); + this.dateTimePicker5 = new System.Windows.Forms.DateTimePicker(); + this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker(); this.label3 = new System.Windows.Forms.Label(); - this.dateTimePicker4 = new System.Windows.Forms.DateTimePicker(); this.label4 = new System.Windows.Forms.Label(); this.groupBox3 = new System.Windows.Forms.GroupBox(); - this.dateTimePicker5 = new System.Windows.Forms.DateTimePicker(); - this.label5 = new System.Windows.Forms.Label(); this.dateTimePicker6 = new System.Windows.Forms.DateTimePicker(); + this.dateTimePicker3 = new System.Windows.Forms.DateTimePicker(); + this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); @@ -53,9 +53,9 @@ // // groupBox1 // - this.groupBox1.Controls.Add(this.dateTimePicker2); - this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.dateTimePicker4); this.groupBox1.Controls.Add(this.dateTimePicker1); + this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.groupBox1.Location = new System.Drawing.Point(21, 12); @@ -65,15 +65,23 @@ this.groupBox1.TabStop = false; this.groupBox1.Text = "早上"; // - // dateTimePicker2 + // dateTimePicker4 // - this.dateTimePicker2.Format = System.Windows.Forms.DateTimePickerFormat.Time; - this.dateTimePicker2.Location = new System.Drawing.Point(366, 24); - this.dateTimePicker2.Name = "dateTimePicker2"; - this.dateTimePicker2.ShowUpDown = true; - this.dateTimePicker2.Size = new System.Drawing.Size(113, 28); - this.dateTimePicker2.TabIndex = 3; - this.dateTimePicker2.Value = new System.DateTime(2022, 10, 12, 16, 29, 18, 0); + this.dateTimePicker4.Format = System.Windows.Forms.DateTimePickerFormat.Time; + this.dateTimePicker4.Location = new System.Drawing.Point(366, 22); + this.dateTimePicker4.Name = "dateTimePicker4"; + this.dateTimePicker4.ShowUpDown = true; + this.dateTimePicker4.Size = new System.Drawing.Size(124, 28); + this.dateTimePicker4.TabIndex = 6; + // + // dateTimePicker1 + // + this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Time; + this.dateTimePicker1.Location = new System.Drawing.Point(133, 24); + this.dateTimePicker1.Name = "dateTimePicker1"; + this.dateTimePicker1.ShowUpDown = true; + this.dateTimePicker1.Size = new System.Drawing.Size(124, 28); + this.dateTimePicker1.TabIndex = 3; // // label2 // @@ -84,16 +92,6 @@ this.label2.TabIndex = 2; this.label2.Text = "结束时间"; // - // dateTimePicker1 - // - this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Time; - this.dateTimePicker1.Location = new System.Drawing.Point(138, 24); - this.dateTimePicker1.Name = "dateTimePicker1"; - this.dateTimePicker1.ShowUpDown = true; - this.dateTimePicker1.Size = new System.Drawing.Size(113, 28); - this.dateTimePicker1.TabIndex = 1; - this.dateTimePicker1.Value = new System.DateTime(2022, 10, 12, 16, 29, 18, 0); - // // label1 // this.label1.AutoSize = true; @@ -105,9 +103,9 @@ // // groupBox2 // - this.groupBox2.Controls.Add(this.dateTimePicker3); + this.groupBox2.Controls.Add(this.dateTimePicker5); + this.groupBox2.Controls.Add(this.dateTimePicker2); this.groupBox2.Controls.Add(this.label3); - this.groupBox2.Controls.Add(this.dateTimePicker4); this.groupBox2.Controls.Add(this.label4); this.groupBox2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.groupBox2.Location = new System.Drawing.Point(21, 89); @@ -117,15 +115,23 @@ this.groupBox2.TabStop = false; this.groupBox2.Text = "中午"; // - // dateTimePicker3 + // dateTimePicker5 // - this.dateTimePicker3.Format = System.Windows.Forms.DateTimePickerFormat.Time; - this.dateTimePicker3.Location = new System.Drawing.Point(366, 24); - this.dateTimePicker3.Name = "dateTimePicker3"; - this.dateTimePicker3.ShowUpDown = true; - this.dateTimePicker3.Size = new System.Drawing.Size(113, 28); - this.dateTimePicker3.TabIndex = 3; - this.dateTimePicker3.Value = new System.DateTime(2022, 10, 12, 16, 29, 18, 0); + this.dateTimePicker5.Format = System.Windows.Forms.DateTimePickerFormat.Time; + this.dateTimePicker5.Location = new System.Drawing.Point(366, 24); + this.dateTimePicker5.Name = "dateTimePicker5"; + this.dateTimePicker5.ShowUpDown = true; + this.dateTimePicker5.Size = new System.Drawing.Size(124, 28); + this.dateTimePicker5.TabIndex = 7; + // + // dateTimePicker2 + // + this.dateTimePicker2.Format = System.Windows.Forms.DateTimePickerFormat.Time; + this.dateTimePicker2.Location = new System.Drawing.Point(133, 27); + this.dateTimePicker2.Name = "dateTimePicker2"; + this.dateTimePicker2.ShowUpDown = true; + this.dateTimePicker2.Size = new System.Drawing.Size(124, 28); + this.dateTimePicker2.TabIndex = 4; // // label3 // @@ -136,16 +142,6 @@ this.label3.TabIndex = 2; this.label3.Text = "结束时间"; // - // dateTimePicker4 - // - this.dateTimePicker4.Format = System.Windows.Forms.DateTimePickerFormat.Time; - this.dateTimePicker4.Location = new System.Drawing.Point(138, 24); - this.dateTimePicker4.Name = "dateTimePicker4"; - this.dateTimePicker4.ShowUpDown = true; - this.dateTimePicker4.Size = new System.Drawing.Size(113, 28); - this.dateTimePicker4.TabIndex = 1; - this.dateTimePicker4.Value = new System.DateTime(2022, 10, 12, 16, 29, 18, 0); - // // label4 // this.label4.AutoSize = true; @@ -157,9 +153,9 @@ // // groupBox3 // - this.groupBox3.Controls.Add(this.dateTimePicker5); - this.groupBox3.Controls.Add(this.label5); this.groupBox3.Controls.Add(this.dateTimePicker6); + this.groupBox3.Controls.Add(this.dateTimePicker3); + this.groupBox3.Controls.Add(this.label5); this.groupBox3.Controls.Add(this.label6); this.groupBox3.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.groupBox3.Location = new System.Drawing.Point(21, 169); @@ -169,15 +165,23 @@ this.groupBox3.TabStop = false; this.groupBox3.Text = "晚上"; // - // dateTimePicker5 + // dateTimePicker6 // - this.dateTimePicker5.Format = System.Windows.Forms.DateTimePickerFormat.Time; - this.dateTimePicker5.Location = new System.Drawing.Point(366, 24); - this.dateTimePicker5.Name = "dateTimePicker5"; - this.dateTimePicker5.ShowUpDown = true; - this.dateTimePicker5.Size = new System.Drawing.Size(113, 28); - this.dateTimePicker5.TabIndex = 3; - this.dateTimePicker5.Value = new System.DateTime(2022, 10, 12, 16, 29, 18, 0); + this.dateTimePicker6.Format = System.Windows.Forms.DateTimePickerFormat.Time; + this.dateTimePicker6.Location = new System.Drawing.Point(366, 24); + this.dateTimePicker6.Name = "dateTimePicker6"; + this.dateTimePicker6.ShowUpDown = true; + this.dateTimePicker6.Size = new System.Drawing.Size(124, 28); + this.dateTimePicker6.TabIndex = 8; + // + // dateTimePicker3 + // + this.dateTimePicker3.Format = System.Windows.Forms.DateTimePickerFormat.Time; + this.dateTimePicker3.Location = new System.Drawing.Point(133, 27); + this.dateTimePicker3.Name = "dateTimePicker3"; + this.dateTimePicker3.ShowUpDown = true; + this.dateTimePicker3.Size = new System.Drawing.Size(124, 28); + this.dateTimePicker3.TabIndex = 5; // // label5 // @@ -188,16 +192,6 @@ this.label5.TabIndex = 2; this.label5.Text = "结束时间"; // - // dateTimePicker6 - // - this.dateTimePicker6.Format = System.Windows.Forms.DateTimePickerFormat.Time; - this.dateTimePicker6.Location = new System.Drawing.Point(138, 24); - this.dateTimePicker6.Name = "dateTimePicker6"; - this.dateTimePicker6.ShowUpDown = true; - this.dateTimePicker6.Size = new System.Drawing.Size(113, 28); - this.dateTimePicker6.TabIndex = 1; - this.dateTimePicker6.Value = new System.DateTime(2022, 10, 12, 16, 29, 18, 0); - // // label6 // this.label6.AutoSize = true; @@ -216,6 +210,7 @@ this.button1.TabIndex = 6; this.button1.Text = "确认"; this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // @@ -226,6 +221,7 @@ this.button2.TabIndex = 7; this.button2.Text = "取消"; this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); // // label7 // @@ -234,9 +230,9 @@ this.label7.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.label7.Location = new System.Drawing.Point(0, 301); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(55, 21); + this.label7.Size = new System.Drawing.Size(42, 21); this.label7.TabIndex = 8; - this.label7.Text = "label7"; + this.label7.Text = "信息"; // // MealSegmentSet // @@ -267,22 +263,22 @@ #endregion private GroupBox groupBox1; - private DateTimePicker dateTimePicker2; private Label label2; - private DateTimePicker dateTimePicker1; private Label label1; private GroupBox groupBox2; - private DateTimePicker dateTimePicker3; private Label label3; - private DateTimePicker dateTimePicker4; private Label label4; private GroupBox groupBox3; - private DateTimePicker dateTimePicker5; private Label label5; - private DateTimePicker dateTimePicker6; private Label label6; private Button button1; private Button button2; private Label label7; + private DateTimePicker dateTimePicker4; + private DateTimePicker dateTimePicker1; + private DateTimePicker dateTimePicker5; + private DateTimePicker dateTimePicker2; + private DateTimePicker dateTimePicker6; + private DateTimePicker dateTimePicker3; } } \ No newline at end of file diff --git a/HKCardManager/MealSegmentSet.cs b/HKCardManager/MealSegmentSet.cs index 6c0d51e..da370b4 100644 --- a/HKCardManager/MealSegmentSet.cs +++ b/HKCardManager/MealSegmentSet.cs @@ -1,4 +1,6 @@ -using System; +using HKLib.Dto; +using HKLib.Interfaces; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -16,5 +18,34 @@ namespace HKCardManager { InitializeComponent(); } + + private void button2_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void button1_Click(object sender, EventArgs e) + { + var data = new TimeSpilte() + { + AMStartTime = dateTimePicker1.Value, + AMEndTime = dateTimePicker4.Value, + PMStartTime = dateTimePicker2.Value, + PMEndTime = dateTimePicker5.Value, + ATStartTime = dateTimePicker3.Value, + ATEndTime = dateTimePicker6.Value + }; + Task.Factory.StartNew(() => + { + if (HKLibHelper.SetTime(data)) + { + this.Invoke(() => { this.Close(); }); + } + else + { + this.label7.Text = "设置时间段失败,请重试!"; + } + }); + } } } diff --git a/HKCardManager/PersonnelEntry.Designer.cs b/HKCardManager/PersonnelEntry.Designer.cs index a6d453a..59e5a30 100644 --- a/HKCardManager/PersonnelEntry.Designer.cs +++ b/HKCardManager/PersonnelEntry.Designer.cs @@ -71,6 +71,7 @@ // // comboBox1 // + this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.comboBox1.FormattingEnabled = true; this.comboBox1.Items.AddRange(new object[] { @@ -83,6 +84,7 @@ // // comboBox2 // + this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.comboBox2.FormattingEnabled = true; this.comboBox2.Items.AddRange(new object[] { @@ -129,6 +131,7 @@ this.button1.TabIndex = 9; this.button1.Text = "取消"; this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // @@ -138,6 +141,7 @@ this.button2.TabIndex = 10; this.button2.Text = "确认"; this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); // // label5 // @@ -145,9 +149,9 @@ this.label5.Dock = System.Windows.Forms.DockStyle.Bottom; this.label5.Location = new System.Drawing.Point(0, 292); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(43, 17); + this.label5.Size = new System.Drawing.Size(32, 17); this.label5.TabIndex = 11; - this.label5.Text = "label5"; + this.label5.Text = "信息"; // // PersonnelEntry // diff --git a/HKCardManager/PersonnelEntry.cs b/HKCardManager/PersonnelEntry.cs index 941e736..5433bdf 100644 --- a/HKCardManager/PersonnelEntry.cs +++ b/HKCardManager/PersonnelEntry.cs @@ -1,4 +1,5 @@ -using System; +using HKLib.Logic; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -12,9 +13,26 @@ namespace HKCardManager { public partial class PersonnelEntry : Form { + List OrgList = new List(); public PersonnelEntry() { InitializeComponent(); + comboBox1.SelectedIndex = 0; + ServiceHandler.GetOrgList()?.ForEach(item => + { + OrgList.Add(item.Name); + }); + comboBox2.DataSource = OrgList; + } + + private void button1_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void button2_Click(object sender, EventArgs e) + { + } } } diff --git a/HKLib/Dto/TimeSpilte.cs b/HKLib/Dto/TimeSpilte.cs index 6af9590..d960c69 100644 --- a/HKLib/Dto/TimeSpilte.cs +++ b/HKLib/Dto/TimeSpilte.cs @@ -6,17 +6,38 @@ namespace HKLib.Dto { public class TimeSpilte { + + /// + /// 早上开始时间 + /// + public DateTime AMStartTime { get; set; } + /// - /// 早 例如 8,10 + /// 早上结束时间 /// - public string AM { get; set; } + public DateTime AMEndTime { get; set; } + /// - /// 中 例如 11,13 + /// 中午开始时间 /// - public string PM { get; set; } + public DateTime PMStartTime { get; set; } + /// - /// 晚 例如 17,19 + /// 中午结束时间 /// - public string AT { get; set; } + public DateTime PMEndTime { get; set; } + + /// + /// 晚上开始时间 + /// + public DateTime ATStartTime { get; set; } + + /// + /// 晚上结束时间 + /// + public DateTime ATEndTime { get; set; } + } + + } diff --git a/HKLib/Interfaces/HKLibHelper.cs b/HKLib/Interfaces/HKLibHelper.cs index 076fe3e..4f836b5 100644 --- a/HKLib/Interfaces/HKLibHelper.cs +++ b/HKLib/Interfaces/HKLibHelper.cs @@ -13,7 +13,7 @@ namespace HKLib.Interfaces /// /// 设置刷卡时间端 /// - public static void SetTime(TimeSpilte input) + public static bool SetTime(TimeSpilte input) { IHttpMultiClient.HttpMulti.AddNode(t => { @@ -21,6 +21,7 @@ namespace HKLib.Interfaces t.JsonParam = input.ToJson(); t.ReqType = MultiType.POST; }).Build().RunStringFirst(); + return true; } /// @@ -38,7 +39,7 @@ namespace HKLib.Interfaces /// /// 修改机构 /// - public static bool AlterOrg(string input,string Sid) + public static bool AlterOrg(string input, string Sid) { return IHttpMultiClient.HttpMulti.AddNode(t => { @@ -92,7 +93,7 @@ namespace HKLib.Interfaces /// /// /// 1 计次就餐天消费表(每人),2每月餐段消费报表,3月餐段汇总表 - public static void Report(ReportDto input,int type=1) + public static void Report(ReportDto input, int type = 1) { IHttpMultiClient.HttpMulti.AddNode(t => {