diff --git a/HKCardManager/Form1.Designer.cs b/HKCardManager/Form1.Designer.cs index d6fd960..0753e91 100644 --- a/HKCardManager/Form1.Designer.cs +++ b/HKCardManager/Form1.Designer.cs @@ -28,8 +28,8 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.groupBox5 = new System.Windows.Forms.GroupBox(); this.pictureBox11 = new System.Windows.Forms.PictureBox(); @@ -531,8 +531,8 @@ // // 图标 // - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopCenter; - this.图标.DefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopCenter; + this.图标.DefaultCellStyle = dataGridViewCellStyle1; this.图标.HeaderText = "图标"; this.图标.Name = "图标"; this.图标.ReadOnly = true; @@ -541,8 +541,8 @@ // 消息文本 // this.消息文本.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.消息文本.DefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.消息文本.DefaultCellStyle = dataGridViewCellStyle2; this.消息文本.HeaderText = "消息文本"; this.消息文本.Name = "消息文本"; this.消息文本.ReadOnly = true; @@ -554,7 +554,7 @@ this.ClientSize = new System.Drawing.Size(1207, 717); this.Controls.Add(this.splitContainer1); this.Name = "Form1"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Form1"; this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false); diff --git a/HKCardManager/Form1.cs b/HKCardManager/Form1.cs index f2fa56f..07e9f79 100644 --- a/HKCardManager/Form1.cs +++ b/HKCardManager/Form1.cs @@ -21,6 +21,7 @@ namespace HKCardManager ShowPage(new PersonnelEntryPage()); this.SizeChanged += Form1_SizeChanged; this.button1.SizeChanged += Button1_SizeChanged; + this.splitContainer2.SplitterMoved += SplitContainer1_SizeChanged; MessageLogNotify.GetInstance.Info = new Action((s, br) => { this.Invoke(() => @@ -32,6 +33,15 @@ namespace HKCardManager }); } + private void SplitContainer1_SizeChanged(object? sender, EventArgs e) + { + if (tempUserControl != null) + { + tempUserControl.Width = this.panel1.Width; + tempUserControl.Height = this.panel1.Height; + } + } + private void DataGridViewInit() { dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; diff --git a/HKCardManager/Form1.resx b/HKCardManager/Form1.resx index 9876a5b..1338f61 100644 --- a/HKCardManager/Form1.resx +++ b/HKCardManager/Form1.resx @@ -63,10 +63,4 @@ True - - True - - - True - \ No newline at end of file diff --git a/HKCardManager/Models/Global.cs b/HKCardManager/Models/Global.cs index d56d0e5..e6e8325 100644 --- a/HKCardManager/Models/Global.cs +++ b/HKCardManager/Models/Global.cs @@ -1,4 +1,5 @@ -using System; +using HKLib.Dto; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -22,5 +23,10 @@ namespace HKCardManager /// 机构信息 /// public static List OrgList { get; set; } = new List(); + + /// + /// 机构信息 + /// + public static List OrgTables { get; set; } = new List(); } } diff --git a/HKCardManager/UserPages/InstitutionalEntryPage.Designer.cs b/HKCardManager/UserPages/InstitutionalEntryPage.Designer.cs index ead3a0e..611bbf9 100644 --- a/HKCardManager/UserPages/InstitutionalEntryPage.Designer.cs +++ b/HKCardManager/UserPages/InstitutionalEntryPage.Designer.cs @@ -28,14 +28,26 @@ /// private void InitializeComponent() { + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); this.button2 = new System.Windows.Forms.Button(); this.textBox1 = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.机构名称 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.修改名称 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.修改 = new System.Windows.Forms.DataGridViewButtonColumn(); + this.删除 = new System.Windows.Forms.DataGridViewButtonColumn(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.SuspendLayout(); // // button2 // - this.button2.Location = new System.Drawing.Point(359, 18); + this.button2.Location = new System.Drawing.Point(345, 10); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(92, 28); this.button2.TabIndex = 7; @@ -46,7 +58,7 @@ // textBox1 // this.textBox1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.textBox1.Location = new System.Drawing.Point(132, 18); + this.textBox1.Location = new System.Drawing.Point(118, 10); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(209, 28); this.textBox1.TabIndex = 5; @@ -55,23 +67,99 @@ // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label1.Location = new System.Drawing.Point(22, 21); + this.label1.Location = new System.Drawing.Point(8, 13); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(122, 21); this.label1.TabIndex = 4; this.label1.Text = "输入机构名称:"; // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.dataGridView1); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.textBox1); + this.splitContainer1.Panel2.Controls.Add(this.label1); + this.splitContainer1.Panel2.Controls.Add(this.button2); + this.splitContainer1.Size = new System.Drawing.Size(1044, 690); + this.splitContainer1.SplitterDistance = 629; + this.splitContainer1.TabIndex = 8; + // + // dataGridView1 + // + this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.Control; + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.机构名称, + this.修改名称, + this.修改, + this.删除}); + this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridView1.Location = new System.Drawing.Point(0, 0); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.RowHeadersVisible = false; + this.dataGridView1.RowTemplate.Height = 25; + this.dataGridView1.Size = new System.Drawing.Size(1044, 629); + this.dataGridView1.TabIndex = 1; + // + // 机构名称 + // + this.机构名称.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.机构名称.DataPropertyName = "Name"; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.机构名称.DefaultCellStyle = dataGridViewCellStyle1; + this.机构名称.HeaderText = "机构名称"; + this.机构名称.Name = "机构名称"; + this.机构名称.ReadOnly = true; + // + // 修改名称 + // + this.修改名称.HeaderText = "修改名称"; + this.修改名称.Name = "修改名称"; + this.修改名称.Width = 150; + // + // 修改 + // + this.修改.DataPropertyName = "ContextName"; + this.修改.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.修改.HeaderText = "修改"; + this.修改.Name = "修改"; + this.修改.ReadOnly = true; + this.修改.Text = "修改"; + this.修改.UseColumnTextForButtonValue = true; + // + // 删除 + // + this.删除.DataPropertyName = "ContextName"; + this.删除.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.删除.HeaderText = "删除"; + this.删除.Name = "删除"; + this.删除.ReadOnly = true; + this.删除.Text = "删除"; + this.删除.UseColumnTextForButtonValue = true; + // // InstitutionalEntryPage // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.textBox1); - this.Controls.Add(this.button2); - this.Controls.Add(this.label1); + this.Controls.Add(this.splitContainer1); this.Name = "InstitutionalEntryPage"; this.Size = new System.Drawing.Size(1044, 690); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + this.splitContainer1.Panel2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); this.ResumeLayout(false); - this.PerformLayout(); } @@ -80,5 +168,11 @@ private Button button2; private TextBox textBox1; private Label label1; + private SplitContainer splitContainer1; + private DataGridView dataGridView1; + private DataGridViewTextBoxColumn 机构名称; + private DataGridViewTextBoxColumn 修改名称; + private DataGridViewButtonColumn 修改; + private DataGridViewButtonColumn 删除; } } diff --git a/HKCardManager/UserPages/InstitutionalEntryPage.cs b/HKCardManager/UserPages/InstitutionalEntryPage.cs index 34e7404..95423b9 100644 --- a/HKCardManager/UserPages/InstitutionalEntryPage.cs +++ b/HKCardManager/UserPages/InstitutionalEntryPage.cs @@ -1,4 +1,5 @@ -using System; +using HKLib.Interfaces; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -16,14 +17,109 @@ namespace HKCardManager.UserPages public InstitutionalEntryPage() { InitializeComponent(); - //this.SizeChanged += InstitutionalEntryPage_SizeChanged; + DataGridViewInit(); + dataGridView1.DataSource = Global.OrgTables; + this.SizeChanged += InstitutionalEntryPage_SizeChanged; } - //private void InstitutionalEntryPage_SizeChanged(object? sender, EventArgs e) - //{ - // this.panel1.Left = (this.Width - this.panel1.Width) / 2; - // this.panel1.Top = (this.Height - this.panel1.Height) / 2; - //} + private void DataGridViewInit() + { + dataGridView1.AllowUserToResizeColumns = false;// 禁止用户改变所有列的列宽 + dataGridView1.AllowUserToResizeRows = false; //禁止用户改变所有行的行高 + dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; // 禁止用户改变列头的高度 + dataGridView1.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing; // 禁止用户改变列头的宽度 + dataGridView1.AutoGenerateColumns = false;//禁用自动添加列 + dataGridView1.CellContentClick += DataGridView1_CellContentClick; + } + + private void DataGridView1_CellContentClick(object? sender, DataGridViewCellEventArgs e) + { + int index = dataGridView1.CurrentRow.Index; + if (index <= dataGridView1.Rows.Count - 1 && dataGridView1.CurrentCell.Value?.ToString() == "删除") + { + var res = Global.OrgTables.FirstOrDefault(p => p.Name == dataGridView1.Rows[index].Cells[0].Value?.ToString())?.SId; + if (string.IsNullOrEmpty(res)) + { + MessageLogNotify.GetInstance.ShowError("删除机构失败"); + return; + } + try + { + Task.Factory.StartNew(() => + { + if (HKLibHelper.DisableUser(res)) + { + Global.OrgTables.Clear(); + Global.OrgTables = HKLibHelper.GetOrg(); + this.Invoke(() => + { + dataGridView1.DataSource = null; + dataGridView1.DataSource = Global.OrgTables; + }); + MessageLogNotify.GetInstance.Show($"机构:【{dataGridView1.Rows[index].Cells[0].Value?.ToString()}】 删除成功"); + } + else + MessageLogNotify.GetInstance.ShowError($"机构:【{dataGridView1.Rows[index].Cells[0].Value?.ToString()}】 删除失败"); + }); + } + catch (Exception ex) + { + MessageLogNotify.GetInstance.ShowEx(ex.ToString()); + } + } + else if (index <= dataGridView1.Rows.Count - 1 && dataGridView1.CurrentCell.Value?.ToString() == "修改") + { + var name = dataGridView1.Rows[index].Cells[0].Value?.ToString();//原名称 + var changeName = dataGridView1.Rows[index].Cells[1].Value?.ToString();//修改后名称 + if (string.IsNullOrEmpty(name)) + { + MessageLogNotify.GetInstance.ShowError("原机构名称无效"); + return; + } + if (string.IsNullOrEmpty(changeName)) + { + MessageLogNotify.GetInstance.ShowError("请输入新机构名称"); + return; + } + if (name == changeName) + { + MessageLogNotify.GetInstance.ShowError("新名称和旧名称一致,无法修改"); + return; + } + var id = Global.OrgTables.FirstOrDefault(p => p.Name == name)?.SId; + try + { + Task.Factory.StartNew(() => + { + if (HKLibHelper.AlterOrg(changeName, id)) + { + Global.OrgTables.Clear(); + Global.OrgTables = HKLibHelper.GetOrg(); + this.Invoke(() => + { + dataGridView1.DataSource = null; + dataGridView1.DataSource = Global.OrgTables; + }); + MessageLogNotify.GetInstance.Show($"{name} 机构修改成功"); + } + else + MessageLogNotify.GetInstance.ShowError($"{name} 机构修改失败"); + }); + } + catch (Exception ex) + { + MessageLogNotify.GetInstance.ShowEx(ex.ToString()); + } + + } + } + + private void InstitutionalEntryPage_SizeChanged(object? sender, EventArgs e) + { + this.splitContainer1.SplitterDistance = this.Height - 50; + //this.panel1.Left = (this.Width - this.panel1.Width) / 2; + //this.panel1.Top = (this.Height - this.panel1.Height) / 2; + } private void button2_Click(object sender, EventArgs e) { diff --git a/HKCardManager/UserPages/InstitutionalEntryPage.resx b/HKCardManager/UserPages/InstitutionalEntryPage.resx index f298a7b..4a40da9 100644 --- a/HKCardManager/UserPages/InstitutionalEntryPage.resx +++ b/HKCardManager/UserPages/InstitutionalEntryPage.resx @@ -57,4 +57,16 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + True + + + True + + + True + + + True + \ No newline at end of file diff --git a/HKCardManager/UserPages/PersonnelEntryPage.Designer.cs b/HKCardManager/UserPages/PersonnelEntryPage.Designer.cs index 13ab86e..904b7c1 100644 --- a/HKCardManager/UserPages/PersonnelEntryPage.Designer.cs +++ b/HKCardManager/UserPages/PersonnelEntryPage.Designer.cs @@ -35,7 +35,6 @@ this.textBox1 = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.名称 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.卡状态 = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -62,16 +61,12 @@ this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); - this.splitContainer2.Panel1.SuspendLayout(); - this.splitContainer2.Panel2.SuspendLayout(); - this.splitContainer2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.SuspendLayout(); // // button2 // - this.button2.Location = new System.Drawing.Point(468, 14); + this.button2.Location = new System.Drawing.Point(460, 56); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(90, 32); this.button2.TabIndex = 20; @@ -87,7 +82,7 @@ this.comboBox2.Items.AddRange(new object[] { "男", "女"}); - this.comboBox2.Location = new System.Drawing.Point(320, 14); + this.comboBox2.Location = new System.Drawing.Point(320, 58); this.comboBox2.Name = "comboBox2"; this.comboBox2.Size = new System.Drawing.Size(97, 29); this.comboBox2.TabIndex = 16; @@ -96,7 +91,7 @@ // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label3.Location = new System.Drawing.Point(240, 18); + this.label3.Location = new System.Drawing.Point(240, 62); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(90, 21); this.label3.TabIndex = 15; @@ -105,7 +100,7 @@ // textBox1 // this.textBox1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.textBox1.Location = new System.Drawing.Point(90, 13); + this.textBox1.Location = new System.Drawing.Point(90, 57); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(113, 28); this.textBox1.TabIndex = 12; @@ -114,7 +109,7 @@ // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label1.Location = new System.Drawing.Point(10, 17); + this.label1.Location = new System.Drawing.Point(10, 61); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(90, 21); this.label1.TabIndex = 11; @@ -129,51 +124,34 @@ // // splitContainer1.Panel1 // - this.splitContainer1.Panel1.Controls.Add(this.splitContainer2); + this.splitContainer1.Panel1.Controls.Add(this.dataGridView1); // // splitContainer1.Panel2 // + this.splitContainer1.Panel2.Controls.Add(this.button_go); + this.splitContainer1.Panel2.Controls.Add(this.textBox_num); this.splitContainer1.Panel2.Controls.Add(this.comboBox2); + this.splitContainer1.Panel2.Controls.Add(this.label12); this.splitContainer1.Panel2.Controls.Add(this.button2); + this.splitContainer1.Panel2.Controls.Add(this.label13); this.splitContainer1.Panel2.Controls.Add(this.textBox1); + this.splitContainer1.Panel2.Controls.Add(this.comboBox_num); this.splitContainer1.Panel2.Controls.Add(this.label3); + this.splitContainer1.Panel2.Controls.Add(this.label10); this.splitContainer1.Panel2.Controls.Add(this.label1); + this.splitContainer1.Panel2.Controls.Add(this.label11); + this.splitContainer1.Panel2.Controls.Add(this.label_count); + this.splitContainer1.Panel2.Controls.Add(this.comboBox_page); + this.splitContainer1.Panel2.Controls.Add(this.label_first); + this.splitContainer1.Panel2.Controls.Add(this.label9); + this.splitContainer1.Panel2.Controls.Add(this.label_up); + this.splitContainer1.Panel2.Controls.Add(this.label8); + this.splitContainer1.Panel2.Controls.Add(this.label_down); + this.splitContainer1.Panel2.Controls.Add(this.label_end); this.splitContainer1.Size = new System.Drawing.Size(947, 561); - this.splitContainer1.SplitterDistance = 499; + this.splitContainer1.SplitterDistance = 450; this.splitContainer1.TabIndex = 24; // - // splitContainer2 - // - this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer2.Location = new System.Drawing.Point(0, 0); - this.splitContainer2.Name = "splitContainer2"; - this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; - // - // splitContainer2.Panel1 - // - this.splitContainer2.Panel1.Controls.Add(this.dataGridView1); - // - // splitContainer2.Panel2 - // - this.splitContainer2.Panel2.Controls.Add(this.button_go); - this.splitContainer2.Panel2.Controls.Add(this.textBox_num); - this.splitContainer2.Panel2.Controls.Add(this.label12); - this.splitContainer2.Panel2.Controls.Add(this.label13); - this.splitContainer2.Panel2.Controls.Add(this.comboBox_num); - this.splitContainer2.Panel2.Controls.Add(this.label10); - this.splitContainer2.Panel2.Controls.Add(this.label11); - this.splitContainer2.Panel2.Controls.Add(this.comboBox_page); - this.splitContainer2.Panel2.Controls.Add(this.label9); - this.splitContainer2.Panel2.Controls.Add(this.label8); - this.splitContainer2.Panel2.Controls.Add(this.label_end); - this.splitContainer2.Panel2.Controls.Add(this.label_down); - this.splitContainer2.Panel2.Controls.Add(this.label_up); - this.splitContainer2.Panel2.Controls.Add(this.label_first); - this.splitContainer2.Panel2.Controls.Add(this.label_count); - this.splitContainer2.Size = new System.Drawing.Size(947, 499); - this.splitContainer2.SplitterDistance = 459; - this.splitContainer2.TabIndex = 1; - // // dataGridView1 // this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.Control; @@ -190,7 +168,7 @@ this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.RowHeadersVisible = false; this.dataGridView1.RowTemplate.Height = 25; - this.dataGridView1.Size = new System.Drawing.Size(947, 459); + this.dataGridView1.Size = new System.Drawing.Size(947, 450); this.dataGridView1.TabIndex = 0; this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick); // @@ -249,7 +227,7 @@ // // button_go // - this.button_go.Location = new System.Drawing.Point(702, 7); + this.button_go.Location = new System.Drawing.Point(692, 15); this.button_go.Name = "button_go"; this.button_go.Size = new System.Drawing.Size(58, 23); this.button_go.TabIndex = 14; @@ -258,7 +236,7 @@ // // textBox_num // - this.textBox_num.Location = new System.Drawing.Point(601, 6); + this.textBox_num.Location = new System.Drawing.Point(591, 14); this.textBox_num.Name = "textBox_num"; this.textBox_num.Size = new System.Drawing.Size(59, 23); this.textBox_num.TabIndex = 13; @@ -266,7 +244,7 @@ // label12 // this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(663, 10); + this.label12.Location = new System.Drawing.Point(653, 18); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(20, 17); this.label12.TabIndex = 12; @@ -275,7 +253,7 @@ // label13 // this.label13.AutoSize = true; - this.label13.Location = new System.Drawing.Point(577, 10); + this.label13.Location = new System.Drawing.Point(567, 18); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(20, 17); this.label13.TabIndex = 11; @@ -285,7 +263,7 @@ // this.comboBox_num.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox_num.FormattingEnabled = true; - this.comboBox_num.Location = new System.Drawing.Point(470, 6); + this.comboBox_num.Location = new System.Drawing.Point(460, 14); this.comboBox_num.Name = "comboBox_num"; this.comboBox_num.Size = new System.Drawing.Size(66, 25); this.comboBox_num.TabIndex = 10; @@ -293,7 +271,7 @@ // label10 // this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(538, 10); + this.label10.Location = new System.Drawing.Point(528, 18); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(20, 17); this.label10.TabIndex = 9; @@ -302,7 +280,7 @@ // label11 // this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(437, 10); + this.label11.Location = new System.Drawing.Point(427, 18); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(32, 17); this.label11.TabIndex = 8; @@ -312,7 +290,7 @@ // this.comboBox_page.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox_page.FormattingEnabled = true; - this.comboBox_page.Location = new System.Drawing.Point(332, 6); + this.comboBox_page.Location = new System.Drawing.Point(322, 14); this.comboBox_page.Name = "comboBox_page"; this.comboBox_page.Size = new System.Drawing.Size(61, 25); this.comboBox_page.TabIndex = 7; @@ -320,7 +298,7 @@ // label9 // this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(397, 10); + this.label9.Location = new System.Drawing.Point(387, 18); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(20, 17); this.label9.TabIndex = 6; @@ -329,7 +307,7 @@ // label8 // this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(313, 10); + this.label8.Location = new System.Drawing.Point(303, 18); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(20, 17); this.label8.TabIndex = 5; @@ -338,7 +316,7 @@ // label_end // this.label_end.AutoSize = true; - this.label_end.Location = new System.Drawing.Point(269, 10); + this.label_end.Location = new System.Drawing.Point(259, 18); this.label_end.Name = "label_end"; this.label_end.Size = new System.Drawing.Size(32, 17); this.label_end.TabIndex = 4; @@ -347,7 +325,7 @@ // label_down // this.label_down.AutoSize = true; - this.label_down.Location = new System.Drawing.Point(218, 10); + this.label_down.Location = new System.Drawing.Point(208, 18); this.label_down.Name = "label_down"; this.label_down.Size = new System.Drawing.Size(44, 17); this.label_down.TabIndex = 3; @@ -356,7 +334,7 @@ // label_up // this.label_up.AutoSize = true; - this.label_up.Location = new System.Drawing.Point(167, 10); + this.label_up.Location = new System.Drawing.Point(157, 18); this.label_up.Name = "label_up"; this.label_up.Size = new System.Drawing.Size(44, 17); this.label_up.TabIndex = 2; @@ -365,7 +343,7 @@ // label_first // this.label_first.AutoSize = true; - this.label_first.Location = new System.Drawing.Point(128, 10); + this.label_first.Location = new System.Drawing.Point(118, 18); this.label_first.Name = "label_first"; this.label_first.Size = new System.Drawing.Size(32, 17); this.label_first.TabIndex = 1; @@ -374,7 +352,7 @@ // label_count // this.label_count.AutoSize = true; - this.label_count.Location = new System.Drawing.Point(17, 10); + this.label_count.Location = new System.Drawing.Point(7, 18); this.label_count.Name = "label_count"; this.label_count.Size = new System.Drawing.Size(105, 17); this.label_count.TabIndex = 0; @@ -392,11 +370,6 @@ this.splitContainer1.Panel2.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); - this.splitContainer2.Panel1.ResumeLayout(false); - this.splitContainer2.Panel2.ResumeLayout(false); - this.splitContainer2.Panel2.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); - this.splitContainer2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); this.ResumeLayout(false); @@ -417,7 +390,6 @@ private DataGridViewTextBoxColumn 手机号; private DataGridViewTextBoxColumn 卡号; private DataGridViewButtonColumn 删除; - private SplitContainer splitContainer2; private Label label_count; private Button button_go; private TextBox textBox_num; diff --git a/HKCardManager/UserPages/PersonnelEntryPage.cs b/HKCardManager/UserPages/PersonnelEntryPage.cs index 1635c4b..dae738d 100644 --- a/HKCardManager/UserPages/PersonnelEntryPage.cs +++ b/HKCardManager/UserPages/PersonnelEntryPage.cs @@ -14,20 +14,27 @@ namespace HKCardManager.UserPages { public partial class PersonnelEntryPage : UserControl { - List orgTables = new List(); + //List orgTables = new List(); public PersonnelEntryPage() { InitializeComponent(); DataGridViewInit(); EventInit(); - orgTables = HKLibHelper.GetOrg(); + this.SizeChanged += PersonnelEntryPage_SizeChanged; + Global.OrgTables.Clear(); + Global.OrgTables = HKLibHelper.GetOrg(); Global.OrgList.Clear(); - orgTables?.ForEach(item => { Global.OrgList.Add(item.Name); }); + Global.OrgTables?.ForEach(item => { Global.OrgList.Add(item.Name); }); comboBox2.DataSource = Global.OrgList; Task.Factory.StartNew(() => { GetUser(); }); } + private void PersonnelEntryPage_SizeChanged(object? sender, EventArgs e) + { + this.splitContainer1.SplitterDistance = this.Height - 100; + } + private void DataGridViewInit() { dataGridView1.AllowUserToResizeColumns = false;// 禁止用户改变所有列的列宽 @@ -115,7 +122,7 @@ namespace HKCardManager.UserPages { Name = textBox1.Text.Trim(), //Phone = textBox2.Text.Trim(), - OrgId = orgTables.FirstOrDefault(p => p.Name == comboBox2.Text)?.SId + OrgId = Global.OrgTables.FirstOrDefault(p => p.Name == comboBox2.Text)?.SId }; string OrgName = comboBox2.Text; Task.Factory.StartNew(() => diff --git a/HKLib/Interfaces/HKLibHelper.cs b/HKLib/Interfaces/HKLibHelper.cs index 2c950f4..ec4516c 100644 --- a/HKLib/Interfaces/HKLibHelper.cs +++ b/HKLib/Interfaces/HKLibHelper.cs @@ -107,7 +107,7 @@ namespace HKLib.Interfaces t.ReqType = MultiType.GET; }).Build().RunStringFirst(); if (data.IsNullOrEmpty()) return new List(); - var model =data.ToModel()["data"]["data"].ToJson().ToModel>(); + var model = data.ToModel()["data"]["data"].ToJson().ToModel>(); return model.Where(t => !t.Name.IsNullOrEmpty()).Select(t => new OrgDto { Name = t.Name,