From a1a0c4c2cca1ca69cf0d2f95b06e906c60128ac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com> Date: Thu, 13 Oct 2022 17:37:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HKCardManager/Form1.Designer.cs | 159 ++++++------ HKCardManager/Form1.cs | 8 +- HKCardManager/UserPages/CancellationPage.cs | 15 +- HKCardManager/UserPages/PersonnelEntryPage.cs | 4 +- .../UserPages/ReportFormPage.Designer.cs | 234 +++++++++++++++--- HKCardManager/UserPages/ReportFormPage.cs | 49 +++- HKCardManager/UserPages/ReportFormPage.resx | 25 +- 7 files changed, 353 insertions(+), 141 deletions(-) diff --git a/HKCardManager/Form1.Designer.cs b/HKCardManager/Form1.Designer.cs index d38fb45..1a0b6bb 100644 --- a/HKCardManager/Form1.Designer.cs +++ b/HKCardManager/Form1.Designer.cs @@ -44,6 +44,11 @@ this.记次就餐ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.餐段设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.pictureBox2 = new System.Windows.Forms.PictureBox(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.button3 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.pictureBox10 = new System.Windows.Forms.PictureBox(); this.button12 = new System.Windows.Forms.Button(); @@ -63,11 +68,6 @@ this.button6 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button(); this.button5 = new System.Windows.Forms.Button(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.pictureBox2 = new System.Windows.Forms.PictureBox(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.button3 = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.panel1 = new System.Windows.Forms.Panel(); @@ -77,6 +77,9 @@ this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.groupBox4.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox10)).BeginInit(); this.groupBox3.SuspendLayout(); @@ -88,9 +91,6 @@ ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); - this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); this.splitContainer2.Panel1.SuspendLayout(); this.splitContainer2.Panel2.SuspendLayout(); @@ -240,6 +240,71 @@ this.splitContainer1.SplitterDistance = 249; this.splitContainer1.TabIndex = 1; // + // groupBox1 + // + this.groupBox1.BackColor = System.Drawing.SystemColors.Control; + this.groupBox1.Controls.Add(this.pictureBox2); + this.groupBox1.Controls.Add(this.pictureBox1); + this.groupBox1.Controls.Add(this.button3); + this.groupBox1.Controls.Add(this.button2); + this.groupBox1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.groupBox1.ForeColor = System.Drawing.Color.Black; + this.groupBox1.Location = new System.Drawing.Point(3, 3); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(243, 118); + this.groupBox1.TabIndex = 2; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "人事信息"; + // + // pictureBox2 + // + this.pictureBox2.BackColor = System.Drawing.Color.Transparent; + this.pictureBox2.Image = global::HKCardManager.Properties.Resources.suozaijigou; + this.pictureBox2.Location = new System.Drawing.Point(16, 81); + this.pictureBox2.Name = "pictureBox2"; + this.pictureBox2.Size = new System.Drawing.Size(20, 20); + this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox2.TabIndex = 3; + this.pictureBox2.TabStop = false; + // + // pictureBox1 + // + this.pictureBox1.BackColor = System.Drawing.Color.Transparent; + this.pictureBox1.Image = global::HKCardManager.Properties.Resources.renyuanpinci; + this.pictureBox1.Location = new System.Drawing.Point(16, 37); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(20, 20); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox1.TabIndex = 0; + this.pictureBox1.TabStop = false; + // + // button3 + // + this.button3.BackColor = System.Drawing.SystemColors.Control; + this.button3.Location = new System.Drawing.Point(9, 71); + this.button3.Name = "button3"; + this.button3.Padding = new System.Windows.Forms.Padding(30, 0, 0, 0); + this.button3.Size = new System.Drawing.Size(220, 38); + this.button3.TabIndex = 2; + this.button3.Text = "机构录入"; + this.button3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.button3.UseVisualStyleBackColor = false; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button2 + // + this.button2.BackColor = System.Drawing.SystemColors.Control; + this.button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.button2.Location = new System.Drawing.Point(9, 29); + this.button2.Name = "button2"; + this.button2.Padding = new System.Windows.Forms.Padding(30, 0, 0, 0); + this.button2.Size = new System.Drawing.Size(220, 36); + this.button2.TabIndex = 1; + this.button2.Text = "人员录入"; + this.button2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.button2.UseVisualStyleBackColor = false; + this.button2.Click += new System.EventHandler(this.button2_Click); + // // groupBox4 // this.groupBox4.BackColor = System.Drawing.SystemColors.Control; @@ -337,6 +402,7 @@ this.button9.Padding = new System.Windows.Forms.Padding(30, 0, 0, 0); this.button9.Size = new System.Drawing.Size(220, 38); this.button9.TabIndex = 3; + this.button9.Tag = "记次就餐消费明细表"; this.button9.Text = "记次就餐消费明细表"; this.button9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button9.UseVisualStyleBackColor = false; @@ -350,6 +416,7 @@ this.button10.Padding = new System.Windows.Forms.Padding(30, 0, 0, 0); this.button10.Size = new System.Drawing.Size(220, 38); this.button10.TabIndex = 2; + this.button10.Tag = "记次就餐天消费表"; this.button10.Text = "记次就餐天消费表"; this.button10.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button10.UseVisualStyleBackColor = false; @@ -363,6 +430,7 @@ this.button11.Padding = new System.Windows.Forms.Padding(30, 0, 0, 0); this.button11.Size = new System.Drawing.Size(220, 38); this.button11.TabIndex = 1; + this.button11.Tag = "月餐段汇总表"; this.button11.Text = "月餐段汇总表"; this.button11.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button11.UseVisualStyleBackColor = false; @@ -440,6 +508,7 @@ this.button7.Padding = new System.Windows.Forms.Padding(30, 0, 0, 0); this.button7.Size = new System.Drawing.Size(220, 38); this.button7.TabIndex = 4; + this.button7.Tag = "解挂"; this.button7.Text = "解挂"; this.button7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button7.UseVisualStyleBackColor = false; @@ -453,6 +522,7 @@ this.button6.Padding = new System.Windows.Forms.Padding(30, 0, 0, 0); this.button6.Size = new System.Drawing.Size(220, 38); this.button6.TabIndex = 3; + this.button6.Tag = "挂失"; this.button6.Text = "挂失"; this.button6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button6.UseVisualStyleBackColor = false; @@ -466,6 +536,7 @@ this.button4.Padding = new System.Windows.Forms.Padding(30, 0, 0, 0); this.button4.Size = new System.Drawing.Size(220, 38); this.button4.TabIndex = 2; + this.button4.Tag = "销户"; this.button4.Text = "销户"; this.button4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button4.UseVisualStyleBackColor = false; @@ -484,71 +555,6 @@ this.button5.UseVisualStyleBackColor = false; this.button5.Click += new System.EventHandler(this.button5_Click); // - // groupBox1 - // - this.groupBox1.BackColor = System.Drawing.SystemColors.Control; - this.groupBox1.Controls.Add(this.pictureBox2); - this.groupBox1.Controls.Add(this.pictureBox1); - this.groupBox1.Controls.Add(this.button3); - this.groupBox1.Controls.Add(this.button2); - this.groupBox1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.groupBox1.ForeColor = System.Drawing.Color.Black; - this.groupBox1.Location = new System.Drawing.Point(3, 3); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(243, 118); - this.groupBox1.TabIndex = 2; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "人事信息"; - // - // pictureBox2 - // - this.pictureBox2.BackColor = System.Drawing.Color.Transparent; - this.pictureBox2.Image = global::HKCardManager.Properties.Resources.suozaijigou; - this.pictureBox2.Location = new System.Drawing.Point(16, 81); - this.pictureBox2.Name = "pictureBox2"; - this.pictureBox2.Size = new System.Drawing.Size(20, 20); - this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.pictureBox2.TabIndex = 3; - this.pictureBox2.TabStop = false; - // - // pictureBox1 - // - this.pictureBox1.BackColor = System.Drawing.Color.Transparent; - this.pictureBox1.Image = global::HKCardManager.Properties.Resources.renyuanpinci; - this.pictureBox1.Location = new System.Drawing.Point(16, 37); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(20, 20); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.pictureBox1.TabIndex = 0; - this.pictureBox1.TabStop = false; - // - // button3 - // - this.button3.BackColor = System.Drawing.SystemColors.Control; - this.button3.Location = new System.Drawing.Point(9, 71); - this.button3.Name = "button3"; - this.button3.Padding = new System.Windows.Forms.Padding(30, 0, 0, 0); - this.button3.Size = new System.Drawing.Size(220, 38); - this.button3.TabIndex = 2; - this.button3.Text = "机构录入"; - this.button3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.button3.UseVisualStyleBackColor = false; - this.button3.Click += new System.EventHandler(this.button3_Click); - // - // button2 - // - this.button2.BackColor = System.Drawing.SystemColors.Control; - this.button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.button2.Location = new System.Drawing.Point(9, 29); - this.button2.Name = "button2"; - this.button2.Padding = new System.Windows.Forms.Padding(30, 0, 0, 0); - this.button2.Size = new System.Drawing.Size(220, 36); - this.button2.TabIndex = 1; - this.button2.Text = "人员录入"; - this.button2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.button2.UseVisualStyleBackColor = false; - this.button2.Click += new System.EventHandler(this.button2_Click); - // // button1 // this.button1.BackColor = System.Drawing.Color.Transparent; @@ -614,6 +620,7 @@ this.Controls.Add(this.menuStrip1); this.MainMenuStrip = this.menuStrip1; this.Name = "Form1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Form1"; this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); @@ -621,6 +628,9 @@ this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); + this.groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.groupBox4.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pictureBox10)).EndInit(); this.groupBox3.ResumeLayout(false); @@ -632,9 +642,6 @@ ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); - this.groupBox1.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.splitContainer2.Panel1.ResumeLayout(false); this.splitContainer2.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); diff --git a/HKCardManager/Form1.cs b/HKCardManager/Form1.cs index 292b5e3..5840b72 100644 --- a/HKCardManager/Form1.cs +++ b/HKCardManager/Form1.cs @@ -162,13 +162,13 @@ namespace HKCardManager //ʧ private void button4_Click(object sender, EventArgs e) { - ShowPage(new CancellationPage(), ((Button)sender)?.Text); + ShowPage(new CancellationPage(), ((Button)sender)?.Tag.ToString()); } //²Ͷλܱ private void button11_Click(object sender, EventArgs e) { - ShowPage(new ReportFormPage(), ((Button)sender)?.Text); + ShowPage(new ReportFormPage(), ((Button)sender)?.Tag.ToString()); } //Ͷ @@ -177,13 +177,13 @@ namespace HKCardManager ShowPage(new MealSegmentSetPage()); } - private void ShowPage(UserControl userControl, string name = "") + private void ShowPage(UserControl userControl, string? name = "") { panel1.Controls.Clear(); userControl.Width = panel1.Width; userControl.Height = panel1.Height; tempUserControl = userControl; - userControl.Name = name; + userControl.Tag = name; userControl.Show(); panel1.Controls.Add(userControl); } diff --git a/HKCardManager/UserPages/CancellationPage.cs b/HKCardManager/UserPages/CancellationPage.cs index e15a023..1880be7 100644 --- a/HKCardManager/UserPages/CancellationPage.cs +++ b/HKCardManager/UserPages/CancellationPage.cs @@ -35,23 +35,26 @@ namespace HKCardManager.UserPages MessageLogNotify.GetInstance.Show("请输入用户名"); return; } - - if (string.IsNullOrEmpty(this.Name)) + string TagName = this.Tag.ToString(); + if (string.IsNullOrEmpty(TagName)) { MessageLogNotify.GetInstance.Show("功能名称为空,操作失败,请重试"); } else { - var resStatus = this.Name.ToEnum(); + int status = 0; + if (TagName == "销户") status = 3; + else if (TagName == "挂失") status = 2; + else if (TagName == "解挂") status = 1; Task.Factory.StartNew(() => { var res = HKLibHelper.CardStutasChange(new CardStutasDto() { keywrod = name, - Stutas = (int)resStatus + Stutas = status }); - if (res) MessageLogNotify.GetInstance.Show($"用户 {resStatus.ToString()} 成功"); - else MessageLogNotify.GetInstance.Show($"用户 {resStatus.ToString()} 失败,请重试"); + if (res) MessageLogNotify.GetInstance.Show($"用户 {TagName} 成功"); + else MessageLogNotify.GetInstance.Show($"用户 {TagName} 失败,请重试"); }); } } diff --git a/HKCardManager/UserPages/PersonnelEntryPage.cs b/HKCardManager/UserPages/PersonnelEntryPage.cs index e87f1f5..e57a723 100644 --- a/HKCardManager/UserPages/PersonnelEntryPage.cs +++ b/HKCardManager/UserPages/PersonnelEntryPage.cs @@ -108,8 +108,8 @@ namespace HKCardManager.UserPages }); this.Invoke(() => { - dataGridView1.DataSource = null; - dataGridView1.DataSource = userListDtos; + //int len = dataGridView1.Rows.Count-1; + //dataGridView1.Rows[len].Cells[0] = userDto.Name; }); MessageLogNotify.GetInstance.Show($"用户 【{userDto.Name}】 添加成功"); } diff --git a/HKCardManager/UserPages/ReportFormPage.Designer.cs b/HKCardManager/UserPages/ReportFormPage.Designer.cs index 14fe108..085e7a5 100644 --- a/HKCardManager/UserPages/ReportFormPage.Designer.cs +++ b/HKCardManager/UserPages/ReportFormPage.Designer.cs @@ -28,71 +28,225 @@ /// private void InitializeComponent() { - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.查询ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.导出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); - this.menuStrip1.SuspendLayout(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.button2 = new System.Windows.Forms.Button(); + this.button1 = new System.Windows.Forms.Button(); + this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker(); + this.label4 = new System.Windows.Forms.Label(); + this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker(); + this.label3 = new System.Windows.Forms.Label(); + this.姓名 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.手机 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.时间 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.机构 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.早上消费次数 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.中午消费次数 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.晚上消费次数 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.总计消费次数 = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); this.SuspendLayout(); // - // menuStrip1 - // - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.查询ToolStripMenuItem, - this.导出ToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(875, 25); - this.menuStrip1.TabIndex = 1; - this.menuStrip1.Text = "menuStrip1"; - // - // 查询ToolStripMenuItem - // - this.查询ToolStripMenuItem.Name = "查询ToolStripMenuItem"; - this.查询ToolStripMenuItem.Size = new System.Drawing.Size(44, 21); - this.查询ToolStripMenuItem.Text = "查询"; - this.查询ToolStripMenuItem.Click += new System.EventHandler(this.查询ToolStripMenuItem_Click); - // - // 导出ToolStripMenuItem - // - this.导出ToolStripMenuItem.Name = "导出ToolStripMenuItem"; - this.导出ToolStripMenuItem.Size = new System.Drawing.Size(44, 21); - this.导出ToolStripMenuItem.Text = "导出"; - this.导出ToolStripMenuItem.Click += new System.EventHandler(this.导出ToolStripMenuItem_Click); - // // 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.早上消费次数, + this.中午消费次数, + this.晚上消费次数, + this.总计消费次数}); this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; - this.dataGridView1.Location = new System.Drawing.Point(0, 25); + 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(875, 532); + this.dataGridView1.Size = new System.Drawing.Size(875, 513); this.dataGridView1.TabIndex = 2; // + // 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.button2); + this.splitContainer1.Panel1.Controls.Add(this.button1); + this.splitContainer1.Panel1.Controls.Add(this.dateTimePicker2); + this.splitContainer1.Panel1.Controls.Add(this.label4); + this.splitContainer1.Panel1.Controls.Add(this.dateTimePicker1); + this.splitContainer1.Panel1.Controls.Add(this.label3); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.dataGridView1); + this.splitContainer1.Size = new System.Drawing.Size(875, 557); + this.splitContainer1.SplitterDistance = 40; + this.splitContainer1.TabIndex = 3; + // + // button2 + // + this.button2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.button2.Location = new System.Drawing.Point(735, 6); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(88, 30); + this.button2.TabIndex = 12; + this.button2.Text = "导出"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button1 + // + this.button1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.button1.Location = new System.Drawing.Point(629, 6); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(88, 30); + this.button1.TabIndex = 11; + this.button1.Text = "查询"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // dateTimePicker2 + // + this.dateTimePicker2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.dateTimePicker2.Location = new System.Drawing.Point(389, 6); + this.dateTimePicker2.Name = "dateTimePicker2"; + this.dateTimePicker2.Size = new System.Drawing.Size(200, 28); + this.dateTimePicker2.TabIndex = 9; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.label4.Location = new System.Drawing.Point(312, 10); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(90, 21); + this.label4.TabIndex = 8; + this.label4.Text = "结束时间:"; + // + // dateTimePicker1 + // + this.dateTimePicker1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.dateTimePicker1.Location = new System.Drawing.Point(80, 6); + this.dateTimePicker1.Name = "dateTimePicker1"; + this.dateTimePicker1.Size = new System.Drawing.Size(200, 28); + this.dateTimePicker1.TabIndex = 7; + // + // label3 + // + 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(3, 10); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(90, 21); + this.label3.TabIndex = 6; + this.label3.Text = "开始时间:"; + // + // 姓名 + // + this.姓名.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.姓名.DataPropertyName = "Name"; + this.姓名.HeaderText = "姓名"; + this.姓名.Name = "姓名"; + this.姓名.ReadOnly = true; + // + // 手机 + // + this.手机.DataPropertyName = "Phone"; + this.手机.HeaderText = "手机"; + this.手机.Name = "手机"; + this.手机.ReadOnly = true; + // + // 时间 + // + this.时间.DataPropertyName = "Date"; + this.时间.HeaderText = "时间"; + this.时间.Name = "时间"; + this.时间.ReadOnly = true; + // + // 机构 + // + this.机构.DataPropertyName = "Tag"; + this.机构.HeaderText = "机构"; + this.机构.Name = "机构"; + this.机构.ReadOnly = true; + // + // 早上消费次数 + // + this.早上消费次数.DataPropertyName = "AMCount"; + this.早上消费次数.HeaderText = "早上消费次数"; + this.早上消费次数.Name = "早上消费次数"; + this.早上消费次数.ReadOnly = true; + this.早上消费次数.Width = 110; + // + // 中午消费次数 + // + this.中午消费次数.DataPropertyName = "PMCount"; + this.中午消费次数.HeaderText = "中午消费次数"; + this.中午消费次数.Name = "中午消费次数"; + this.中午消费次数.ReadOnly = true; + this.中午消费次数.Width = 110; + // + // 晚上消费次数 + // + this.晚上消费次数.DataPropertyName = "ATCount"; + this.晚上消费次数.HeaderText = "晚上消费次数"; + this.晚上消费次数.Name = "晚上消费次数"; + this.晚上消费次数.ReadOnly = true; + this.晚上消费次数.Width = 110; + // + // 总计消费次数 + // + this.总计消费次数.DataPropertyName = "TotalCount"; + this.总计消费次数.HeaderText = "总计消费次数"; + this.总计消费次数.Name = "总计消费次数"; + this.总计消费次数.ReadOnly = true; + this.总计消费次数.Width = 110; + // // ReportFormPage // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.dataGridView1); - this.Controls.Add(this.menuStrip1); + this.Controls.Add(this.splitContainer1); this.Name = "ReportFormPage"; this.Size = new System.Drawing.Size(875, 557); - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel1.PerformLayout(); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); this.ResumeLayout(false); - this.PerformLayout(); } #endregion - - private MenuStrip menuStrip1; - private ToolStripMenuItem 查询ToolStripMenuItem; - private ToolStripMenuItem 导出ToolStripMenuItem; private DataGridView dataGridView1; + private SplitContainer splitContainer1; + private DateTimePicker dateTimePicker1; + private Label label3; + private DateTimePicker dateTimePicker2; + private Label label4; + private Button button1; + private Button button2; + private DataGridViewTextBoxColumn 姓名; + private DataGridViewTextBoxColumn 手机; + private DataGridViewTextBoxColumn 时间; + private DataGridViewTextBoxColumn 机构; + private DataGridViewTextBoxColumn 早上消费次数; + private DataGridViewTextBoxColumn 中午消费次数; + private DataGridViewTextBoxColumn 晚上消费次数; + private DataGridViewTextBoxColumn 总计消费次数; } } diff --git a/HKCardManager/UserPages/ReportFormPage.cs b/HKCardManager/UserPages/ReportFormPage.cs index c2c5509..9508c7c 100644 --- a/HKCardManager/UserPages/ReportFormPage.cs +++ b/HKCardManager/UserPages/ReportFormPage.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; @@ -18,16 +20,6 @@ namespace HKCardManager.UserPages InitializeComponent(); } - private void 查询ToolStripMenuItem_Click(object sender, EventArgs e) - { - new Query().ShowDialog(); - } - - private void 导出ToolStripMenuItem_Click(object sender, EventArgs e) - { - ExportDataToExcel(dataGridView1, this.Name); - } - private void ExportDataToExcel(DataGridView TableName, string FileName) { SaveFileDialog saveFileDialog = new SaveFileDialog(); @@ -97,5 +89,40 @@ namespace HKCardManager.UserPages MessageLogNotify.GetInstance.Show("数据导出成功"); } } + List reportCountDtos = new List(); + private void button1_Click(object sender, EventArgs e) + { + string TagName = this.Tag.ToString(); + int type = 0; + if (TagName == "月餐段汇总表") type = 2; + else if (TagName == "记次就餐天消费表") type = 1; + else if (TagName == "记次就餐消费明细表") type = 3; + Task.Factory.StartNew(() => + { + var res = HKLibHelper.Report(new ReportDto() { StartTime = dateTimePicker1.Value, EndTime = dateTimePicker2.Value }, type); + if (res != null) + { + if (res.Count > 0) + { + reportCountDtos = res; + this.Invoke(() => { dataGridView1.DataSource = reportCountDtos; }); + MessageLogNotify.GetInstance.Show("获取表数据成功"); + } + else if (res.Count <= 0) + { + MessageLogNotify.GetInstance.Show("未查询到数据"); + } + } + else + { + MessageLogNotify.GetInstance.Show("查询失败,请输入正确的时间段"); + } + }); + } + + private void button2_Click(object sender, EventArgs e) + { + ExportDataToExcel(dataGridView1, this.Tag.ToString()); + } } } diff --git a/HKCardManager/UserPages/ReportFormPage.resx b/HKCardManager/UserPages/ReportFormPage.resx index 938108a..c664d74 100644 --- a/HKCardManager/UserPages/ReportFormPage.resx +++ b/HKCardManager/UserPages/ReportFormPage.resx @@ -57,7 +57,28 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 17, 17 + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True \ No newline at end of file