@@ -28,6 +28,8 @@ | |||
/// </summary> | |||
private void InitializeComponent() | |||
{ | |||
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(); | |||
@@ -59,7 +61,9 @@ | |||
this.button1 = new System.Windows.Forms.Button(); | |||
this.splitContainer2 = new System.Windows.Forms.SplitContainer(); | |||
this.panel1 = new System.Windows.Forms.Panel(); | |||
this.listBox1 = new System.Windows.Forms.ListBox(); | |||
this.dataGridView1 = new System.Windows.Forms.DataGridView(); | |||
this.图标 = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||
this.消息文本 = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); | |||
this.splitContainer1.Panel1.SuspendLayout(); | |||
this.splitContainer1.Panel2.SuspendLayout(); | |||
@@ -84,6 +88,7 @@ | |||
this.splitContainer2.Panel1.SuspendLayout(); | |||
this.splitContainer2.Panel2.SuspendLayout(); | |||
this.splitContainer2.SuspendLayout(); | |||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); | |||
this.SuspendLayout(); | |||
// | |||
// splitContainer1 | |||
@@ -490,7 +495,7 @@ | |||
// | |||
// splitContainer2.Panel2 | |||
// | |||
this.splitContainer2.Panel2.Controls.Add(this.listBox1); | |||
this.splitContainer2.Panel2.Controls.Add(this.dataGridView1); | |||
this.splitContainer2.Size = new System.Drawing.Size(954, 717); | |||
this.splitContainer2.SplitterDistance = 539; | |||
this.splitContainer2.TabIndex = 0; | |||
@@ -507,17 +512,40 @@ | |||
this.panel1.Size = new System.Drawing.Size(954, 539); | |||
this.panel1.TabIndex = 1; | |||
// | |||
// listBox1 | |||
// | |||
this.listBox1.BackColor = System.Drawing.SystemColors.Control; | |||
this.listBox1.Dock = System.Windows.Forms.DockStyle.Fill; | |||
this.listBox1.FormattingEnabled = true; | |||
this.listBox1.ItemHeight = 17; | |||
this.listBox1.Location = new System.Drawing.Point(0, 0); | |||
this.listBox1.Margin = new System.Windows.Forms.Padding(3, 10, 3, 3); | |||
this.listBox1.Name = "listBox1"; | |||
this.listBox1.Size = new System.Drawing.Size(954, 174); | |||
this.listBox1.TabIndex = 0; | |||
// dataGridView1 | |||
// | |||
this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.Control; | |||
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; | |||
this.dataGridView1.ColumnHeadersVisible = false; | |||
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { | |||
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.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; | |||
this.dataGridView1.RowHeadersVisible = false; | |||
this.dataGridView1.RowTemplate.Height = 25; | |||
this.dataGridView1.Size = new System.Drawing.Size(954, 174); | |||
this.dataGridView1.TabIndex = 1; | |||
// | |||
// 图标 | |||
// | |||
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopCenter; | |||
this.图标.DefaultCellStyle = dataGridViewCellStyle1; | |||
this.图标.HeaderText = "图标"; | |||
this.图标.Name = "图标"; | |||
this.图标.ReadOnly = true; | |||
this.图标.Width = 30; | |||
// | |||
// 消息文本 | |||
// | |||
this.消息文本.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; | |||
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; | |||
this.消息文本.DefaultCellStyle = dataGridViewCellStyle2; | |||
this.消息文本.HeaderText = "消息文本"; | |||
this.消息文本.Name = "消息文本"; | |||
this.消息文本.ReadOnly = true; | |||
// | |||
// Form1 | |||
// | |||
@@ -552,6 +580,7 @@ | |||
this.splitContainer2.Panel2.ResumeLayout(false); | |||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); | |||
this.splitContainer2.ResumeLayout(false); | |||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); | |||
this.ResumeLayout(false); | |||
} | |||
@@ -573,7 +602,6 @@ | |||
private GroupBox groupBox1; | |||
private Button button3; | |||
private Button button2; | |||
private ListBox listBox1; | |||
private Panel panel1; | |||
private SplitContainer splitContainer2; | |||
private PictureBox pictureBox1; | |||
@@ -589,5 +617,8 @@ | |||
private GroupBox groupBox5; | |||
private PictureBox pictureBox11; | |||
private Button button8; | |||
private DataGridView dataGridView1; | |||
private DataGridViewTextBoxColumn 图标; | |||
private DataGridViewTextBoxColumn 消息文本; | |||
} | |||
} |
@@ -1,5 +1,6 @@ | |||
using HKLib.DB; | |||
using HKCardManager.UserPages; | |||
using UHFHelper; | |||
namespace HKCardManager | |||
{ | |||
@@ -9,19 +10,48 @@ namespace HKCardManager | |||
{ | |||
InitializeComponent(); | |||
splitContainer1.SplitterDistance = 240; | |||
DataGridViewInit(); | |||
Task.Factory.StartNew(() => | |||
{ | |||
DbContext.InitTable(); | |||
var res = UHFCardHelper.GetInstance().OpenPort(); | |||
if (res != null && res.Res) | |||
MessageLogNotify.GetInstance.ShowError("制卡设备已连接!"); | |||
else MessageLogNotify.GetInstance.ShowError($"制卡设备打开失败!{res?.ResMes}"); | |||
}); | |||
ShowPage(new PersonnelEntryPage()); | |||
this.SizeChanged += Form1_SizeChanged; | |||
this.button1.SizeChanged += Button1_SizeChanged; | |||
MessageLogNotify.GetInstance.Info = new Action<string, Brush>((s, br) => | |||
MessageLogNotify.GetInstance.Info = new Action<string, Color>((s, br) => | |||
{ | |||
this.Invoke(() => { AddListToListBox(listBox1, s, br, true); }); | |||
this.Invoke(() => | |||
{ | |||
dataGridView1.Rows.Insert(0, new string[] { "", $"{DateTime.Now.ToString("HH:mm:ss")} {s}" }); | |||
dataGridView1.Rows[0].DefaultCellStyle.ForeColor = br; | |||
dataGridView1.Rows[0].DefaultCellStyle.Padding = new Padding(0, 0, 0, 10); | |||
}); | |||
}); | |||
} | |||
private void DataGridViewInit() | |||
{ | |||
dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; | |||
dataGridView1.AutoGenerateColumns = false;//禁止自动添加列 | |||
dataGridView1.AllowUserToResizeColumns = false;//是否可以调整列的大小 | |||
dataGridView1.AllowUserToResizeRows = false;//是否可以调整行的大小 | |||
dataGridView1.BorderStyle = BorderStyle.None;//DataGridView边框样式 | |||
dataGridView1.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.None; | |||
dataGridView1.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None; | |||
dataGridView1.CellBorderStyle = DataGridViewCellBorderStyle.None; | |||
dataGridView1.SelectionChanged += DataGridView1_SelectionChanged; | |||
} | |||
private void DataGridView1_SelectionChanged(object? sender, EventArgs e) | |||
{ | |||
dataGridView1.ClearSelection();//禁止选择行 | |||
} | |||
private void Write(string msg) | |||
{ | |||
//bool条件默认为配置文件里面定义,可以自定义任何保存数据条件 | |||
@@ -36,7 +66,6 @@ namespace HKCardManager | |||
// sw.Close(); | |||
// sw.Dispose(); | |||
//} | |||
} | |||
private void AddListToListBox(ListBox rtbox, string text, Brush foreColor, bool addTime = true) | |||
@@ -102,6 +131,20 @@ namespace HKCardManager | |||
catch { } | |||
//清除过多的数据 | |||
if (rtbox.Items.Count > 100) | |||
{ | |||
int count = rtbox.Items.Count - 100; | |||
List<object> temp = new List<object>(); | |||
for (int i = 100; i < rtbox.Items.Count; i++) | |||
{ | |||
if (rtbox.Items.Count >= i - 1) temp.Add(rtbox.Items[i]); | |||
} | |||
foreach (object obj in temp) | |||
{ | |||
rtbox.Items.Remove(obj); | |||
} | |||
} | |||
//rtbox.SelectedIndex = rtbox.Items.Count - 1; | |||
//if (rtbox.Items.Count > 100) | |||
//{ | |||
// int count = rtbox.Items.Count - 100; | |||
@@ -121,10 +164,6 @@ namespace HKCardManager | |||
//rtbox.SelectedIndex = rtbox.Items.Count - 1; | |||
} | |||
private void Button1_SizeChanged(object? sender, EventArgs e) | |||
{ | |||
groupBox1.Width = button1.Width; | |||
@@ -163,8 +202,6 @@ namespace HKCardManager | |||
button12.Width = (groupBox4.Width - 20); | |||
} | |||
UserControl tempUserControl; | |||
private void Form1_SizeChanged(object? sender, EventArgs e) | |||
{ | |||
@@ -193,68 +230,6 @@ namespace HKCardManager | |||
} | |||
} | |||
//private void 人员录入ToolStripMenuItem_Click(object sender, EventArgs e) | |||
//{ | |||
// new PersonnelEntry().ShowDialog(); | |||
//} | |||
//private void 机构录入ToolStripMenuItem_Click(object sender, EventArgs e) | |||
//{ | |||
// new InstitutionalEntry().ShowDialog(); | |||
//} | |||
//private void 发卡ToolStripMenuItem_Click(object sender, EventArgs e) | |||
//{ | |||
// new Hairpin().ShowDialog(); | |||
//} | |||
//private void 销户ToolStripMenuItem_Click(object sender, EventArgs e) | |||
//{ | |||
// Cancellation cancellation = new Cancellation(); | |||
// cancellation.Text = "销户"; | |||
// cancellation.ShowDialog(); | |||
//} | |||
//private void 挂失ToolStripMenuItem_Click(object sender, EventArgs e) | |||
//{ | |||
// Cancellation cancellation = new Cancellation(); | |||
// cancellation.Text = "挂失"; | |||
// cancellation.ShowDialog(); | |||
//} | |||
//private void 解挂ToolStripMenuItem_Click(object sender, EventArgs e) | |||
//{ | |||
// Cancellation cancellation = new Cancellation(); | |||
// cancellation.Text = "解挂"; | |||
// cancellation.ShowDialog(); | |||
//} | |||
//private void 月餐段汇总表ToolStripMenuItem_Click(object sender, EventArgs e) | |||
//{ | |||
// DailyConsumptionTable dailyConsumptionTable = new DailyConsumptionTable(); | |||
// dailyConsumptionTable.Text = "月餐段汇总表"; | |||
// dailyConsumptionTable.ShowDialog(); | |||
//} | |||
//private void 计次就餐天消费表ToolStripMenuItem_Click(object sender, EventArgs e) | |||
//{ | |||
// DailyConsumptionTable dailyConsumptionTable = new DailyConsumptionTable(); | |||
// dailyConsumptionTable.Text = "计次就餐天消费表"; | |||
// dailyConsumptionTable.ShowDialog(); | |||
//} | |||
//private void 计次就餐消费明细表ToolStripMenuItem_Click(object sender, EventArgs e) | |||
//{ | |||
// DailyConsumptionTable dailyConsumptionTable = new DailyConsumptionTable(); | |||
// dailyConsumptionTable.Text = "计次就餐消费明细表"; | |||
// dailyConsumptionTable.ShowDialog(); | |||
//} | |||
//private void 餐段设置ToolStripMenuItem_Click(object sender, EventArgs e) | |||
//{ | |||
// new MealSegmentSet().ShowDialog(); | |||
//} | |||
//人员录入 | |||
private void button2_Click(object sender, EventArgs e) | |||
{ | |||
@@ -57,4 +57,10 @@ | |||
<resheader name="writer"> | |||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
</resheader> | |||
<metadata name="图标.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<value>True</value> | |||
</metadata> | |||
<metadata name="消息文本.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
<value>True</value> | |||
</metadata> | |||
</root> |
@@ -13,6 +13,11 @@ namespace HKCardManager | |||
/// </summary> | |||
public static List<UserInfoModel> UserListDtos { get; set; } = new List<UserInfoModel>(); | |||
/// <summary> | |||
/// 分页数据表 | |||
/// </summary> | |||
public static List<UserInfoModel> PagUserListDtos { get; set; } = new List<UserInfoModel>(); | |||
/// <summary> | |||
/// 机构信息 | |||
/// </summary> | |||
@@ -13,16 +13,16 @@ namespace HKCardManager | |||
public static MessageLogNotify GetInstance => _Instance ?? (_Instance = new MessageLogNotify()); | |||
private MessageLogNotify() { } | |||
public Action<string, Brush> Info { get; set; } | |||
public Action<string, Color> Info { get; set; } | |||
/// <summary> | |||
/// 常规日志显示 | |||
/// </summary> | |||
/// <param name="info">日志消息</param> | |||
/// <param name="brush">日志显示颜色</param> | |||
public void Show(string info, Brush brush = null) | |||
public void Show(string info, Color brush = default) | |||
{ | |||
Info?.Invoke($"消息:{info}", brush == null ? Brushes.Green : brush); | |||
Info?.Invoke($"消息:{info}", brush == default ? Color.Green : brush); | |||
} | |||
/// <summary> | |||
@@ -30,9 +30,9 @@ namespace HKCardManager | |||
/// </summary> | |||
/// <param name="info">日志信息</param> | |||
/// <param name="brush">日志显示颜色</param> | |||
public void ShowEx(string info, Brush brush = null) | |||
public void ShowEx(string info, Color brush = default) | |||
{ | |||
Info?.Invoke($"异常:{info}", brush == null ? Brushes.Red : brush); | |||
Info?.Invoke($"异常:{info}", brush == default ? Color.Red : brush); | |||
} | |||
/// <summary> | |||
@@ -40,9 +40,9 @@ namespace HKCardManager | |||
/// </summary> | |||
/// <param name="info">日志信息</param> | |||
/// <param name="brush">日志显示颜色</param> | |||
public void ShowError(string info, Brush brush = null) | |||
public void ShowError(string info, Color brush = default) | |||
{ | |||
Info?.Invoke($"错误:{info}", brush == null ? Brushes.Red : brush); | |||
Info?.Invoke($"错误:{info}", brush == default ? Color.Red : brush); | |||
} | |||
/// <summary> | |||
@@ -50,9 +50,9 @@ namespace HKCardManager | |||
/// </summary> | |||
/// <param name="info">日志信息</param> | |||
/// <param name="brush">日志显示颜色</param> | |||
public void ShowWarning(string info, Brush brush = null) | |||
public void ShowWarning(string info, Color brush = default) | |||
{ | |||
Info?.Invoke($"警告:{info}", brush == null ? Brushes.Olive : brush); | |||
Info?.Invoke($"警告:{info}", brush == default ? Color.Olive : brush); | |||
} | |||
} | |||
@@ -41,8 +41,7 @@ | |||
this.webView21.Location = new System.Drawing.Point(0, 0); | |||
this.webView21.Name = "webView21"; | |||
this.webView21.Size = new System.Drawing.Size(490, 322); | |||
this.webView21.Source = new System.Uri(" https://witt.black-pa.com/gateAdmin?storeId=0c32b2e2-0dc9-4941-b73d-3dc91f7268ab" + | |||
"", System.UriKind.Absolute); | |||
this.webView21.Source = new System.Uri("http://192.168.1.75:8000/gateAdmin?storeId=6d6301d8-7bec-431c-8009-9ef1a56f3fbc", System.UriKind.Absolute); | |||
this.webView21.TabIndex = 0; | |||
this.webView21.ZoomFactor = 1D; | |||
// | |||
@@ -196,7 +196,7 @@ namespace HKCardManager.UserPages | |||
} | |||
else | |||
{ | |||
MessageLogNotify.GetInstance.ShowError("设备未连接"); | |||
MessageLogNotify.GetInstance.ShowWarning("设备未连接"); | |||
} | |||
} | |||
@@ -31,6 +31,7 @@ namespace HKCardManager.UserPages | |||
if (string.IsNullOrEmpty(name)) | |||
{ | |||
MessageLogNotify.GetInstance.ShowWarning("请输入机构名称"); | |||
return; | |||
} | |||
Task.Factory.StartNew(() => | |||
{ | |||
@@ -34,11 +34,10 @@ | |||
this.label4 = new System.Windows.Forms.Label(); | |||
this.comboBox2 = new System.Windows.Forms.ComboBox(); | |||
this.label3 = new System.Windows.Forms.Label(); | |||
this.comboBox1 = new System.Windows.Forms.ComboBox(); | |||
this.label2 = new System.Windows.Forms.Label(); | |||
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(); | |||
@@ -46,16 +45,35 @@ | |||
this.手机号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||
this.卡号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||
this.删除 = new System.Windows.Forms.DataGridViewButtonColumn(); | |||
this.button_go = new System.Windows.Forms.Button(); | |||
this.textBox_num = new System.Windows.Forms.TextBox(); | |||
this.label12 = new System.Windows.Forms.Label(); | |||
this.label13 = new System.Windows.Forms.Label(); | |||
this.comboBox_num = new System.Windows.Forms.ComboBox(); | |||
this.label10 = new System.Windows.Forms.Label(); | |||
this.label11 = new System.Windows.Forms.Label(); | |||
this.comboBox_page = new System.Windows.Forms.ComboBox(); | |||
this.label9 = new System.Windows.Forms.Label(); | |||
this.label8 = new System.Windows.Forms.Label(); | |||
this.label_end = new System.Windows.Forms.Label(); | |||
this.label_down = new System.Windows.Forms.Label(); | |||
this.label_up = new System.Windows.Forms.Label(); | |||
this.label_first = new System.Windows.Forms.Label(); | |||
this.label_count = new System.Windows.Forms.Label(); | |||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); | |||
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(844, 13); | |||
this.button2.Location = new System.Drawing.Point(757, 13); | |||
this.button2.Name = "button2"; | |||
this.button2.Size = new System.Drawing.Size(90, 32); | |||
this.button2.TabIndex = 20; | |||
@@ -89,7 +107,7 @@ | |||
this.comboBox2.Items.AddRange(new object[] { | |||
"男", | |||
"女"}); | |||
this.comboBox2.Location = new System.Drawing.Point(736, 13); | |||
this.comboBox2.Location = new System.Drawing.Point(579, 13); | |||
this.comboBox2.Name = "comboBox2"; | |||
this.comboBox2.Size = new System.Drawing.Size(97, 29); | |||
this.comboBox2.TabIndex = 16; | |||
@@ -98,35 +116,12 @@ | |||
// | |||
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(656, 17); | |||
this.label3.Location = new System.Drawing.Point(499, 17); | |||
this.label3.Name = "label3"; | |||
this.label3.Size = new System.Drawing.Size(90, 21); | |||
this.label3.TabIndex = 15; | |||
this.label3.Text = "选择机构:"; | |||
// | |||
// 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[] { | |||
"男", | |||
"女"}); | |||
this.comboBox1.Location = new System.Drawing.Point(569, 13); | |||
this.comboBox1.Name = "comboBox1"; | |||
this.comboBox1.Size = new System.Drawing.Size(61, 29); | |||
this.comboBox1.TabIndex = 14; | |||
// | |||
// label2 | |||
// | |||
this.label2.AutoSize = true; | |||
this.label2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); | |||
this.label2.Location = new System.Drawing.Point(486, 17); | |||
this.label2.Name = "label2"; | |||
this.label2.Size = new System.Drawing.Size(90, 21); | |||
this.label2.TabIndex = 13; | |||
this.label2.Text = "选择姓别:"; | |||
// | |||
// textBox1 | |||
// | |||
this.textBox1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); | |||
@@ -154,7 +149,7 @@ | |||
// | |||
// splitContainer1.Panel1 | |||
// | |||
this.splitContainer1.Panel1.Controls.Add(this.dataGridView1); | |||
this.splitContainer1.Panel1.Controls.Add(this.splitContainer2); | |||
// | |||
// splitContainer1.Panel2 | |||
// | |||
@@ -163,14 +158,44 @@ | |||
this.splitContainer1.Panel2.Controls.Add(this.button2); | |||
this.splitContainer1.Panel2.Controls.Add(this.textBox1); | |||
this.splitContainer1.Panel2.Controls.Add(this.label4); | |||
this.splitContainer1.Panel2.Controls.Add(this.comboBox1); | |||
this.splitContainer1.Panel2.Controls.Add(this.label2); | |||
this.splitContainer1.Panel2.Controls.Add(this.label3); | |||
this.splitContainer1.Panel2.Controls.Add(this.label1); | |||
this.splitContainer1.Size = new System.Drawing.Size(947, 561); | |||
this.splitContainer1.SplitterDistance = 499; | |||
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; | |||
@@ -187,7 +212,7 @@ | |||
this.dataGridView1.Name = "dataGridView1"; | |||
this.dataGridView1.RowHeadersVisible = false; | |||
this.dataGridView1.RowTemplate.Height = 25; | |||
this.dataGridView1.Size = new System.Drawing.Size(947, 499); | |||
this.dataGridView1.Size = new System.Drawing.Size(947, 459); | |||
this.dataGridView1.TabIndex = 0; | |||
this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick); | |||
// | |||
@@ -244,6 +269,139 @@ | |||
this.删除.Text = "删除"; | |||
this.删除.UseColumnTextForButtonValue = true; | |||
// | |||
// button_go | |||
// | |||
this.button_go.Location = new System.Drawing.Point(702, 7); | |||
this.button_go.Name = "button_go"; | |||
this.button_go.Size = new System.Drawing.Size(58, 23); | |||
this.button_go.TabIndex = 14; | |||
this.button_go.Text = "跳转"; | |||
this.button_go.UseVisualStyleBackColor = true; | |||
// | |||
// textBox_num | |||
// | |||
this.textBox_num.Location = new System.Drawing.Point(601, 6); | |||
this.textBox_num.Name = "textBox_num"; | |||
this.textBox_num.Size = new System.Drawing.Size(59, 23); | |||
this.textBox_num.TabIndex = 13; | |||
// | |||
// label12 | |||
// | |||
this.label12.AutoSize = true; | |||
this.label12.Location = new System.Drawing.Point(663, 10); | |||
this.label12.Name = "label12"; | |||
this.label12.Size = new System.Drawing.Size(20, 17); | |||
this.label12.TabIndex = 12; | |||
this.label12.Text = "页"; | |||
// | |||
// label13 | |||
// | |||
this.label13.AutoSize = true; | |||
this.label13.Location = new System.Drawing.Point(577, 10); | |||
this.label13.Name = "label13"; | |||
this.label13.Size = new System.Drawing.Size(20, 17); | |||
this.label13.TabIndex = 11; | |||
this.label13.Text = "第"; | |||
// | |||
// comboBox_num | |||
// | |||
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.Name = "comboBox_num"; | |||
this.comboBox_num.Size = new System.Drawing.Size(66, 25); | |||
this.comboBox_num.TabIndex = 10; | |||
// | |||
// label10 | |||
// | |||
this.label10.AutoSize = true; | |||
this.label10.Location = new System.Drawing.Point(538, 10); | |||
this.label10.Name = "label10"; | |||
this.label10.Size = new System.Drawing.Size(20, 17); | |||
this.label10.TabIndex = 9; | |||
this.label10.Text = "条"; | |||
// | |||
// label11 | |||
// | |||
this.label11.AutoSize = true; | |||
this.label11.Location = new System.Drawing.Point(437, 10); | |||
this.label11.Name = "label11"; | |||
this.label11.Size = new System.Drawing.Size(32, 17); | |||
this.label11.TabIndex = 8; | |||
this.label11.Text = "每页"; | |||
// | |||
// comboBox_page | |||
// | |||
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.Name = "comboBox_page"; | |||
this.comboBox_page.Size = new System.Drawing.Size(61, 25); | |||
this.comboBox_page.TabIndex = 7; | |||
// | |||
// label9 | |||
// | |||
this.label9.AutoSize = true; | |||
this.label9.Location = new System.Drawing.Point(397, 10); | |||
this.label9.Name = "label9"; | |||
this.label9.Size = new System.Drawing.Size(20, 17); | |||
this.label9.TabIndex = 6; | |||
this.label9.Text = "页"; | |||
// | |||
// label8 | |||
// | |||
this.label8.AutoSize = true; | |||
this.label8.Location = new System.Drawing.Point(313, 10); | |||
this.label8.Name = "label8"; | |||
this.label8.Size = new System.Drawing.Size(20, 17); | |||
this.label8.TabIndex = 5; | |||
this.label8.Text = "第"; | |||
// | |||
// label_end | |||
// | |||
this.label_end.AutoSize = true; | |||
this.label_end.Location = new System.Drawing.Point(269, 10); | |||
this.label_end.Name = "label_end"; | |||
this.label_end.Size = new System.Drawing.Size(32, 17); | |||
this.label_end.TabIndex = 4; | |||
this.label_end.Text = "尾页"; | |||
// | |||
// label_down | |||
// | |||
this.label_down.AutoSize = true; | |||
this.label_down.Location = new System.Drawing.Point(218, 10); | |||
this.label_down.Name = "label_down"; | |||
this.label_down.Size = new System.Drawing.Size(44, 17); | |||
this.label_down.TabIndex = 3; | |||
this.label_down.Text = "下一页"; | |||
// | |||
// label_up | |||
// | |||
this.label_up.AutoSize = true; | |||
this.label_up.Location = new System.Drawing.Point(167, 10); | |||
this.label_up.Name = "label_up"; | |||
this.label_up.Size = new System.Drawing.Size(44, 17); | |||
this.label_up.TabIndex = 2; | |||
this.label_up.Text = "上一页"; | |||
// | |||
// label_first | |||
// | |||
this.label_first.AutoSize = true; | |||
this.label_first.Location = new System.Drawing.Point(128, 10); | |||
this.label_first.Name = "label_first"; | |||
this.label_first.Size = new System.Drawing.Size(32, 17); | |||
this.label_first.TabIndex = 1; | |||
this.label_first.Text = "首页"; | |||
// | |||
// label_count | |||
// | |||
this.label_count.AutoSize = true; | |||
this.label_count.Location = new System.Drawing.Point(17, 10); | |||
this.label_count.Name = "label_count"; | |||
this.label_count.Size = new System.Drawing.Size(105, 17); | |||
this.label_count.TabIndex = 0; | |||
this.label_count.Text = "总0000条/0000页"; | |||
// | |||
// PersonnelEntryPage | |||
// | |||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); | |||
@@ -256,6 +414,11 @@ | |||
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); | |||
@@ -268,8 +431,6 @@ | |||
private Label label4; | |||
private ComboBox comboBox2; | |||
private Label label3; | |||
private ComboBox comboBox1; | |||
private Label label2; | |||
private TextBox textBox1; | |||
private Label label1; | |||
private SplitContainer splitContainer1; | |||
@@ -280,5 +441,21 @@ | |||
private DataGridViewTextBoxColumn 手机号; | |||
private DataGridViewTextBoxColumn 卡号; | |||
private DataGridViewButtonColumn 删除; | |||
private SplitContainer splitContainer2; | |||
private Label label_count; | |||
private Button button_go; | |||
private TextBox textBox_num; | |||
private Label label12; | |||
private Label label13; | |||
private ComboBox comboBox_num; | |||
private Label label10; | |||
private Label label11; | |||
private ComboBox comboBox_page; | |||
private Label label9; | |||
private Label label8; | |||
private Label label_end; | |||
private Label label_down; | |||
private Label label_up; | |||
private Label label_first; | |||
} | |||
} |
@@ -16,85 +16,88 @@ namespace HKCardManager.UserPages | |||
{ | |||
public partial class PersonnelEntryPage : UserControl | |||
{ | |||
//List<string> OrgList = new List<string>(); | |||
List<OrgTable> orgTables = new List<OrgTable>(); | |||
public PersonnelEntryPage() | |||
{ | |||
InitializeComponent(); | |||
#region 禁止更改宽高 | |||
// 禁止用户改变DataGridView的所有列的列宽 | |||
dataGridView1.AllowUserToResizeColumns = false; | |||
//禁止用户改变DataGridView所有行的行高 | |||
dataGridView1.AllowUserToResizeRows = false; | |||
// 禁止用户改变列头的高度 | |||
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; | |||
// 禁止用户改变列头的宽度 | |||
dataGridView1.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing; | |||
#endregion | |||
this.SizeChanged += PersonnelEntryPage_SizeChanged; | |||
dataGridView1.AutoGenerateColumns = false; | |||
comboBox1.SelectedIndex = 0; | |||
DataGridViewInit(); | |||
EventInit(); | |||
orgTables = ServiceHandler.GetOrgList(); | |||
Global.OrgList.Clear(); | |||
orgTables?.ForEach(item => | |||
{ | |||
Global.OrgList.Add(item.Name); | |||
}); | |||
orgTables?.ForEach(item => { Global.OrgList.Add(item.Name); }); | |||
comboBox2.DataSource = Global.OrgList; | |||
Task.Factory.StartNew(() => | |||
{ | |||
var res = HKLibHelper.GetUserList(""); | |||
Global.UserListDtos.Clear(); | |||
res?.ToList()?.ForEach(item => | |||
{ | |||
string status = ""; | |||
string cardNum = ""; | |||
if (item.Cards != null && item.Cards.Count > 0) | |||
{ | |||
cardNum = item.Cards.ElementAt(0).CardNum; | |||
status = ((CarStatus)item.Cards.ElementAt(0).State).ToString(); | |||
} | |||
Global.UserListDtos.Add(new UserInfoModel() | |||
{ | |||
UserName = item.Name, | |||
Phone = item.Phone, | |||
OrgName = item.OrgInfo?.Count > 0 ? item.OrgInfo.ElementAt(0).Name : "", | |||
CardNum = cardNum, | |||
State = status | |||
}); | |||
}); | |||
//TestData(); | |||
this.Invoke(() => { dataGridView1.DataSource = null; dataGridView1.DataSource = Global.UserListDtos; }); | |||
}); | |||
Task.Factory.StartNew(() => { GetUser(); }); | |||
} | |||
private void TestData() | |||
private void DataGridViewInit() | |||
{ | |||
for (int i = 0; i < 10; i++) | |||
dataGridView1.AllowUserToResizeColumns = false;// 禁止用户改变所有列的列宽 | |||
dataGridView1.AllowUserToResizeRows = false; //禁止用户改变所有行的行高 | |||
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; // 禁止用户改变列头的高度 | |||
dataGridView1.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing; // 禁止用户改变列头的宽度 | |||
dataGridView1.AutoGenerateColumns = false;//禁用自动添加列 | |||
} | |||
//获取所有用户信息 | |||
private void GetUser() | |||
{ | |||
var res = HKLibHelper.GetUserList(""); | |||
Global.UserListDtos.Clear(); | |||
Global.PagUserListDtos.Clear(); | |||
res?.ToList()?.ForEach(item => | |||
{ | |||
string status = ""; | |||
string cardNum = ""; | |||
if (item.Cards != null && item.Cards.Count > 0) | |||
{ | |||
cardNum = item.Cards.ElementAt(0).CardNum; | |||
status = ((CarStatus)item.Cards.ElementAt(0).State).ToString(); | |||
} | |||
Global.UserListDtos.Add(new UserInfoModel() | |||
{ | |||
CardNum = Guid.NewGuid().ToString(), | |||
State = CarStatus.正常.ToString(), | |||
OrgName = "研发部", | |||
Phone = "13545893363", | |||
UserName = $"张{i}" | |||
UserName = item.Name, | |||
Phone = item.Phone, | |||
OrgName = item.OrgInfo?.Count > 0 ? item.OrgInfo.ElementAt(0).Name : "", | |||
CardNum = cardNum, | |||
State = status | |||
}); | |||
}); | |||
for (int i = (currentPageIndex - 1) * pageSize; i < Global.UserListDtos.Count; i++) | |||
{ | |||
if (Global.PagUserListDtos.Count < pageSize) | |||
Global.PagUserListDtos.Add(Global.UserListDtos.ElementAt(i)); | |||
else | |||
break; | |||
} | |||
this.Invoke(() => | |||
{ | |||
dataGridView1.DataSource = null; dataGridView1.DataSource = Global.PagUserListDtos; | |||
totalCount = Global.UserListDtos.Count; | |||
comboBoxNum(); | |||
showDataGirdView(); | |||
}); | |||
} | |||
private void PersonnelEntryPage_SizeChanged(object? sender, EventArgs e) | |||
//获取单页面用户信息 | |||
private void GetPag() | |||
{ | |||
//panel1.Left = (this.Width - panel1.Width) / 2; | |||
//panel1.Top = (this.Height - panel1.Height) / 2; | |||
var tt1 = dataGridView1.Size; | |||
var tt = this.Size; | |||
Global.PagUserListDtos.Clear(); | |||
for (int i = (currentPageIndex - 1) * pageSize; i < Global.UserListDtos.Count; i++) | |||
{ | |||
if (Global.PagUserListDtos.Count < pageSize && i >= 0) | |||
Global.PagUserListDtos.Add(Global.UserListDtos.ElementAt(i)); | |||
else | |||
break; | |||
} | |||
dataGridView1.DataSource = null; | |||
dataGridView1.DataSource = Global.PagUserListDtos; | |||
} | |||
//添加用户 | |||
private void button2_Click(object sender, EventArgs e) | |||
{ | |||
if (string.IsNullOrEmpty(textBox1.Text.Trim())) | |||
@@ -122,16 +125,11 @@ namespace HKCardManager.UserPages | |||
this.Invoke(() => { button2.Enabled = false; }); | |||
if (HKLibHelper.AddUser(userDto)) | |||
{ | |||
Global.UserListDtos.Add(new UserInfoModel() | |||
{ | |||
OrgName = OrgName, | |||
Phone = userDto.Phone, | |||
UserName = userDto.Name | |||
}); | |||
GetUser(); | |||
this.Invoke(() => | |||
{ | |||
dataGridView1.DataSource = null; | |||
dataGridView1.DataSource = Global.UserListDtos; | |||
textBox1.Text = string.Empty; | |||
textBox2.Text = string.Empty; | |||
}); | |||
MessageLogNotify.GetInstance.Show($"用户 【{userDto.Name}】 添加成功"); | |||
} | |||
@@ -142,13 +140,250 @@ namespace HKCardManager.UserPages | |||
} | |||
//数据表列点击事件 | |||
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) | |||
{ | |||
int index = dataGridView1.CurrentRow.Index; | |||
if (index <= dataGridView1.Rows.Count - 1 && dataGridView1.CurrentCell.Value.ToString() == "删除") | |||
{ | |||
MessageLogNotify.GetInstance.Show($"用户名称:{dataGridView1.Rows[index].Cells[0].Value }"); | |||
var res = dataGridView1.Rows[index].Cells[0].Value?.ToString(); | |||
if (string.IsNullOrEmpty(res)) | |||
{ | |||
MessageLogNotify.GetInstance.ShowError("用户名无效"); | |||
return; | |||
} | |||
Task.Factory.StartNew(() => | |||
{ | |||
if (HKLibHelper.DisableUser(res)) | |||
{ | |||
GetUser(); | |||
MessageLogNotify.GetInstance.Show($"用户:【{res}】 删除成功"); | |||
} | |||
else | |||
MessageLogNotify.GetInstance.ShowError($"用户:【{res}】 删除失败"); | |||
}); | |||
} | |||
} | |||
#region 分页显示 | |||
private int totalCount = 0;//总数据个数 | |||
private int pageCount = 0;//总页数 | |||
private int currentPageIndex = 1;//当前页索引 | |||
private int pageSize = 10;//每页分页大小 | |||
private int remainder = 0;//最后一页剩余个数 | |||
private bool isAutoUpdateLabelTip = true;//获取或设置是否自动更新分页标签内容提示,默认为true | |||
//事件初始化 | |||
private void EventInit() | |||
{ | |||
label_first.Click += label_first_Click; //首页 | |||
label_end.Click += label_end_Click;//末页 | |||
label_up.Click += label_up_Click;//上一页 | |||
label_down.Click += label_down_Click;//下一页 | |||
comboBox_page.DropDownClosed += comboBox_page_DropDownClosed;//下拉列表切换页面 | |||
comboBox_num.DropDownClosed += comboBox_num_DropDownClosed;//设置分页大小 | |||
button_go.Click += button_go_Click;//跳转指定页 | |||
} | |||
//首页 | |||
private void label_first_Click(object? sender, EventArgs e) | |||
{ | |||
currentPageIndex = 1; | |||
showDataGirdView(); | |||
} | |||
//末页 | |||
private void label_end_Click(object? sender, EventArgs e) | |||
{ | |||
currentPageIndex = pageCount; | |||
showDataGirdView(); | |||
} | |||
//上一页 | |||
private void label_up_Click(object? sender, EventArgs e) | |||
{ | |||
if (currentPageIndex <= pageCount && currentPageIndex != 1) | |||
{ | |||
currentPageIndex--; | |||
showDataGirdView(); | |||
} | |||
if (isAutoUpdateLabelTip) updateSplitPageLabelTip(); | |||
} | |||
//下一页 | |||
private void label_down_Click(object? sender, EventArgs e) | |||
{ | |||
if (currentPageIndex < pageCount && currentPageIndex != pageCount) | |||
{ | |||
currentPageIndex++; | |||
showDataGirdView(); | |||
} | |||
if (isAutoUpdateLabelTip) updateSplitPageLabelTip(); | |||
} | |||
//第几页 | |||
private void comboBox_page_DropDownClosed(object? sender, EventArgs e) | |||
{ | |||
if (int.TryParse(comboBox_page.Text.Trim(), out int index)) | |||
{ | |||
if (index > 0) | |||
{ | |||
currentPageIndex = index; | |||
updateSplitPageLabelTip(); | |||
showDataGirdView(); | |||
} | |||
} | |||
} | |||
//每页条数 | |||
private void comboBox_num_DropDownClosed(object? sender, EventArgs e) | |||
{ | |||
if (int.TryParse(comboBox_num.Text.Trim(), out int res)) | |||
{ | |||
pageSize = res; | |||
currentPageIndex = 1; //初始化页码为1 | |||
updateSplitPageLabelTip(); | |||
showDataGirdView(); | |||
} | |||
} | |||
//跳转指定页 | |||
private void button_go_Click(object? sender, EventArgs e) | |||
{ | |||
if (int.TryParse(textBox_num.Text.Trim(), out int num)) | |||
{ | |||
if (num > 0 && num <= pageCount) | |||
{ | |||
currentPageIndex = num; | |||
currentPageIndex = currentPageIndex > pageCount ? pageCount : currentPageIndex; | |||
updateSplitPageLabelTip(); | |||
showDataGirdView(); | |||
} | |||
else | |||
{ | |||
currentPageIndex = 1; | |||
MessageLogNotify.GetInstance.ShowWarning("超出页面范围!"); | |||
} | |||
} | |||
else MessageLogNotify.GetInstance.ShowError("请输入指定页面!"); | |||
} | |||
//修改显示数据 | |||
public void updateSplitPageLabelTip() | |||
{ | |||
pagingShow(); | |||
comboBoxPage(); | |||
comboBoxNum(); | |||
} | |||
//判断显示状状况 | |||
private void pagingShow() | |||
{ | |||
//共多少页 | |||
pageCount = totalCount / pageSize; | |||
remainder = totalCount % pageSize; | |||
pageCount = remainder == 0 ? pageCount : pageCount + 1; | |||
if (pageCount <= 1) | |||
{ | |||
label_first.Enabled = false; | |||
label_end.Enabled = false; | |||
label_up.Enabled = false; | |||
label_down.Enabled = false; | |||
comboBox_page.Enabled = false; | |||
textBox_num.Enabled = false; | |||
button_go.Enabled = false; | |||
} | |||
else | |||
{ | |||
label_first.Enabled = true; | |||
label_end.Enabled = true; | |||
label_up.Enabled = true; | |||
label_down.Enabled = true; | |||
comboBox_page.Enabled = true; | |||
textBox_num.Enabled = true; | |||
button_go.Enabled = true; | |||
} | |||
//首页关闭首页,上一页 | |||
if (currentPageIndex == 1) | |||
{ | |||
label_first.Enabled = false; | |||
label_up.Enabled = false; | |||
} | |||
else | |||
{ | |||
label_first.Enabled = true; | |||
label_up.Enabled = true; | |||
} | |||
//末页关闭末页,下一页 | |||
if (currentPageIndex == pageCount) | |||
{ | |||
label_end.Enabled = false; | |||
label_down.Enabled = false; | |||
} | |||
else | |||
{ | |||
label_end.Enabled = true; | |||
label_down.Enabled = true; | |||
} | |||
//共多少条 | |||
label_count.Text = "总" + totalCount + "条/" + pageCount + "页"; | |||
textBox_num.Text = currentPageIndex.ToString(); | |||
} | |||
//多少页 | |||
private void comboBoxPage() | |||
{ | |||
comboBox_page.Items.Clear(); | |||
for (int i = 1; i <= pageCount; i++) comboBox_page.Items.Add(i.ToString()); | |||
comboBox_page.SelectedIndex = -1; | |||
comboBox_page.SelectedIndex = pageCount == 1 ? 0 : currentPageIndex - 1; //当为一页,就设置设置为0 | |||
} | |||
//每页多少条 | |||
private void comboBoxNum() | |||
{ | |||
comboBox_num.Items.Clear(); | |||
comboBox_num.Items.Add("10"); | |||
comboBox_num.Items.Add("20"); | |||
comboBox_num.Items.Add("50"); | |||
comboBox_num.Items.Add("100"); | |||
comboBox_num.Items.Add("500"); | |||
comboBox_num.Items.Add("1000"); | |||
comboBox_num.SelectedIndex = 0; | |||
int i = 0; | |||
switch (pageSize) | |||
{ | |||
case 10: | |||
i = 0; | |||
break; | |||
case 20: | |||
i = 1; | |||
break; | |||
case 50: | |||
i = 2; | |||
break; | |||
case 100: | |||
i = 3; | |||
break; | |||
case 500: | |||
i = 4; | |||
break; | |||
case 1000: | |||
i = 5; | |||
break; | |||
default: | |||
break; | |||
} | |||
comboBox_num.SelectedIndex = i; | |||
} | |||
//数据显示 | |||
private void showDataGirdView() | |||
{ | |||
GetPag(); | |||
updateSplitPageLabelTip(); | |||
} | |||
#endregion | |||
} | |||
} |
@@ -131,7 +131,7 @@ namespace HKCardManager.UserPages | |||
{ | |||
MessageLogNotify.GetInstance.ShowError("查询失败,请输入正确的时间段"); | |||
} | |||
this.Invoke(() => { button1.Enabled = false; }); | |||
this.Invoke(() => { button1.Enabled = true; }); | |||
}); | |||
} | |||
@@ -29,21 +29,21 @@ namespace HKLib.Dto | |||
/// <summary> | |||
/// 早 | |||
/// </summary> | |||
public decimal AMCount { get; set; } | |||
public int AMCount { get; set; } | |||
/// <summary> | |||
/// 中 | |||
/// </summary> | |||
public decimal PMCount { get; set; } | |||
public int PMCount { get; set; } | |||
/// <summary> | |||
/// 晚 | |||
/// </summary> | |||
public decimal ATCount { get; set; } | |||
public int ATCount { get; set; } | |||
/// <summary> | |||
/// 总计 | |||
/// </summary> | |||
public decimal TotalCount { get; set; } | |||
public int TotalCount { get; set; } | |||
} | |||
} |