diff --git a/AuditoriumMS/Access.cs b/AuditoriumMS/Access.cs new file mode 100644 index 0000000..72bd11c --- /dev/null +++ b/AuditoriumMS/Access.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Data; +using System.Data.OleDb; + +namespace AuditoriumMS +{ + /// + /// 数据库连接类 + /// + public class Access + { + // 这里改成解决方案目录下那个accdb文件 ↓ + static string DbPath = @"F:\C#\培优礼堂票务管理系统\AuditoriumMS" + @"\DbTicketing.accdb"; + OleDbConnection oleDb = new OleDbConnection(string.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0}", DbPath)); + // 私有构造函数,单例实现 + private Access() + { + oleDb.Open(); + } + + private static Access access; + /// + /// 数据库连接对象 + /// + public static Access obj + { + get + { + if (access == null) + access = new Access(); + return access; + } + } + + /// + /// 得到DataTable 适用于查询语句 返回查询结果 + /// + public DataTable GetDataTable(string SQL) + { + OleDbDataAdapter dbDataAdapter = new OleDbDataAdapter(SQL, oleDb); + DataTable dt = new DataTable(); + dbDataAdapter.Fill(dt); + return dt; + } + + /// + /// 执行命令 适用于增删改 返回受影响行数 + /// + public int Execute(string SQL) + { + OleDbCommand oleDbCommand = new OleDbCommand(SQL, oleDb); + return oleDbCommand.ExecuteNonQuery(); + } + + /// + /// 字符串过滤,防止sql注入。 + /// + /// 参数 + /// 是否有敏感字符 + public static bool IsHasSQLInject(string str) + { + bool isHasSQLInject = false; + + //字符串中的关键字更具需要添加 + string inj_str = "'|and|exec|union|create|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare|xp_|or|--|+"; + str = str.ToLower().Trim(); + string[] inj_str_array = inj_str.Split('|'); + foreach (string sql in inj_str_array) + { + if (str.IndexOf(sql) > -1) + { + isHasSQLInject = true; + break; + } + } + return isHasSQLInject; + } + } +} diff --git a/AuditoriumMS/AuditoriumMS.csproj b/AuditoriumMS/AuditoriumMS.csproj new file mode 100644 index 0000000..e2b06ba --- /dev/null +++ b/AuditoriumMS/AuditoriumMS.csproj @@ -0,0 +1,229 @@ + + + + + Debug + AnyCPU + {131A3E33-BCF0-4E9C-BF60-5F97DDB4FA75} + WinExe + AuditoriumMS + AuditoriumMS + v4.0 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + + + + + + + + + + + + + + + + + + Form + + + FormMain.cs + + + Form + + + FormManageSystem.cs + + + Form + + + FormAdminLogin.cs + + + Form + + + FormVerify.cs + + + + + UserControl + + + UCBooking.cs + + + UserControl + + + UCModifyPassword.cs + + + UserControl + + + UCNewAuditorium.cs + + + UserControl + + + UCReservationInfoSelect.cs + + + UserControl + + + UCSeatMap.cs + + + UserControl + + + UCShowChart.cs + + + UserControl + + + UCSummaryReport.cs + + + UserControl + + + UCTicketCountSelect.cs + + + UserControl + + + UCTicketCountStatistics.cs + + + UserControl + + + UCTicketSelect.cs + + + UserControl + + + UCTicketStatistics.cs + + + FormMain.cs + + + FormManageSystem.cs + + + FormAdminLogin.cs + + + FormVerify.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + UCBooking.cs + + + UCModifyPassword.cs + + + UCNewAuditorium.cs + + + UCReservationInfoSelect.cs + + + UCSeatMap.cs + + + UCShowChart.cs + + + UCSummaryReport.cs + + + UCTicketCountSelect.cs + + + UCTicketCountStatistics.cs + + + UCTicketSelect.cs + + + UCTicketStatistics.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + Always + + + + + \ No newline at end of file diff --git a/AuditoriumMS/AuditoriumMS.sln b/AuditoriumMS/AuditoriumMS.sln new file mode 100644 index 0000000..86bfdd8 --- /dev/null +++ b/AuditoriumMS/AuditoriumMS.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2036 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuditoriumMS", "AuditoriumMS.csproj", "{131A3E33-BCF0-4E9C-BF60-5F97DDB4FA75}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {131A3E33-BCF0-4E9C-BF60-5F97DDB4FA75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {131A3E33-BCF0-4E9C-BF60-5F97DDB4FA75}.Debug|Any CPU.Build.0 = Debug|Any CPU + {131A3E33-BCF0-4E9C-BF60-5F97DDB4FA75}.Debug|x86.ActiveCfg = Debug|x86 + {131A3E33-BCF0-4E9C-BF60-5F97DDB4FA75}.Debug|x86.Build.0 = Debug|x86 + {131A3E33-BCF0-4E9C-BF60-5F97DDB4FA75}.Release|Any CPU.ActiveCfg = Release|Any CPU + {131A3E33-BCF0-4E9C-BF60-5F97DDB4FA75}.Release|Any CPU.Build.0 = Release|Any CPU + {131A3E33-BCF0-4E9C-BF60-5F97DDB4FA75}.Release|x86.ActiveCfg = Release|x86 + {131A3E33-BCF0-4E9C-BF60-5F97DDB4FA75}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9550CF8D-9B77-4C4D-9CD9-E6AD30D1A9F0} + EndGlobalSection +EndGlobal diff --git a/AuditoriumMS/DbTicketing.accdb b/AuditoriumMS/DbTicketing.accdb new file mode 100644 index 0000000..ac9a3f5 Binary files /dev/null and b/AuditoriumMS/DbTicketing.accdb differ diff --git a/AuditoriumMS/FormMain.Designer.cs b/AuditoriumMS/FormMain.Designer.cs new file mode 100644 index 0000000..3737592 --- /dev/null +++ b/AuditoriumMS/FormMain.Designer.cs @@ -0,0 +1,164 @@ +namespace AuditoriumMS +{ + partial class FormMain + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.btnManagement = new System.Windows.Forms.Button(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPageLecture = new System.Windows.Forms.TabPage(); + this.treeLecture = new System.Windows.Forms.TreeView(); + this.tabPageMovie = new System.Windows.Forms.TabPage(); + this.treeMovie = new System.Windows.Forms.TreeView(); + this.btnUpdate = new System.Windows.Forms.Button(); + this.btnBooking = new AuditoriumMS.UserControls.UCBooking(); + this.tabControl1.SuspendLayout(); + this.tabPageLecture.SuspendLayout(); + this.tabPageMovie.SuspendLayout(); + this.SuspendLayout(); + // + // btnManagement + // + this.btnManagement.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnManagement.Location = new System.Drawing.Point(1182, 13); + this.btnManagement.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.btnManagement.Name = "btnManagement"; + this.btnManagement.Size = new System.Drawing.Size(104, 30); + this.btnManagement.TabIndex = 1; + this.btnManagement.Text = "管理"; + this.btnManagement.UseVisualStyleBackColor = true; + this.btnManagement.Click += new System.EventHandler(this.btnManagement_Click); + // + // tabControl1 + // + this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.tabControl1.Controls.Add(this.tabPageLecture); + this.tabControl1.Controls.Add(this.tabPageMovie); + this.tabControl1.Location = new System.Drawing.Point(12, 13); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(186, 616); + this.tabControl1.TabIndex = 2; + // + // tabPageLecture + // + this.tabPageLecture.Controls.Add(this.treeLecture); + this.tabPageLecture.Location = new System.Drawing.Point(4, 26); + this.tabPageLecture.Name = "tabPageLecture"; + this.tabPageLecture.Padding = new System.Windows.Forms.Padding(3); + this.tabPageLecture.Size = new System.Drawing.Size(178, 586); + this.tabPageLecture.TabIndex = 0; + this.tabPageLecture.Text = "讲座"; + this.tabPageLecture.UseVisualStyleBackColor = true; + // + // treeLecture + // + this.treeLecture.Dock = System.Windows.Forms.DockStyle.Fill; + this.treeLecture.Location = new System.Drawing.Point(3, 3); + this.treeLecture.Name = "treeLecture"; + this.treeLecture.Size = new System.Drawing.Size(172, 580); + this.treeLecture.TabIndex = 0; + this.treeLecture.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView_NodeMouseClick); + // + // tabPageMovie + // + this.tabPageMovie.Controls.Add(this.treeMovie); + this.tabPageMovie.Location = new System.Drawing.Point(4, 26); + this.tabPageMovie.Name = "tabPageMovie"; + this.tabPageMovie.Padding = new System.Windows.Forms.Padding(3); + this.tabPageMovie.Size = new System.Drawing.Size(178, 586); + this.tabPageMovie.TabIndex = 1; + this.tabPageMovie.Text = "电影"; + this.tabPageMovie.UseVisualStyleBackColor = true; + // + // treeMovie + // + this.treeMovie.Dock = System.Windows.Forms.DockStyle.Fill; + this.treeMovie.Location = new System.Drawing.Point(3, 3); + this.treeMovie.Name = "treeMovie"; + this.treeMovie.Size = new System.Drawing.Size(172, 580); + this.treeMovie.TabIndex = 0; + this.treeMovie.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView_NodeMouseClick); + // + // btnUpdate + // + this.btnUpdate.Location = new System.Drawing.Point(116, 13); + this.btnUpdate.Name = "btnUpdate"; + this.btnUpdate.Size = new System.Drawing.Size(75, 23); + this.btnUpdate.TabIndex = 4; + this.btnUpdate.Text = "刷新"; + this.btnUpdate.UseVisualStyleBackColor = true; + this.btnUpdate.Click += new System.EventHandler(this.btnUpdate_Click); + // + // btnBooking + // + this.btnBooking.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.btnBooking.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnBooking.ID = 0; + this.btnBooking.Location = new System.Drawing.Point(200, 51); + this.btnBooking.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.btnBooking.Name = "btnBooking"; + this.btnBooking.Size = new System.Drawing.Size(1086, 578); + this.btnBooking.TabIndex = 3; + // + // FormMain + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.ClientSize = new System.Drawing.Size(1298, 645); + this.Controls.Add(this.btnUpdate); + this.Controls.Add(this.btnBooking); + this.Controls.Add(this.tabControl1); + this.Controls.Add(this.btnManagement); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.MinimumSize = new System.Drawing.Size(700, 500); + this.Name = "FormMain"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "培优礼堂票务管理系统"; + this.Load += new System.EventHandler(this.FormMain_Load); + this.tabControl1.ResumeLayout(false); + this.tabPageLecture.ResumeLayout(false); + this.tabPageMovie.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.Button btnManagement; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPageLecture; + private System.Windows.Forms.TreeView treeLecture; + private System.Windows.Forms.TabPage tabPageMovie; + private System.Windows.Forms.TreeView treeMovie; + private UserControls.UCBooking btnBooking; + private System.Windows.Forms.Button btnUpdate; + } +} \ No newline at end of file diff --git a/AuditoriumMS/FormMain.cs b/AuditoriumMS/FormMain.cs new file mode 100644 index 0000000..8bc9b95 --- /dev/null +++ b/AuditoriumMS/FormMain.cs @@ -0,0 +1,100 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace AuditoriumMS +{ + public partial class FormMain : Form + { + public FormMain() + { + InitializeComponent(); + } + + private void btnManagement_Click(object sender, EventArgs e) + { + Forms.FormAdminLogin form = new Forms.FormAdminLogin(); + if (form.ShowDialog() == DialogResult.OK) + { + FormManageSystem formManageSystem = new FormManageSystem(); + formManageSystem.ShowDialog(); + } + } + + private void FormMain_Load(object sender, EventArgs e) + { + UpdateAuditoriumInfo(); + } + + /// + /// 更新礼堂信息 + /// + private void UpdateAuditoriumInfo() + { + try + { + treeLecture.Nodes.Clear(); + treeMovie.Nodes.Clear(); + DataTable dt = Access.obj.GetDataTable("SELECT ID,名称,开始时间,类型 FROM 礼堂表 WHERE 开始时间 > now() ORDER BY 开始时间"); + // 遍历每一场 + foreach (DataRow row in dt.Rows) + { + string nodeText = string.Format("{0} {1}", + Convert.ToDateTime(row["开始时间"]).ToString("HH:mm"), + row["名称"]); + TreeNode node = new TreeNode(nodeText); + node.Name = node.Text; + node.Tag = row["ID"]; + DateTime startTime = Convert.ToDateTime(row["开始时间"]); + string DateKey = string.Format("{0} {1}", startTime.ToString("yyyy-MM-dd"), startTime.DayOfWeek); + // DateTime.Now.DayOfWeek + if (row["类型"].ToString() == "讲座") + { + // 如果没有这一场的日期,则添加一个日期节点 + if (!treeLecture.Nodes.ContainsKey(DateKey)) + { + TreeNode PNode = new TreeNode(DateKey); + PNode.Name = DateKey; + treeLecture.Nodes.Add(PNode); + } + treeLecture.Nodes[DateKey].Nodes.Add(node); + } + else + { + // 如果没有这一场的日期,则添加一个日期节点 + if (!treeMovie.Nodes.ContainsKey(DateKey)) + { + TreeNode PNode = new TreeNode(DateKey); + PNode.Name = DateKey; + treeMovie.Nodes.Add(PNode); + } + treeMovie.Nodes[DateKey].Nodes.Add(node); + } + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + private void treeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) + { + if (e.Node.Tag == null) + return; + + this.btnBooking.ID = Convert.ToInt32(e.Node.Tag); + } + + private void btnUpdate_Click(object sender, EventArgs e) + { + UpdateAuditoriumInfo(); + } + } +} diff --git a/AuditoriumMS/FormMain.resx b/AuditoriumMS/FormMain.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AuditoriumMS/FormMain.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AuditoriumMS/FormManageSystem.Designer.cs b/AuditoriumMS/FormManageSystem.Designer.cs new file mode 100644 index 0000000..f98a563 --- /dev/null +++ b/AuditoriumMS/FormManageSystem.Designer.cs @@ -0,0 +1,232 @@ +namespace AuditoriumMS +{ + partial class FormManageSystem + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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.信息查询ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.票务信息查询ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.票务数量信息查询ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.预订信息查询ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.信息统计ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.票务信息统计ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.预订信息统计ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.图形展示ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.汇总报表ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.班级预订汇总ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.设置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.修改密码ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.退出登录ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.panelMain = new System.Windows.Forms.Panel(); + this.menuStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.Font = new System.Drawing.Font("微软雅黑", 9F); + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.票务信息ToolStripMenuItem, + this.信息查询ToolStripMenuItem, + this.信息统计ToolStripMenuItem, + this.汇总报表ToolStripMenuItem, + this.设置ToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(884, 25); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // 票务信息ToolStripMenuItem + // + this.票务信息ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.新建ToolStripMenuItem}); + this.票务信息ToolStripMenuItem.Name = "票务信息ToolStripMenuItem"; + this.票务信息ToolStripMenuItem.Size = new System.Drawing.Size(68, 21); + this.票务信息ToolStripMenuItem.Text = "票务信息"; + // + // 新建ToolStripMenuItem + // + this.新建ToolStripMenuItem.Name = "新建ToolStripMenuItem"; + this.新建ToolStripMenuItem.Size = new System.Drawing.Size(100, 22); + this.新建ToolStripMenuItem.Text = "新建"; + this.新建ToolStripMenuItem.Click += new System.EventHandler(this.新建ToolStripMenuItem_Click); + // + // 信息查询ToolStripMenuItem + // + this.信息查询ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.票务信息查询ToolStripMenuItem, + this.票务数量信息查询ToolStripMenuItem, + this.预订信息查询ToolStripMenuItem}); + this.信息查询ToolStripMenuItem.Name = "信息查询ToolStripMenuItem"; + this.信息查询ToolStripMenuItem.Size = new System.Drawing.Size(68, 21); + this.信息查询ToolStripMenuItem.Text = "信息查询"; + // + // 票务信息查询ToolStripMenuItem + // + this.票务信息查询ToolStripMenuItem.Name = "票务信息查询ToolStripMenuItem"; + this.票务信息查询ToolStripMenuItem.Size = new System.Drawing.Size(172, 22); + this.票务信息查询ToolStripMenuItem.Text = "票务信息查询"; + this.票务信息查询ToolStripMenuItem.Click += new System.EventHandler(this.票务信息查询ToolStripMenuItem_Click); + // + // 票务数量信息查询ToolStripMenuItem + // + this.票务数量信息查询ToolStripMenuItem.Name = "票务数量信息查询ToolStripMenuItem"; + this.票务数量信息查询ToolStripMenuItem.Size = new System.Drawing.Size(172, 22); + this.票务数量信息查询ToolStripMenuItem.Text = "票务数量信息查询"; + this.票务数量信息查询ToolStripMenuItem.Click += new System.EventHandler(this.票务数量信息查询ToolStripMenuItem_Click); + // + // 预订信息查询ToolStripMenuItem + // + this.预订信息查询ToolStripMenuItem.Name = "预订信息查询ToolStripMenuItem"; + this.预订信息查询ToolStripMenuItem.Size = new System.Drawing.Size(172, 22); + this.预订信息查询ToolStripMenuItem.Text = "预订信息查询"; + this.预订信息查询ToolStripMenuItem.Click += new System.EventHandler(this.预订信息查询ToolStripMenuItem_Click); + // + // 信息统计ToolStripMenuItem + // + this.信息统计ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.票务信息统计ToolStripMenuItem, + this.预订信息统计ToolStripMenuItem, + this.图形展示ToolStripMenuItem}); + this.信息统计ToolStripMenuItem.Name = "信息统计ToolStripMenuItem"; + this.信息统计ToolStripMenuItem.Size = new System.Drawing.Size(68, 21); + this.信息统计ToolStripMenuItem.Text = "信息统计"; + // + // 票务信息统计ToolStripMenuItem + // + this.票务信息统计ToolStripMenuItem.Name = "票务信息统计ToolStripMenuItem"; + this.票务信息统计ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); + this.票务信息统计ToolStripMenuItem.Text = "票务信息统计"; + this.票务信息统计ToolStripMenuItem.Click += new System.EventHandler(this.票务信息统计ToolStripMenuItem_Click); + // + // 预订信息统计ToolStripMenuItem + // + this.预订信息统计ToolStripMenuItem.Name = "预订信息统计ToolStripMenuItem"; + this.预订信息统计ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); + this.预订信息统计ToolStripMenuItem.Text = "预订信息统计"; + this.预订信息统计ToolStripMenuItem.Click += new System.EventHandler(this.预订信息统计ToolStripMenuItem_Click); + // + // 图形展示ToolStripMenuItem + // + this.图形展示ToolStripMenuItem.Name = "图形展示ToolStripMenuItem"; + this.图形展示ToolStripMenuItem.Size = new System.Drawing.Size(148, 22); + this.图形展示ToolStripMenuItem.Text = "图形展示"; + this.图形展示ToolStripMenuItem.Click += new System.EventHandler(this.图形展示ToolStripMenuItem_Click); + // + // 汇总报表ToolStripMenuItem + // + this.汇总报表ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.班级预订汇总ToolStripMenuItem}); + this.汇总报表ToolStripMenuItem.Name = "汇总报表ToolStripMenuItem"; + this.汇总报表ToolStripMenuItem.Size = new System.Drawing.Size(92, 21); + this.汇总报表ToolStripMenuItem.Text = "班级汇总报表"; + // + // 班级预订汇总ToolStripMenuItem + // + this.班级预订汇总ToolStripMenuItem.Name = "班级预订汇总ToolStripMenuItem"; + this.班级预订汇总ToolStripMenuItem.Size = new System.Drawing.Size(124, 22); + this.班级预订汇总ToolStripMenuItem.Text = "输出报表"; + this.班级预订汇总ToolStripMenuItem.Click += new System.EventHandler(this.班级预订汇总ToolStripMenuItem_Click); + // + // 设置ToolStripMenuItem + // + this.设置ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.修改密码ToolStripMenuItem, + this.退出登录ToolStripMenuItem}); + this.设置ToolStripMenuItem.Name = "设置ToolStripMenuItem"; + this.设置ToolStripMenuItem.Size = new System.Drawing.Size(44, 21); + this.设置ToolStripMenuItem.Text = "设置"; + // + // 修改密码ToolStripMenuItem + // + this.修改密码ToolStripMenuItem.Name = "修改密码ToolStripMenuItem"; + this.修改密码ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.修改密码ToolStripMenuItem.Text = "修改密码"; + this.修改密码ToolStripMenuItem.Click += new System.EventHandler(this.修改密码ToolStripMenuItem_Click); + // + // 退出登录ToolStripMenuItem + // + this.退出登录ToolStripMenuItem.Name = "退出登录ToolStripMenuItem"; + this.退出登录ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.退出登录ToolStripMenuItem.Text = "退出登录"; + this.退出登录ToolStripMenuItem.Click += new System.EventHandler(this.退出登录ToolStripMenuItem_Click); + // + // panelMain + // + this.panelMain.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.panelMain.BackColor = System.Drawing.Color.White; + this.panelMain.Location = new System.Drawing.Point(0, 28); + this.panelMain.Name = "panelMain"; + this.panelMain.Size = new System.Drawing.Size(884, 534); + this.panelMain.TabIndex = 1; + // + // FormManageSystem + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.ClientSize = new System.Drawing.Size(884, 561); + this.Controls.Add(this.panelMain); + this.Controls.Add(this.menuStrip1); + this.Font = new System.Drawing.Font("微软雅黑", 9F); + this.MainMenuStrip = this.menuStrip1; + this.MinimumSize = new System.Drawing.Size(900, 600); + this.Name = "FormManageSystem"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "培优礼堂票务管理系统 - 管理模式"; + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem 信息查询ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 票务信息查询ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 票务数量信息查询ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 预订信息查询ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 信息统计ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 票务信息统计ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 预订信息统计ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 图形展示ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 汇总报表ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 班级预订汇总ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 票务信息ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 新建ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 设置ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem 修改密码ToolStripMenuItem; + private System.Windows.Forms.Panel panelMain; + private System.Windows.Forms.ToolStripMenuItem 退出登录ToolStripMenuItem; + } +} \ No newline at end of file diff --git a/AuditoriumMS/FormManageSystem.cs b/AuditoriumMS/FormManageSystem.cs new file mode 100644 index 0000000..7cef29a --- /dev/null +++ b/AuditoriumMS/FormManageSystem.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace AuditoriumMS +{ + public partial class FormManageSystem : Form + { + public FormManageSystem() + { + InitializeComponent(); + this.panelMain.Controls.Add(new UserControls.UCNewAuditorium { Dock = DockStyle.Fill }); + } + + private void 新建ToolStripMenuItem_Click(object sender, EventArgs e) + { + this.panelMain.Controls.Clear(); + this.panelMain.Controls.Add(new UserControls.UCNewAuditorium { Dock = DockStyle.Fill }); + } + + private void 票务信息查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + this.panelMain.Controls.Clear(); + this.panelMain.Controls.Add(new UserControls.UCTicketSelect { Dock = DockStyle.Fill }); + } + + private void 票务数量信息查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + this.panelMain.Controls.Clear(); + this.panelMain.Controls.Add(new UserControls.UCTicketCountSelect { Dock = DockStyle.Fill }); + } + + private void 预订信息查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + this.panelMain.Controls.Clear(); + this.panelMain.Controls.Add(new UserControls.UCReservationInfoSelect { Dock = DockStyle.Fill }); + } + + private void 票务信息统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + this.panelMain.Controls.Clear(); + this.panelMain.Controls.Add(new UserControls.UCTicketStatistics { Dock = DockStyle.Fill }); + } + + private void 预订信息统计ToolStripMenuItem_Click(object sender, EventArgs e) + { + this.panelMain.Controls.Clear(); + this.panelMain.Controls.Add(new UserControls.UCTicketCountStatistics { Dock = DockStyle.Fill }); + } + + private void 图形展示ToolStripMenuItem_Click(object sender, EventArgs e) + { + this.panelMain.Controls.Clear(); + this.panelMain.Controls.Add(new UserControls.UCShowChart { Dock = DockStyle.Fill }); + } + + private void 班级预订汇总ToolStripMenuItem_Click(object sender, EventArgs e) + { + this.panelMain.Controls.Clear(); + this.panelMain.Controls.Add(new UserControls.UCSummaryReport { Dock = DockStyle.Fill }); + } + + private void 修改密码ToolStripMenuItem_Click(object sender, EventArgs e) + { + this.panelMain.Controls.Clear(); + this.panelMain.Controls.Add(new UserControls.UCModifyPassword { Dock = DockStyle.Fill }); + } + + private void 退出登录ToolStripMenuItem_Click(object sender, EventArgs e) + { + this.Close(); + } + } +} diff --git a/AuditoriumMS/FormManageSystem.resx b/AuditoriumMS/FormManageSystem.resx new file mode 100644 index 0000000..48af572 --- /dev/null +++ b/AuditoriumMS/FormManageSystem.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 25 + + \ No newline at end of file diff --git a/AuditoriumMS/Forms/FormAdminLogin.Designer.cs b/AuditoriumMS/Forms/FormAdminLogin.Designer.cs new file mode 100644 index 0000000..a3c5f01 --- /dev/null +++ b/AuditoriumMS/Forms/FormAdminLogin.Designer.cs @@ -0,0 +1,112 @@ +namespace AuditoriumMS.Forms +{ + partial class FormAdminLogin + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.btnEnter = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.txtAdminPassword = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // btnEnter + // + this.btnEnter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.btnEnter.Location = new System.Drawing.Point(130, 212); + this.btnEnter.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.btnEnter.Name = "btnEnter"; + this.btnEnter.Size = new System.Drawing.Size(214, 44); + this.btnEnter.TabIndex = 7; + this.btnEnter.Text = "进入管理模式"; + this.btnEnter.UseVisualStyleBackColor = true; + this.btnEnter.Click += new System.EventHandler(this.btnEnter_Click); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(90, 126); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(80, 17); + this.label2.TabIndex = 6; + this.label2.Text = "管理员密码:"; + // + // label1 + // + this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.label1.Location = new System.Drawing.Point(30, 44); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(412, 27); + this.label1.TabIndex = 5; + this.label1.Text = "欢迎进入培优礼堂票务信息管理系统管理模式"; + // + // txtAdminPassword + // + this.txtAdminPassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtAdminPassword.Location = new System.Drawing.Point(176, 123); + this.txtAdminPassword.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); + this.txtAdminPassword.Name = "txtAdminPassword"; + this.txtAdminPassword.PasswordChar = '*'; + this.txtAdminPassword.Size = new System.Drawing.Size(206, 23); + this.txtAdminPassword.TabIndex = 4; + // + // FormAdminLogin + // + this.AcceptButton = this.btnEnter; + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(472, 299); + this.Controls.Add(this.btnEnter); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.txtAdminPassword); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "FormAdminLogin"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "管理员登录"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button btnEnter; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox txtAdminPassword; + } +} \ No newline at end of file diff --git a/AuditoriumMS/Forms/FormAdminLogin.cs b/AuditoriumMS/Forms/FormAdminLogin.cs new file mode 100644 index 0000000..94008c7 --- /dev/null +++ b/AuditoriumMS/Forms/FormAdminLogin.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace AuditoriumMS.Forms +{ + public partial class FormAdminLogin : Form + { + public FormAdminLogin() + { + InitializeComponent(); + } + + private void btnEnter_Click(object sender, EventArgs e) + { + string password = txtAdminPassword.Text; + if (string.IsNullOrEmpty(password)) + { + MessageBox.Show("请输入管理员密码!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + try + { + DataTable dt = Access.obj.GetDataTable("SELECT * FROM 管理员密码"); + string adminPassword = dt.Rows[0][0].ToString(); + if (password == adminPassword) + this.DialogResult = DialogResult.OK; + else + MessageBox.Show("密码错误!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + + } + } +} diff --git a/AuditoriumMS/Forms/FormAdminLogin.resx b/AuditoriumMS/Forms/FormAdminLogin.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AuditoriumMS/Forms/FormAdminLogin.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AuditoriumMS/Forms/FormVerify.Designer.cs b/AuditoriumMS/Forms/FormVerify.Designer.cs new file mode 100644 index 0000000..1962720 --- /dev/null +++ b/AuditoriumMS/Forms/FormVerify.Designer.cs @@ -0,0 +1,113 @@ +namespace AuditoriumMS.Forms +{ + partial class FormVerift + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.txtNumber = new System.Windows.Forms.TextBox(); + this.txtName = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.btnAccept = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // txtNumber + // + this.txtNumber.Location = new System.Drawing.Point(114, 72); + this.txtNumber.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.txtNumber.Name = "txtNumber"; + this.txtNumber.Size = new System.Drawing.Size(152, 23); + this.txtNumber.TabIndex = 0; + // + // txtName + // + this.txtName.Location = new System.Drawing.Point(114, 115); + this.txtName.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.txtName.Name = "txtName"; + this.txtName.Size = new System.Drawing.Size(152, 23); + this.txtName.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(59, 76); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(44, 17); + this.label1.TabIndex = 2; + this.label1.Text = "学号:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(59, 119); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(44, 17); + this.label2.TabIndex = 2; + this.label2.Text = "姓名:"; + // + // btnAccept + // + this.btnAccept.Location = new System.Drawing.Point(219, 189); + this.btnAccept.Name = "btnAccept"; + this.btnAccept.Size = new System.Drawing.Size(102, 34); + this.btnAccept.TabIndex = 3; + this.btnAccept.Text = "确认"; + this.btnAccept.UseVisualStyleBackColor = true; + this.btnAccept.Click += new System.EventHandler(this.btnAccept_Click); + // + // FormVerift + // + this.AcceptButton = this.btnAccept; + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(333, 235); + this.Controls.Add(this.btnAccept); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.txtName); + this.Controls.Add(this.txtNumber); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "FormVerift"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "学生身份验证"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox txtNumber; + private System.Windows.Forms.TextBox txtName; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button btnAccept; + } +} \ No newline at end of file diff --git a/AuditoriumMS/Forms/FormVerify.cs b/AuditoriumMS/Forms/FormVerify.cs new file mode 100644 index 0000000..4e57d7c --- /dev/null +++ b/AuditoriumMS/Forms/FormVerify.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace AuditoriumMS.Forms +{ + public partial class FormVerift : Form + { + public FormVerift() + { + InitializeComponent(); + } + + private void btnAccept_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(this.txtNumber.Text)) + { + MessageBox.Show("请输入学号!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (string.IsNullOrEmpty(this.txtName.Text)) + { + MessageBox.Show("请输入姓名!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + // SQL防注入 + if (Access.IsHasSQLInject(this.txtNumber.Text) + || Access.IsHasSQLInject(this.txtName.Text)) + { + MessageBox.Show("格式错误!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + string sql = string.Format("SELECT 1 FROM [学生表] WHERE [学号]={0} AND [姓名]='{1}'", + this.txtNumber.Text, this.txtName.Text); + try + { + DataTable dt = Access.obj.GetDataTable(sql); + if (dt == null || dt.Rows.Count < 1) + { + MessageBox.Show("无该学生!请输入正确的信息", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + // 用来返回购票学生学号 + this.Tag = this.txtNumber.Text; + this.DialogResult = DialogResult.OK; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/AuditoriumMS/Forms/FormVerify.resx b/AuditoriumMS/Forms/FormVerify.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AuditoriumMS/Forms/FormVerify.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AuditoriumMS/Program.cs b/AuditoriumMS/Program.cs new file mode 100644 index 0000000..aec1730 --- /dev/null +++ b/AuditoriumMS/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; + +namespace AuditoriumMS +{ + static class Program + { + public const int AuditoriumSeatColumnsCount = 10; + public const int AuditoriumSeatRowsCount = 10; + + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new FormMain()); + } + } +} diff --git a/AuditoriumMS/Properties/AssemblyInfo.cs b/AuditoriumMS/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..86b499f --- /dev/null +++ b/AuditoriumMS/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("AuditoriumMS")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("AuditoriumMS")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("131a3e33-bcf0-4e9c-bf60-5f97ddb4fa75")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 +// 方法是按如下所示使用“*”: : +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/AuditoriumMS/Properties/Resources.Designer.cs b/AuditoriumMS/Properties/Resources.Designer.cs new file mode 100644 index 0000000..11dd423 --- /dev/null +++ b/AuditoriumMS/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace AuditoriumMS.Properties +{ + + + /// + /// 强类型资源类,用于查找本地化字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// 返回此类使用的缓存 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AuditoriumMS.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 覆盖当前线程的 CurrentUICulture 属性 + /// 使用此强类型的资源类的资源查找。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/AuditoriumMS/Properties/Resources.resx b/AuditoriumMS/Properties/Resources.resx new file mode 100644 index 0000000..ffecec8 --- /dev/null +++ b/AuditoriumMS/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AuditoriumMS/Properties/Settings.Designer.cs b/AuditoriumMS/Properties/Settings.Designer.cs new file mode 100644 index 0000000..759f47b --- /dev/null +++ b/AuditoriumMS/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AuditoriumMS.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/AuditoriumMS/Properties/Settings.settings b/AuditoriumMS/Properties/Settings.settings new file mode 100644 index 0000000..abf36c5 --- /dev/null +++ b/AuditoriumMS/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/AuditoriumMS/UserControls/UCBooking.Designer.cs b/AuditoriumMS/UserControls/UCBooking.Designer.cs new file mode 100644 index 0000000..832c55d --- /dev/null +++ b/AuditoriumMS/UserControls/UCBooking.Designer.cs @@ -0,0 +1,261 @@ +namespace AuditoriumMS.UserControls +{ + partial class UCBooking + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.ucSeatMap1 = new AuditoriumMS.UserControls.UCSeatMap(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.lblTitle = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.lblDate = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.lblPrice = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.lblTime = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.lblTotal = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.lblRemaining = new System.Windows.Forms.Label(); + this.lblPrompt = new System.Windows.Forms.Label(); + this.btnBooking = new System.Windows.Forms.Button(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.SuspendLayout(); + // + // ucSeatMap1 + // + this.ucSeatMap1.Dock = System.Windows.Forms.DockStyle.Fill; + this.ucSeatMap1.Location = new System.Drawing.Point(3, 19); + this.ucSeatMap1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.ucSeatMap1.MinimumSize = new System.Drawing.Size(200, 100); + this.ucSeatMap1.Name = "ucSeatMap1"; + this.ucSeatMap1.Size = new System.Drawing.Size(641, 213); + this.ucSeatMap1.TabIndex = 0; + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.ucSeatMap1); + this.groupBox1.Location = new System.Drawing.Point(3, 256); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(647, 235); + this.groupBox1.TabIndex = 1; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "座位分布图"; + // + // lblTitle + // + this.lblTitle.AutoSize = true; + this.lblTitle.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblTitle.Location = new System.Drawing.Point(46, 28); + this.lblTitle.Name = "lblTitle"; + this.lblTitle.Size = new System.Drawing.Size(110, 31); + this.lblTitle.TabIndex = 2; + this.lblTitle.Text = "名家礼堂"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label2.Location = new System.Drawing.Point(48, 82); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(58, 21); + this.label2.TabIndex = 3; + this.label2.Text = "日期:"; + // + // lblDate + // + this.lblDate.AutoSize = true; + this.lblDate.Font = new System.Drawing.Font("微软雅黑", 12F); + this.lblDate.Location = new System.Drawing.Point(112, 82); + this.lblDate.Name = "lblDate"; + this.lblDate.Size = new System.Drawing.Size(0, 21); + this.lblDate.TabIndex = 4; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label4.Location = new System.Drawing.Point(48, 144); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(58, 21); + this.label4.TabIndex = 5; + this.label4.Text = "票价:"; + // + // lblPrice + // + this.lblPrice.AutoSize = true; + this.lblPrice.Font = new System.Drawing.Font("微软雅黑", 12F); + this.lblPrice.Location = new System.Drawing.Point(112, 144); + this.lblPrice.Name = "lblPrice"; + this.lblPrice.Size = new System.Drawing.Size(0, 21); + this.lblPrice.TabIndex = 6; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label6.Location = new System.Drawing.Point(48, 113); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(58, 21); + this.label6.TabIndex = 3; + this.label6.Text = "时间:"; + // + // lblTime + // + this.lblTime.AutoSize = true; + this.lblTime.Font = new System.Drawing.Font("微软雅黑", 12F); + this.lblTime.Location = new System.Drawing.Point(112, 113); + this.lblTime.Name = "lblTime"; + this.lblTime.Size = new System.Drawing.Size(0, 21); + this.lblTime.TabIndex = 4; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label8.Location = new System.Drawing.Point(32, 175); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(74, 21); + this.label8.TabIndex = 5; + this.label8.Text = "总票数:"; + // + // lblTotal + // + this.lblTotal.AutoSize = true; + this.lblTotal.Font = new System.Drawing.Font("微软雅黑", 12F); + this.lblTotal.Location = new System.Drawing.Point(112, 175); + this.lblTotal.Name = "lblTotal"; + this.lblTotal.Size = new System.Drawing.Size(0, 21); + this.lblTotal.TabIndex = 6; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label10.Location = new System.Drawing.Point(16, 206); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(90, 21); + this.label10.TabIndex = 5; + this.label10.Text = "剩余票数:"; + // + // lblRemaining + // + this.lblRemaining.AutoSize = true; + this.lblRemaining.Font = new System.Drawing.Font("微软雅黑", 12F); + this.lblRemaining.Location = new System.Drawing.Point(112, 206); + this.lblRemaining.Name = "lblRemaining"; + this.lblRemaining.Size = new System.Drawing.Size(0, 21); + this.lblRemaining.TabIndex = 6; + // + // lblPrompt + // + this.lblPrompt.AutoSize = true; + this.lblPrompt.ForeColor = System.Drawing.Color.Red; + this.lblPrompt.Location = new System.Drawing.Point(174, 148); + this.lblPrompt.Name = "lblPrompt"; + this.lblPrompt.Size = new System.Drawing.Size(260, 17); + this.lblPrompt.TabIndex = 6; + this.lblPrompt.Text = "请注意:该场为校园内部观看,采取实名制订票"; + this.lblPrompt.Visible = false; + // + // btnBooking + // + this.btnBooking.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnBooking.Location = new System.Drawing.Point(485, 159); + this.btnBooking.Name = "btnBooking"; + this.btnBooking.Size = new System.Drawing.Size(150, 72); + this.btnBooking.TabIndex = 7; + this.btnBooking.Text = "订票"; + this.btnBooking.UseVisualStyleBackColor = true; + this.btnBooking.Click += new System.EventHandler(this.btnBooking_Click); + // + // groupBox2 + // + this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox2.Controls.Add(this.lblTitle); + this.groupBox2.Controls.Add(this.btnBooking); + this.groupBox2.Controls.Add(this.label2); + this.groupBox2.Controls.Add(this.lblPrompt); + this.groupBox2.Controls.Add(this.label6); + this.groupBox2.Controls.Add(this.lblRemaining); + this.groupBox2.Controls.Add(this.lblDate); + this.groupBox2.Controls.Add(this.lblTotal); + this.groupBox2.Controls.Add(this.lblTime); + this.groupBox2.Controls.Add(this.lblPrice); + this.groupBox2.Controls.Add(this.label4); + this.groupBox2.Controls.Add(this.label10); + this.groupBox2.Controls.Add(this.label8); + this.groupBox2.Location = new System.Drawing.Point(6, 13); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(641, 237); + this.groupBox2.TabIndex = 8; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "场次信息"; + // + // UCBooking + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.Name = "UCBooking"; + this.Size = new System.Drawing.Size(653, 494); + this.groupBox1.ResumeLayout(false); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private UCSeatMap ucSeatMap1; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Label lblTitle; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label lblDate; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label lblPrice; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label lblTime; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label lblTotal; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label lblRemaining; + private System.Windows.Forms.Label lblPrompt; + private System.Windows.Forms.Button btnBooking; + private System.Windows.Forms.GroupBox groupBox2; + } +} diff --git a/AuditoriumMS/UserControls/UCBooking.cs b/AuditoriumMS/UserControls/UCBooking.cs new file mode 100644 index 0000000..8e692c3 --- /dev/null +++ b/AuditoriumMS/UserControls/UCBooking.cs @@ -0,0 +1,295 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace AuditoriumMS.UserControls +{ + public partial class UCBooking : UserControl + { + public UCBooking() + { + InitializeComponent(); + // 座位被选中事件 + this.ucSeatMap1.SelectedEvent += UcSeatMap1_SelectedEvent; + } + + private void UcSeatMap1_SelectedEvent(object sender, Point point) + { + if (this.ID == 0) + return; + Booking(point); + } + #region 属性 + private int _ID; + public int ID + { + set + { + _ID = value; + this.UpdateInfo(value); + } + get + { + return _ID; + } + } + + private string Title + { + get + { + return this.lblTitle.Text; + } + set + { + this.lblTitle.Text = value; + } + } + private DateTime _startTIme; + private DateTime StartTIme + { + get + { + return _startTIme; + } + set + { + _startTIme = value; + this.lblDate.Text = string.Format("{0} {1}", + value.ToString("yyyy-MM-dd"), + value.DayOfWeek); + this.lblTime.Text = value.ToString("HH:mm"); + } + } + private string _type; + private string Type + { + get + { + return _type; + } + set + { + _type = value; + } + } + private int _price; + private int Price + { + get + { + return _price; + } + set + { + _price = value; + if (value == 0) + { + this.lblPrice.Text = "免费"; + this.lblPrompt.Visible = true; + } + else + { + this.lblPrice.Text = string.Format("{0}元", value); + this.lblPrompt.Visible = false; + } + } + } + private int _total; + private int Total + { + get + { + return _total; + } + set + { + _total = value; + this.lblTotal.Text = value.ToString(); + } + } + private int _count; + private int Count + { + get + { + return _count; + } + set + { + _count = value; + this.lblRemaining.Text = (Total - value).ToString(); + } + } + #endregion + + private bool[,] seatMap; + + /// + /// 更新显示信息 + /// + /// 场次ID + private void UpdateInfo(int id) + { + if (id == 0) return; + try + { + string sql = string.Format("SELECT * FROM 礼堂表 WHERE ID={0}", id); + DataTable dt = Access.obj.GetDataTable(sql); + if (dt == null || dt.Rows.Count < 1) + { + MessageBox.Show("未获取到数据!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + this.Title = dt.Rows[0]["名称"].ToString(); + this.StartTIme = Convert.ToDateTime(dt.Rows[0]["开始时间"]); + this.Price = Convert.ToInt32(dt.Rows[0]["票价"]); + this.Type = dt.Rows[0]["类型"].ToString(); + this.Total = Convert.ToInt32(dt.Rows[0]["票数"]); + + + sql = string.Format("SELECT 排,列 FROM 票务表 WHERE 礼堂ID={0}", id); + DataTable seatDT = Access.obj.GetDataTable(sql); + this.seatMap = new bool[Program.AuditoriumSeatRowsCount, Program.AuditoriumSeatColumnsCount]; + for (int i = 0; i < Program.AuditoriumSeatRowsCount; ++i) + for (int j = 0; j < Program.AuditoriumSeatColumnsCount; ++j) + seatMap[i,j] = false; + + this.Count = seatDT.Rows.Count; + List seatList = new List(); + foreach (DataRow row in seatDT.Rows) + { + Point p = new Point(Convert.ToInt32(row["排"]), Convert.ToInt32(row["列"])); + seatMap[p.X - 1, p.Y - 1] = true; + seatList.Add(p); + } + + this.ucSeatMap1.SetValue(seatList, Convert.ToInt32(dt.Rows[0]["票数"])); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + + private bool Booking(Point point) + { + if (point.X == 0) + return false; + int id = 0; + + // 免费为对校内开放,需要提供实名认证 + if (this.Price == 0) + { + Forms.FormVerift formVerift = new Forms.FormVerift(); + if (formVerift.ShowDialog() == DialogResult.OK) + { + id = Convert.ToInt32(formVerift.Tag); + string sql = string.Format("SELECT 排,列,购票时间 FROM 票务表 WHERE 购买者ID={0} AND 礼堂ID={1}", + id, this.ID); + try + { + DataTable dt = Access.obj.GetDataTable(sql); + if (dt != null && dt.Rows.Count > 0) + { + MessageBox.Show(string.Format("你在{0}已经买过本场的票,座位号:{1:00}-{2:00}", + Convert.ToDateTime(dt.Rows[0]["购票时间"]).ToString("yyyy-MM-dd HH:mm"), + dt.Rows[0]["排"], dt.Rows[0]["列"]), "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + else + { + return false; + } + } + InsertTicketInfo(point, id); + UpdateInfo(this.ID); + + // 每张票上的信息包括日期(年、月、日)、星期、时间(时、分)、排、号、类型、票价、编号,以及“名家礼堂”这一固定名称。 + MessageBox.Show(string.Format("订票成功,座位号为:{0:00}-{1:00}", point.X, point.Y), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + PrintTicket(point); + return true; + } + + /// + /// 打印票据 + /// + /// 座位坐标 + private void PrintTicket(Point point) + { + SaveFileDialog save = new SaveFileDialog(); + save.Filter = "票据文件|*.txt"; + if (MessageBox.Show("请问是否打印票据信息?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) + return; + if (save.ShowDialog() != DialogResult.OK) + return; + string savePath = save.FileName; + using (System.IO.FileStream file = new System.IO.FileStream(savePath, System.IO.FileMode.Create, System.IO.FileAccess.Write)) + { + using (System.IO.TextWriter text = new System.IO.StreamWriter(file, System.Text.Encoding.Default)) + { + text.Write(string.Format("日期:{0}\t星期:{1}\t时间:{2}\t排:{3}\t号:{4}\t类型:{5}\t票价:{6}\t编号:{7}\t名称:{8}", + this.StartTIme.ToShortDateString(), this.StartTIme.DayOfWeek, this.StartTIme.ToShortTimeString(), + point.X, point.Y, this.Type, this.Price, this.ID, this.Title)); + } + } + } + + /// + /// 插入票据信息 + /// + /// 座位 + /// 购买者ID(外来人为0) + private void InsertTicketInfo(Point p, int id) + { + string sql = string.Format("INSERT INTO 票务表(排,列,礼堂ID,购买者ID) VALUES({0}, {1}, {2}, {3})", p.X, p.Y, this.ID, id); + try + { + int n = Access.obj.Execute(sql); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + /// + /// 寻找空座位 + /// + /// 空位坐标 + private Point FindVacancy() + { + for (int i = 0; i < Program.AuditoriumSeatRowsCount; ++i) + for (int j = 0; j < Program.AuditoriumSeatColumnsCount; ++j) + if (this.seatMap[i, j] == false) + return new Point(i + 1, j + 1); + return new Point(0, 0); + } + + private void btnBooking_Click(object sender, EventArgs e) + { + if (this.ID == 0) + return; + + if (this.Count == this.Total) + { + MessageBox.Show("没有余票", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + Booking(FindVacancy()); + } + } +} diff --git a/AuditoriumMS/UserControls/UCBooking.resx b/AuditoriumMS/UserControls/UCBooking.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AuditoriumMS/UserControls/UCBooking.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AuditoriumMS/UserControls/UCModifyPassword.Designer.cs b/AuditoriumMS/UserControls/UCModifyPassword.Designer.cs new file mode 100644 index 0000000..aac222b --- /dev/null +++ b/AuditoriumMS/UserControls/UCModifyPassword.Designer.cs @@ -0,0 +1,152 @@ +namespace AuditoriumMS.UserControls +{ + partial class UCModifyPassword + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.txtOldPassword = new System.Windows.Forms.TextBox(); + this.txtNewPassword = new System.Windows.Forms.TextBox(); + this.txtNewPassword1 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.btnAccept = new System.Windows.Forms.Button(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // txtOldPassword + // + this.txtOldPassword.Location = new System.Drawing.Point(191, 116); + this.txtOldPassword.Name = "txtOldPassword"; + this.txtOldPassword.PasswordChar = '*'; + this.txtOldPassword.Size = new System.Drawing.Size(189, 34); + this.txtOldPassword.TabIndex = 0; + // + // txtNewPassword + // + this.txtNewPassword.Location = new System.Drawing.Point(191, 156); + this.txtNewPassword.Name = "txtNewPassword"; + this.txtNewPassword.PasswordChar = '*'; + this.txtNewPassword.Size = new System.Drawing.Size(189, 34); + this.txtNewPassword.TabIndex = 0; + // + // txtNewPassword1 + // + this.txtNewPassword1.Location = new System.Drawing.Point(191, 196); + this.txtNewPassword1.Name = "txtNewPassword1"; + this.txtNewPassword1.PasswordChar = '*'; + this.txtNewPassword1.Size = new System.Drawing.Size(189, 34); + this.txtNewPassword1.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑", 13F); + this.label1.Location = new System.Drawing.Point(121, 122); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(64, 24); + this.label1.TabIndex = 1; + this.label1.Text = "旧密码"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑", 13F); + this.label2.Location = new System.Drawing.Point(121, 162); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(64, 24); + this.label2.TabIndex = 2; + this.label2.Text = "新密码"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("微软雅黑", 13F); + this.label3.Location = new System.Drawing.Point(85, 202); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(100, 24); + this.label3.TabIndex = 2; + this.label3.Text = "确认新密码"; + // + // groupBox1 + // + this.groupBox1.Anchor = System.Windows.Forms.AnchorStyles.None; + this.groupBox1.Controls.Add(this.btnAccept); + this.groupBox1.Controls.Add(this.txtOldPassword); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.txtNewPassword1); + this.groupBox1.Controls.Add(this.label3); + this.groupBox1.Controls.Add(this.txtNewPassword); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Bold); + this.groupBox1.Location = new System.Drawing.Point(183, 106); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(518, 323); + this.groupBox1.TabIndex = 3; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "修改密码"; + // + // btnAccept + // + this.btnAccept.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnAccept.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold); + this.btnAccept.Location = new System.Drawing.Point(385, 266); + this.btnAccept.Name = "btnAccept"; + this.btnAccept.Size = new System.Drawing.Size(115, 38); + this.btnAccept.TabIndex = 3; + this.btnAccept.Text = "确认"; + this.btnAccept.UseVisualStyleBackColor = true; + this.btnAccept.Click += new System.EventHandler(this.btnAccept_Click); + // + // UCModifyPassword + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.groupBox1); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.Name = "UCModifyPassword"; + this.Size = new System.Drawing.Size(884, 534); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TextBox txtOldPassword; + private System.Windows.Forms.TextBox txtNewPassword; + private System.Windows.Forms.TextBox txtNewPassword1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Button btnAccept; + } +} diff --git a/AuditoriumMS/UserControls/UCModifyPassword.cs b/AuditoriumMS/UserControls/UCModifyPassword.cs new file mode 100644 index 0000000..4b016c5 --- /dev/null +++ b/AuditoriumMS/UserControls/UCModifyPassword.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace AuditoriumMS.UserControls +{ + public partial class UCModifyPassword : UserControl + { + public UCModifyPassword() + { + InitializeComponent(); + } + + private void btnAccept_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(this.txtOldPassword.Text) + || string.IsNullOrEmpty(this.txtNewPassword.Text) + || string.IsNullOrEmpty(this.txtNewPassword1.Text)) + { + MessageBox.Show("不能为空!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + if (Access.IsHasSQLInject(this.txtOldPassword.Text) + || Access.IsHasSQLInject(this.txtNewPassword.Text) + || Access.IsHasSQLInject(this.txtNewPassword1.Text)) + { + MessageBox.Show("禁止输入非法字符!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + if (this.txtNewPassword.Text != this.txtNewPassword1.Text) + { + MessageBox.Show("两次密码不相同!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + string sql = string.Format("UPDATE 管理员密码 SET [密码]='{0}' WHERE [密码]='{1}'", + this.txtNewPassword.Text, this.txtOldPassword.Text); + try + { + int n = Access.obj.Execute(sql); + if (n == 0) + { + MessageBox.Show("旧密码错误,修改失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + else + { + this.txtNewPassword.Text = ""; + this.txtNewPassword1.Text = ""; + this.txtOldPassword.Text = ""; + MessageBox.Show("密码修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/AuditoriumMS/UserControls/UCModifyPassword.resx b/AuditoriumMS/UserControls/UCModifyPassword.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AuditoriumMS/UserControls/UCModifyPassword.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AuditoriumMS/UserControls/UCNewAuditorium.Designer.cs b/AuditoriumMS/UserControls/UCNewAuditorium.Designer.cs new file mode 100644 index 0000000..c65e0e0 --- /dev/null +++ b/AuditoriumMS/UserControls/UCNewAuditorium.Designer.cs @@ -0,0 +1,359 @@ +namespace AuditoriumMS.UserControls +{ + partial class UCNewAuditorium + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.DTPStartTIme = new System.Windows.Forms.DateTimePicker(); + this.cmbType = new System.Windows.Forms.ComboBox(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.btnNew = new System.Windows.Forms.Button(); + this.label6 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.NUDNumber = new System.Windows.Forms.NumericUpDown(); + this.NUDPrice = new System.Windows.Forms.NumericUpDown(); + this.NUDHour = new System.Windows.Forms.NumericUpDown(); + this.NUDMinute = new System.Windows.Forms.NumericUpDown(); + this.label9 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.label12 = new System.Windows.Forms.Label(); + this.txtTitle = new System.Windows.Forms.TextBox(); + ((System.ComponentModel.ISupportInitialize)(this.NUDNumber)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDPrice)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDHour)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDMinute)).BeginInit(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label1.Location = new System.Drawing.Point(86, 156); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(74, 21); + this.label1.TabIndex = 0; + this.label1.Text = "总票数:"; + // + // DTPStartTIme + // + this.DTPStartTIme.Location = new System.Drawing.Point(166, 218); + this.DTPStartTIme.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.DTPStartTIme.Name = "DTPStartTIme"; + this.DTPStartTIme.Size = new System.Drawing.Size(180, 23); + this.DTPStartTIme.TabIndex = 3; + // + // cmbType + // + this.cmbType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbType.FormattingEnabled = true; + this.cmbType.Items.AddRange(new object[] { + "讲座", + "电影"}); + this.cmbType.Location = new System.Drawing.Point(166, 282); + this.cmbType.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.cmbType.Name = "cmbType"; + this.cmbType.Size = new System.Drawing.Size(180, 25); + this.cmbType.TabIndex = 4; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label2.Location = new System.Drawing.Point(70, 219); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(90, 21); + this.label2.TabIndex = 0; + this.label2.Text = "开始日期:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label3.Location = new System.Drawing.Point(102, 281); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(58, 21); + this.label3.TabIndex = 0; + this.label3.Text = "类型:"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label4.Location = new System.Drawing.Point(102, 186); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(58, 21); + this.label4.TabIndex = 0; + this.label4.Text = "票价:"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label5.Location = new System.Drawing.Point(128, 59); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(158, 31); + this.label5.TabIndex = 0; + this.label5.Text = "新建票务信息"; + // + // btnNew + // + this.btnNew.Font = new System.Drawing.Font("微软雅黑", 12F); + this.btnNew.Location = new System.Drawing.Point(117, 335); + this.btnNew.Name = "btnNew"; + this.btnNew.Size = new System.Drawing.Size(180, 44); + this.btnNew.TabIndex = 5; + this.btnNew.Text = "新建"; + this.btnNew.UseVisualStyleBackColor = true; + this.btnNew.Click += new System.EventHandler(this.btnNew_Click); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label6.Location = new System.Drawing.Point(70, 250); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(90, 21); + this.label6.TabIndex = 0; + this.label6.Text = "开始时间:"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label7.Location = new System.Drawing.Point(226, 250); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(26, 21); + this.label7.TabIndex = 0; + this.label7.Text = "时"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label8.Location = new System.Drawing.Point(318, 250); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(26, 21); + this.label8.TabIndex = 0; + this.label8.Text = "分"; + // + // NUDNumber + // + this.NUDNumber.Location = new System.Drawing.Point(166, 155); + this.NUDNumber.Maximum = new decimal(new int[] { + 200, + 0, + 0, + 0}); + this.NUDNumber.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.NUDNumber.Name = "NUDNumber"; + this.NUDNumber.Size = new System.Drawing.Size(146, 23); + this.NUDNumber.TabIndex = 6; + this.NUDNumber.Value = new decimal(new int[] { + 200, + 0, + 0, + 0}); + // + // NUDPrice + // + this.NUDPrice.Location = new System.Drawing.Point(166, 186); + this.NUDPrice.Maximum = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + this.NUDPrice.Name = "NUDPrice"; + this.NUDPrice.Size = new System.Drawing.Size(146, 23); + this.NUDPrice.TabIndex = 6; + // + // NUDHour + // + this.NUDHour.Location = new System.Drawing.Point(167, 249); + this.NUDHour.Maximum = new decimal(new int[] { + 24, + 0, + 0, + 0}); + this.NUDHour.Name = "NUDHour"; + this.NUDHour.Size = new System.Drawing.Size(53, 23); + this.NUDHour.TabIndex = 6; + this.NUDHour.Value = new decimal(new int[] { + 14, + 0, + 0, + 0}); + // + // NUDMinute + // + this.NUDMinute.Location = new System.Drawing.Point(259, 249); + this.NUDMinute.Maximum = new decimal(new int[] { + 60, + 0, + 0, + 0}); + this.NUDMinute.Name = "NUDMinute"; + this.NUDMinute.Size = new System.Drawing.Size(53, 23); + this.NUDMinute.TabIndex = 6; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label9.Location = new System.Drawing.Point(318, 185); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(26, 21); + this.label9.TabIndex = 0; + this.label9.Text = "元"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label10.Location = new System.Drawing.Point(318, 155); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(26, 21); + this.label10.TabIndex = 0; + this.label10.Text = "张"; + // + // label11 + // + this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label11.AutoSize = true; + this.label11.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label11.ForeColor = System.Drawing.Color.Red; + this.label11.Location = new System.Drawing.Point(527, 0); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(354, 22); + this.label11.TabIndex = 0; + this.label11.Text = "*对内开放不收费,对外开放收费且不使用实名制"; + // + // groupBox1 + // + this.groupBox1.Anchor = System.Windows.Forms.AnchorStyles.None; + this.groupBox1.Controls.Add(this.txtTitle); + this.groupBox1.Controls.Add(this.label5); + this.groupBox1.Controls.Add(this.NUDMinute); + this.groupBox1.Controls.Add(this.label12); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Controls.Add(this.NUDHour); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.NUDPrice); + this.groupBox1.Controls.Add(this.label6); + this.groupBox1.Controls.Add(this.NUDNumber); + this.groupBox1.Controls.Add(this.label7); + this.groupBox1.Controls.Add(this.btnNew); + this.groupBox1.Controls.Add(this.label4); + this.groupBox1.Controls.Add(this.cmbType); + this.groupBox1.Controls.Add(this.label9); + this.groupBox1.Controls.Add(this.DTPStartTIme); + this.groupBox1.Controls.Add(this.label10); + this.groupBox1.Controls.Add(this.label3); + this.groupBox1.Controls.Add(this.label8); + this.groupBox1.Location = new System.Drawing.Point(235, 61); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(415, 412); + this.groupBox1.TabIndex = 7; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "信息录入"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label12.Location = new System.Drawing.Point(102, 128); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(58, 21); + this.label12.TabIndex = 0; + this.label12.Text = "名称:"; + // + // txtTitle + // + this.txtTitle.Location = new System.Drawing.Point(166, 126); + this.txtTitle.Name = "txtTitle"; + this.txtTitle.Size = new System.Drawing.Size(146, 23); + this.txtTitle.TabIndex = 7; + this.txtTitle.Text = "名家礼堂"; + // + // UCNewAuditorium + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.label11); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.Name = "UCNewAuditorium"; + this.Size = new System.Drawing.Size(884, 534); + this.Load += new System.EventHandler(this.UCNewAuditorium_Load); + ((System.ComponentModel.ISupportInitialize)(this.NUDNumber)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDPrice)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDHour)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDMinute)).EndInit(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.DateTimePicker DTPStartTIme; + private System.Windows.Forms.ComboBox cmbType; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Button btnNew; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.NumericUpDown NUDNumber; + private System.Windows.Forms.NumericUpDown NUDPrice; + private System.Windows.Forms.NumericUpDown NUDHour; + private System.Windows.Forms.NumericUpDown NUDMinute; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.TextBox txtTitle; + private System.Windows.Forms.Label label12; + } +} diff --git a/AuditoriumMS/UserControls/UCNewAuditorium.cs b/AuditoriumMS/UserControls/UCNewAuditorium.cs new file mode 100644 index 0000000..153e98d --- /dev/null +++ b/AuditoriumMS/UserControls/UCNewAuditorium.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace AuditoriumMS.UserControls +{ + public partial class UCNewAuditorium : UserControl + { + public UCNewAuditorium() + { + InitializeComponent(); + } + + private void btnNew_Click(object sender, EventArgs e) + { + int totalNumber = 0; + int price = 0; + string aType = ""; + DateTime startTIme; + try + { + totalNumber = (int)this.NUDNumber.Value; + price = (int)this.NUDPrice.Value; + startTIme = this.DTPStartTIme.Value.Date; + startTIme = startTIme.AddHours((int)this.NUDHour.Value); + startTIme = startTIme.AddMinutes((int)this.NUDMinute.Value); + aType = this.cmbType.Text; + + if (string.IsNullOrEmpty(txtTitle.Text)) + { + MessageBox.Show("名称不能为空!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (Access.IsHasSQLInject(txtTitle.Text)) + { + MessageBox.Show("名称禁止输入非法字符!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (startTIme < DateTime.Now) + { + MessageBox.Show("请选择正确的开始时间!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (string.IsNullOrEmpty(aType)) + { + MessageBox.Show("请选择类型!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + string SQL = string.Format("INSERT INTO 礼堂表(名称,开始时间,类型,票价,票数) VALUES('{0}','{1}','{2}',{3},{4})", txtTitle.Text, startTIme, aType, price, totalNumber); + int n = Access.obj.Execute(SQL); + if (n == 1) + { + MessageBox.Show("新建成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); + } + else + { + MessageBox.Show("新建失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + catch (Exception ex) + { + MessageBox.Show("处理数据出错,请输入正确的数据!\n错误信息:" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + private void UCNewAuditorium_Load(object sender, EventArgs e) + { + this.cmbType.SelectedIndex = 0; + this.NUDNumber.Maximum = Program.AuditoriumSeatColumnsCount * Program.AuditoriumSeatRowsCount; + } + } +} diff --git a/AuditoriumMS/UserControls/UCNewAuditorium.resx b/AuditoriumMS/UserControls/UCNewAuditorium.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AuditoriumMS/UserControls/UCNewAuditorium.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AuditoriumMS/UserControls/UCReservationInfoSelect.Designer.cs b/AuditoriumMS/UserControls/UCReservationInfoSelect.Designer.cs new file mode 100644 index 0000000..0a2f789 --- /dev/null +++ b/AuditoriumMS/UserControls/UCReservationInfoSelect.Designer.cs @@ -0,0 +1,390 @@ +namespace AuditoriumMS.UserControls +{ + partial class UCReservationInfoSelect + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.NUDEndMinute = new System.Windows.Forms.NumericUpDown(); + this.NUDBeginMinute = new System.Windows.Forms.NumericUpDown(); + this.NUDEndHour = new System.Windows.Forms.NumericUpDown(); + this.NUDBeginHour = new System.Windows.Forms.NumericUpDown(); + this.DTPEndDate = new System.Windows.Forms.DateTimePicker(); + this.label5 = new System.Windows.Forms.Label(); + this.DTPBeginDate = new System.Windows.Forms.DateTimePicker(); + this.label4 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.txtNumber = new System.Windows.Forms.TextBox(); + this.label10 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.txtName = new System.Windows.Forms.TextBox(); + this.label12 = new System.Windows.Forms.Label(); + this.txtClass = new System.Windows.Forms.TextBox(); + this.btnSelect = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + ((System.ComponentModel.ISupportInitialize)(this.NUDEndMinute)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDBeginMinute)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDEndHour)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDBeginHour)).BeginInit(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.SuspendLayout(); + // + // NUDEndMinute + // + this.NUDEndMinute.Location = new System.Drawing.Point(416, 51); + this.NUDEndMinute.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.NUDEndMinute.Maximum = new decimal(new int[] { + 60, + 0, + 0, + 0}); + this.NUDEndMinute.Name = "NUDEndMinute"; + this.NUDEndMinute.Size = new System.Drawing.Size(38, 23); + this.NUDEndMinute.TabIndex = 25; + // + // NUDBeginMinute + // + this.NUDBeginMinute.Location = new System.Drawing.Point(148, 51); + this.NUDBeginMinute.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.NUDBeginMinute.Maximum = new decimal(new int[] { + 60, + 0, + 0, + 0}); + this.NUDBeginMinute.Name = "NUDBeginMinute"; + this.NUDBeginMinute.Size = new System.Drawing.Size(40, 23); + this.NUDBeginMinute.TabIndex = 26; + // + // NUDEndHour + // + this.NUDEndHour.Location = new System.Drawing.Point(347, 51); + this.NUDEndHour.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.NUDEndHour.Maximum = new decimal(new int[] { + 24, + 0, + 0, + 0}); + this.NUDEndHour.Name = "NUDEndHour"; + this.NUDEndHour.Size = new System.Drawing.Size(38, 23); + this.NUDEndHour.TabIndex = 27; + this.NUDEndHour.Value = new decimal(new int[] { + 14, + 0, + 0, + 0}); + // + // NUDBeginHour + // + this.NUDBeginHour.Location = new System.Drawing.Point(82, 51); + this.NUDBeginHour.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.NUDBeginHour.Maximum = new decimal(new int[] { + 24, + 0, + 0, + 0}); + this.NUDBeginHour.Name = "NUDBeginHour"; + this.NUDBeginHour.Size = new System.Drawing.Size(38, 23); + this.NUDBeginHour.TabIndex = 28; + this.NUDBeginHour.Value = new decimal(new int[] { + 14, + 0, + 0, + 0}); + // + // DTPEndDate + // + this.DTPEndDate.Location = new System.Drawing.Point(346, 17); + this.DTPEndDate.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); + this.DTPEndDate.Name = "DTPEndDate"; + this.DTPEndDate.Size = new System.Drawing.Size(130, 23); + this.DTPEndDate.TabIndex = 23; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label5.Location = new System.Drawing.Point(457, 52); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(23, 20); + this.label5.TabIndex = 14; + this.label5.Text = "分"; + // + // DTPBeginDate + // + this.DTPBeginDate.Location = new System.Drawing.Point(81, 17); + this.DTPBeginDate.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); + this.DTPBeginDate.Name = "DTPBeginDate"; + this.DTPBeginDate.Size = new System.Drawing.Size(130, 23); + this.DTPBeginDate.TabIndex = 24; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label4.Location = new System.Drawing.Point(386, 52); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(23, 20); + this.label4.TabIndex = 16; + this.label4.Text = "时"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label8.Location = new System.Drawing.Point(194, 52); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(23, 20); + this.label8.TabIndex = 15; + this.label8.Text = "分"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label3.Location = new System.Drawing.Point(275, 52); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(79, 20); + this.label3.TabIndex = 18; + this.label3.Text = "结束时间:"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label7.Location = new System.Drawing.Point(123, 52); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(23, 20); + this.label7.TabIndex = 17; + this.label7.Text = "时"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label1.Location = new System.Drawing.Point(275, 17); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(79, 20); + this.label1.TabIndex = 21; + this.label1.Text = "结束日期:"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label9.Location = new System.Drawing.Point(211, 31); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(68, 21); + this.label9.TabIndex = 19; + this.label9.Text = "<——>"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label6.Location = new System.Drawing.Point(10, 52); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(79, 20); + this.label6.TabIndex = 20; + this.label6.Text = "起始时间:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label2.Location = new System.Drawing.Point(10, 18); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(79, 20); + this.label2.TabIndex = 22; + this.label2.Text = "起始日期:"; + // + // txtNumber + // + this.txtNumber.Location = new System.Drawing.Point(527, 16); + this.txtNumber.Name = "txtNumber"; + this.txtNumber.Size = new System.Drawing.Size(147, 23); + this.txtNumber.TabIndex = 29; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label10.Location = new System.Drawing.Point(483, 17); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(51, 20); + this.label10.TabIndex = 18; + this.label10.Text = "学号:"; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label11.Location = new System.Drawing.Point(695, 17); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(51, 20); + this.label11.TabIndex = 18; + this.label11.Text = "姓名:"; + // + // txtName + // + this.txtName.Location = new System.Drawing.Point(740, 16); + this.txtName.Name = "txtName"; + this.txtName.Size = new System.Drawing.Size(124, 23); + this.txtName.TabIndex = 29; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label12.Location = new System.Drawing.Point(482, 53); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(51, 20); + this.label12.TabIndex = 18; + this.label12.Text = "班级:"; + // + // txtClass + // + this.txtClass.Location = new System.Drawing.Point(527, 52); + this.txtClass.Name = "txtClass"; + this.txtClass.Size = new System.Drawing.Size(147, 23); + this.txtClass.TabIndex = 29; + // + // btnSelect + // + this.btnSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnSelect.Location = new System.Drawing.Point(760, 44); + this.btnSelect.Name = "btnSelect"; + this.btnSelect.Size = new System.Drawing.Size(104, 38); + this.btnSelect.TabIndex = 30; + this.btnSelect.Text = "查询"; + this.btnSelect.UseVisualStyleBackColor = true; + this.btnSelect.Click += new System.EventHandler(this.btnSelect_Click); + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.dataGridView1); + this.groupBox1.Location = new System.Drawing.Point(3, 81); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(878, 450); + this.groupBox1.TabIndex = 31; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "查询结果"; + // + // dataGridView1 + // + this.dataGridView1.AllowUserToAddRows = false; + this.dataGridView1.AllowUserToDeleteRows = false; + this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Location = new System.Drawing.Point(6, 22); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.ReadOnly = true; + this.dataGridView1.RowTemplate.Height = 23; + this.dataGridView1.Size = new System.Drawing.Size(866, 422); + this.dataGridView1.TabIndex = 0; + // + // UCReservationInfoSelect + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.btnSelect); + this.Controls.Add(this.txtClass); + this.Controls.Add(this.txtName); + this.Controls.Add(this.txtNumber); + this.Controls.Add(this.NUDEndMinute); + this.Controls.Add(this.NUDBeginMinute); + this.Controls.Add(this.NUDEndHour); + this.Controls.Add(this.NUDBeginHour); + this.Controls.Add(this.DTPEndDate); + this.Controls.Add(this.label5); + this.Controls.Add(this.DTPBeginDate); + this.Controls.Add(this.label12); + this.Controls.Add(this.label4); + this.Controls.Add(this.label11); + this.Controls.Add(this.label8); + this.Controls.Add(this.label10); + this.Controls.Add(this.label3); + this.Controls.Add(this.label7); + this.Controls.Add(this.label1); + this.Controls.Add(this.label9); + this.Controls.Add(this.label6); + this.Controls.Add(this.label2); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.Name = "UCReservationInfoSelect"; + this.Size = new System.Drawing.Size(884, 534); + ((System.ComponentModel.ISupportInitialize)(this.NUDEndMinute)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDBeginMinute)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDEndHour)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDBeginHour)).EndInit(); + this.groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.NumericUpDown NUDEndMinute; + private System.Windows.Forms.NumericUpDown NUDBeginMinute; + private System.Windows.Forms.NumericUpDown NUDEndHour; + private System.Windows.Forms.NumericUpDown NUDBeginHour; + private System.Windows.Forms.DateTimePicker DTPEndDate; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.DateTimePicker DTPBeginDate; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox txtNumber; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.TextBox txtName; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.TextBox txtClass; + private System.Windows.Forms.Button btnSelect; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.DataGridView dataGridView1; + } +} diff --git a/AuditoriumMS/UserControls/UCReservationInfoSelect.cs b/AuditoriumMS/UserControls/UCReservationInfoSelect.cs new file mode 100644 index 0000000..d0fdc4e --- /dev/null +++ b/AuditoriumMS/UserControls/UCReservationInfoSelect.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace AuditoriumMS.UserControls +{ + public partial class UCReservationInfoSelect : UserControl + { + public UCReservationInfoSelect() + { + InitializeComponent(); + } + + private void btnSelect_Click(object sender, EventArgs e) + { + DateTime BeginTime = this.DTPBeginDate.Value.Date; + BeginTime = BeginTime.AddHours((double)this.NUDBeginHour.Value); + BeginTime = BeginTime.AddMinutes((double)this.NUDBeginMinute.Value); + DateTime EndTime = this.DTPEndDate.Value.Date; + EndTime = EndTime.AddHours((double)this.NUDEndHour.Value); + EndTime = EndTime.AddMinutes((double)this.NUDEndMinute.Value); + + string name = this.txtName.Text; + string Class = this.txtClass.Text; + string number = this.txtNumber.Text; + if (Access.IsHasSQLInject(name) || Access.IsHasSQLInject(Class) || Access.IsHasSQLInject(number)) + { + MessageBox.Show("请勿输入敏感词!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + if (!string.IsNullOrEmpty(number)) + { + try + { + number = string.Format("[学号] = {0}", int.Parse(number)); + } + catch + { + MessageBox.Show("请输入正确的学号", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + else + number = "1=1"; + if (!string.IsNullOrEmpty(Class)) + Class = string.Format("[班级名称] = '{0}'", Class); + else + Class = "1=1"; + if (!string.IsNullOrEmpty(name)) + name = string.Format("[姓名] = '{0}'", name); + else + name = "1=1"; + + string sql = string.Format("SELECT s.*,t.[购票时间],t.[类型] FROM " + + "(SELECT * FROM [学生表] WHERE {0} AND {1} AND {2})s " + + "INNER JOIN " + + "(SELECT * FROM " + + "(SELECT * FROM [礼堂表] WHERE [票价] = 0 AND [开始时间] Between #{3}# AND #{4}#) a " + + "INNER JOIN [票务表] t ON a.ID = t.礼堂ID) t" + + " ON s.[学号] = t.[购买者ID]", + number, name, Class, BeginTime, EndTime); + try + { + this.dataGridView1.DataSource = Access.obj.GetDataTable(sql); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/AuditoriumMS/UserControls/UCReservationInfoSelect.resx b/AuditoriumMS/UserControls/UCReservationInfoSelect.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AuditoriumMS/UserControls/UCReservationInfoSelect.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AuditoriumMS/UserControls/UCSeatMap.Designer.cs b/AuditoriumMS/UserControls/UCSeatMap.Designer.cs new file mode 100644 index 0000000..36f1f86 --- /dev/null +++ b/AuditoriumMS/UserControls/UCSeatMap.Designer.cs @@ -0,0 +1,62 @@ +namespace AuditoriumMS.UserControls +{ + partial class UCSeatMap + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.FLPMap = new System.Windows.Forms.FlowLayoutPanel(); + this.SuspendLayout(); + // + // FLPMap + // + this.FLPMap.AutoScroll = true; + this.FLPMap.BackColor = System.Drawing.Color.White; + this.FLPMap.Dock = System.Windows.Forms.DockStyle.Fill; + this.FLPMap.Location = new System.Drawing.Point(0, 0); + this.FLPMap.Margin = new System.Windows.Forms.Padding(0); + this.FLPMap.Name = "FLPMap"; + this.FLPMap.Size = new System.Drawing.Size(400, 300); + this.FLPMap.TabIndex = 0; + // + // UCSeatMap + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.FLPMap); + this.MinimumSize = new System.Drawing.Size(200, 100); + this.Name = "UCSeatMap"; + this.Size = new System.Drawing.Size(400, 300); + this.Load += new System.EventHandler(this.UCSeatMap_Load); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.FlowLayoutPanel FLPMap; + } +} diff --git a/AuditoriumMS/UserControls/UCSeatMap.cs b/AuditoriumMS/UserControls/UCSeatMap.cs new file mode 100644 index 0000000..c1c32b2 --- /dev/null +++ b/AuditoriumMS/UserControls/UCSeatMap.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace AuditoriumMS.UserControls +{ + public partial class UCSeatMap : UserControl + { + public UCSeatMap() + { + InitializeComponent(); + + } + /// + /// 是否已经初始化 + /// + private bool isInit = false; + private void InitializerSeatMap() + { + System.Threading.Thread t = new System.Threading.Thread(() => + { + this.Invoke(new Action(() => { FLPMap.SuspendLayout(); })); + Label lblSeat = new Label(); + for (int row = 1; row <= Program.AuditoriumSeatRowsCount; ++row) + { + for (int col = 1; col <= Program.AuditoriumSeatColumnsCount; ++col) + { + lblSeat = new Label(); + lblSeat.Text = string.Format("{0:00}-{1:00}", row, col); + lblSeat.Name = lblSeat.Text; + lblSeat.AutoSize = true; + lblSeat.Margin = new Padding(6); + lblSeat.Tag = new Point(row, col); + lblSeat.Cursor = Cursors.Hand; + lblSeat.Click += LblSeat_Click; + this.Invoke(new Action(() => { FLPMap.Controls.Add(lblSeat); })); + } + this.Invoke(new Action(() => { FLPMap.SetFlowBreak(lblSeat, true); })); + } + this.isInit = true; + this.Invoke(new Action(() => { FLPMap.ResumeLayout(); })); + }); + t.Start(); + } + + public delegate void SelectedEventHandler(object sender, Point point); + /// + /// 座位选中事件 + /// + public event SelectedEventHandler SelectedEvent; + // 发出座位被选中的事件 + private void LblSeat_Click(object sender, EventArgs e) + { + Label lblSeat = sender as Label; + // 如果颜色不是可以选的颜色,则直接返回 + if (lblSeat.BackColor != Color.FromArgb(0x66, 0xFF, 0xCC)) + return; + if (SelectedEvent != null) + SelectedEvent(sender, (Point)(sender as Label).Tag); + } + + /// + /// 设置座位值 + /// + /// 售出的座位 + /// 总数量 + public void SetValue(List soldList, int max) + { + while (!this.isInit) + ; // 等待初始化完毕 + FLPMap.SuspendLayout(); + for (int i = 0; i < this.FLPMap.Controls.Count; ++i) + { + Label lblSeat = FLPMap.Controls[i] as Label; + if (i < max) + { + lblSeat.Cursor = Cursors.Hand; + lblSeat.ForeColor = Color.FromArgb(0x00, 0x00, 0x00); + lblSeat.BackColor = Color.FromArgb(0x66, 0xFF, 0xCC); + } + else + { + // 如果是无法选择的座位,则取消事件 + lblSeat.Cursor = Cursors.Default; + lblSeat.ForeColor = Color.FromArgb(0x99, 0x99, 0x99); + lblSeat.BackColor = Color.FromArgb(0xcc, 0xcc, 0xcc); + } + } + + foreach (var p in soldList) + { + string name = string.Format("{0:00}-{1:00}", p.X, p.Y); + var c = FLPMap.Controls.Find(name, false); + if (c != null && c.Length > 0) + { + Label lblSeat = c[0] as Label; + // 如果是无法选择的座位,则取消事件 + lblSeat.Cursor = Cursors.Default; + lblSeat.ForeColor = Color.FromArgb(0x00, 0x00, 0x00); + lblSeat.BackColor = Color.FromArgb(0xFF, 0xCC, 0x66); + } + } + FLPMap.ResumeLayout(); + } + + public void setValue(Point point) + { + string key = string.Format("{0:00}-{1:00}", point.X, point.Y); + var c = FLPMap.Controls.Find(key, false); + if (c != null && c.Length > 0) + { + Label lblSeat = c[0] as Label; + lblSeat.ForeColor = Color.FromArgb(0x00, 0x00, 0x00); + lblSeat.BackColor = Color.FromArgb(0xFF, 0xCC, 0x66); + } + } + + private void UCSeatMap_Load(object sender, EventArgs e) + { + InitializerSeatMap(); + } + } +} diff --git a/AuditoriumMS/UserControls/UCSeatMap.resx b/AuditoriumMS/UserControls/UCSeatMap.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AuditoriumMS/UserControls/UCSeatMap.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AuditoriumMS/UserControls/UCShowChart.Designer.cs b/AuditoriumMS/UserControls/UCShowChart.Designer.cs new file mode 100644 index 0000000..68fdddd --- /dev/null +++ b/AuditoriumMS/UserControls/UCShowChart.Designer.cs @@ -0,0 +1,193 @@ +namespace AuditoriumMS.UserControls +{ + partial class UCShowChart + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.label3 = new System.Windows.Forms.Label(); + this.DTPEndDate = new System.Windows.Forms.DateTimePicker(); + this.DTPBeginDate = new System.Windows.Forms.DateTimePicker(); + this.label1 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.btnStartStatistics = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // chart1 + // + this.chart1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + chartArea1.AxisX.LabelStyle.Format = "MM-dd"; + chartArea1.AxisX.MajorGrid.Enabled = false; + chartArea1.AxisX.Title = "日期"; + chartArea1.AxisY.Title = "数量"; + chartArea1.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea1); + legend1.Name = "Legend1"; + this.chart1.Legends.Add(legend1); + this.chart1.Location = new System.Drawing.Point(6, 22); + this.chart1.Name = "chart1"; + series1.ChartArea = "ChartArea1"; + series1.Legend = "Legend1"; + series1.LegendText = "预订数量"; + series1.Name = "Series1"; + series1.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Date; + this.chart1.Series.Add(series1); + this.chart1.Size = new System.Drawing.Size(866, 393); + this.chart1.TabIndex = 0; + this.chart1.Text = "预订信息统计图"; + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.chart1); + this.groupBox1.Location = new System.Drawing.Point(3, 110); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(878, 421); + this.groupBox1.TabIndex = 1; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "图表区"; + // + // label3 + // + this.label3.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(286, 13); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(312, 31); + this.label3.TabIndex = 41; + this.label3.Text = "预订数量信息统计-图形展示"; + // + // DTPEndDate + // + this.DTPEndDate.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.DTPEndDate.Location = new System.Drawing.Point(574, 64); + this.DTPEndDate.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); + this.DTPEndDate.Name = "DTPEndDate"; + this.DTPEndDate.Size = new System.Drawing.Size(130, 23); + this.DTPEndDate.TabIndex = 39; + // + // DTPBeginDate + // + this.DTPBeginDate.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.DTPBeginDate.Location = new System.Drawing.Point(252, 64); + this.DTPBeginDate.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); + this.DTPBeginDate.Name = "DTPBeginDate"; + this.DTPBeginDate.Size = new System.Drawing.Size(130, 23); + this.DTPBeginDate.TabIndex = 40; + // + // label1 + // + this.label1.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label1.Location = new System.Drawing.Point(503, 65); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(79, 20); + this.label1.TabIndex = 37; + this.label1.Text = "结束日期:"; + // + // label9 + // + this.label9.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label9.Location = new System.Drawing.Point(412, 65); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(68, 21); + this.label9.TabIndex = 36; + this.label9.Text = "<——>"; + // + // label2 + // + this.label2.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label2.Location = new System.Drawing.Point(181, 65); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(79, 20); + this.label2.TabIndex = 38; + this.label2.Text = "起始日期:"; + // + // btnStartStatistics + // + this.btnStartStatistics.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnStartStatistics.Location = new System.Drawing.Point(774, 64); + this.btnStartStatistics.Name = "btnStartStatistics"; + this.btnStartStatistics.Size = new System.Drawing.Size(101, 40); + this.btnStartStatistics.TabIndex = 42; + this.btnStartStatistics.Text = "开始统计"; + this.btnStartStatistics.UseVisualStyleBackColor = true; + this.btnStartStatistics.Click += new System.EventHandler(this.btnStartStatistics_Click); + // + // UCShowChart + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.btnStartStatistics); + this.Controls.Add(this.label3); + this.Controls.Add(this.DTPEndDate); + this.Controls.Add(this.DTPBeginDate); + this.Controls.Add(this.label1); + this.Controls.Add(this.label9); + this.Controls.Add(this.label2); + this.Controls.Add(this.groupBox1); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.Name = "UCShowChart"; + this.Size = new System.Drawing.Size(884, 534); + ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); + this.groupBox1.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.DataVisualization.Charting.Chart chart1; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.DateTimePicker DTPEndDate; + private System.Windows.Forms.DateTimePicker DTPBeginDate; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button btnStartStatistics; + } +} diff --git a/AuditoriumMS/UserControls/UCShowChart.cs b/AuditoriumMS/UserControls/UCShowChart.cs new file mode 100644 index 0000000..98512d1 --- /dev/null +++ b/AuditoriumMS/UserControls/UCShowChart.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.Windows.Forms.DataVisualization.Charting; + +namespace AuditoriumMS.UserControls +{ + public partial class UCShowChart : UserControl + { + public UCShowChart() + { + InitializeComponent(); + } + + private void btnStartStatistics_Click(object sender, EventArgs e) + { + DateTime BeginDate = this.DTPBeginDate.Value.Date; + DateTime EndDate = this.DTPEndDate.Value.Date; + + string sql1 = string.Format("SELECT t.购票日期,a.类型,t.预订数量 FROM " + + "(SELECT LEFT([购票时间], 10) AS 购票日期,礼堂ID,COUNT(*) AS 预订数量 " + + "FROM 票务表 WHERE [购票时间] Between #{0}# AND #{1}# GROUP BY LEFT([购票时间], 10), 礼堂ID) t " + + "LEFT JOIN [礼堂表] a ON t.礼堂ID = a.ID", + BeginDate, EndDate); + try + { + DataTable dt = Access.obj.GetDataTable(sql1); + foreach (DataRow row in dt.Rows) + { + DataPoint point = new DataPoint(); + point.SetValueXY(row["购票日期"], row["预订数量"]); + point.ToolTip = row["类型"].ToString(); + this.chart1.Series[0].Points.Add(point); + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/AuditoriumMS/UserControls/UCShowChart.resx b/AuditoriumMS/UserControls/UCShowChart.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AuditoriumMS/UserControls/UCShowChart.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AuditoriumMS/UserControls/UCSummaryReport.Designer.cs b/AuditoriumMS/UserControls/UCSummaryReport.Designer.cs new file mode 100644 index 0000000..69b41f8 --- /dev/null +++ b/AuditoriumMS/UserControls/UCSummaryReport.Designer.cs @@ -0,0 +1,244 @@ +namespace AuditoriumMS.UserControls +{ + partial class UCSummaryReport + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.cmbMonth = new System.Windows.Forms.ComboBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.txtClassName = new System.Windows.Forms.TextBox(); + this.btnReport = new System.Windows.Forms.Button(); + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.dataGridView2 = new System.Windows.Forms.DataGridView(); + this.dataGridView3 = new System.Windows.Forms.DataGridView(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.tabPage2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).BeginInit(); + this.SuspendLayout(); + // + // tabControl1 + // + this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Location = new System.Drawing.Point(3, 114); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(878, 417); + this.tabControl1.TabIndex = 0; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.dataGridView2); + this.tabPage1.Location = new System.Drawing.Point(4, 26); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(870, 387); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "学生预订明细"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.dataGridView3); + this.tabPage2.Location = new System.Drawing.Point(4, 26); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(870, 387); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "活动预订情况"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // cmbMonth + // + this.cmbMonth.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbMonth.FormattingEnabled = true; + this.cmbMonth.Items.AddRange(new object[] { + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "11", + "12"}); + this.cmbMonth.Location = new System.Drawing.Point(109, 62); + this.cmbMonth.Name = "cmbMonth"; + this.cmbMonth.Size = new System.Drawing.Size(58, 25); + this.cmbMonth.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label1.Location = new System.Drawing.Point(52, 63); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(51, 20); + this.label1.TabIndex = 2; + this.label1.Text = "月份:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label2.Location = new System.Drawing.Point(24, 30); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(79, 20); + this.label2.TabIndex = 3; + this.label2.Text = "班级名称:"; + // + // txtClassName + // + this.txtClassName.Location = new System.Drawing.Point(109, 29); + this.txtClassName.Name = "txtClassName"; + this.txtClassName.Size = new System.Drawing.Size(138, 23); + this.txtClassName.TabIndex = 4; + // + // btnReport + // + this.btnReport.Location = new System.Drawing.Point(278, 27); + this.btnReport.Name = "btnReport"; + this.btnReport.Size = new System.Drawing.Size(112, 27); + this.btnReport.TabIndex = 5; + this.btnReport.Text = "输出报表"; + this.btnReport.UseVisualStyleBackColor = true; + this.btnReport.Click += new System.EventHandler(this.btnReport_Click); + // + // dataGridView1 + // + this.dataGridView1.AllowUserToAddRows = false; + this.dataGridView1.AllowUserToDeleteRows = false; + this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Location = new System.Drawing.Point(6, 22); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.ReadOnly = true; + this.dataGridView1.RowTemplate.Height = 23; + this.dataGridView1.Size = new System.Drawing.Size(443, 83); + this.dataGridView1.TabIndex = 6; + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.dataGridView1); + this.groupBox1.Location = new System.Drawing.Point(422, 3); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(455, 111); + this.groupBox1.TabIndex = 7; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "班级当月票务情况"; + // + // dataGridView2 + // + this.dataGridView2.AllowUserToAddRows = false; + this.dataGridView2.AllowUserToDeleteRows = false; + this.dataGridView2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView2.Location = new System.Drawing.Point(3, 3); + this.dataGridView2.Name = "dataGridView2"; + this.dataGridView2.ReadOnly = true; + this.dataGridView2.RowTemplate.Height = 23; + this.dataGridView2.Size = new System.Drawing.Size(864, 381); + this.dataGridView2.TabIndex = 0; + // + // dataGridView3 + // + this.dataGridView3.AllowUserToAddRows = false; + this.dataGridView3.AllowUserToDeleteRows = false; + this.dataGridView3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView3.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView3.Location = new System.Drawing.Point(3, 3); + this.dataGridView3.Name = "dataGridView3"; + this.dataGridView3.ReadOnly = true; + this.dataGridView3.RowTemplate.Height = 23; + this.dataGridView3.Size = new System.Drawing.Size(864, 381); + this.dataGridView3.TabIndex = 0; + // + // UCSummaryReport + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.btnReport); + this.Controls.Add(this.txtClassName); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.cmbMonth); + this.Controls.Add(this.tabControl1); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.Name = "UCSummaryReport"; + this.Size = new System.Drawing.Size(884, 534); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.ComboBox cmbMonth; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox txtClassName; + private System.Windows.Forms.Button btnReport; + private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.DataGridView dataGridView2; + private System.Windows.Forms.DataGridView dataGridView3; + } +} diff --git a/AuditoriumMS/UserControls/UCSummaryReport.cs b/AuditoriumMS/UserControls/UCSummaryReport.cs new file mode 100644 index 0000000..08a912e --- /dev/null +++ b/AuditoriumMS/UserControls/UCSummaryReport.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace AuditoriumMS.UserControls +{ + public partial class UCSummaryReport : UserControl + { + public UCSummaryReport() + { + InitializeComponent(); + this.cmbMonth.SelectedIndex = DateTime.Now.Month - 1; + } + + private void btnReport_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(txtClassName.Text)) + { + MessageBox.Show("请输入班级名称!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (Access.IsHasSQLInject(this.txtClassName.Text)) + { + MessageBox.Show("请输入规范字符!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + int year = DateTime.Now.Year; + int month = cmbMonth.SelectedIndex + 1; + // 如果统计的月份大于当前月,表示统计去年的 + if (month > DateTime.Now.Month) + year--; + + // 月初 + DateTime BeginDate = new DateTime(year, month, 1); + // 月末 + DateTime EndDate = new DateTime(year, month, DateTime.DaysInMonth(year, month)); + + + string sql1 = string.Format("SELECT '{0}' AS 班级名称, '{1}' AS 起始日期, '{2}' AS 终止日期, COUNT(*) AS 预订票数 FROM [票务表] " + + "WHERE [购买者ID] IN(SELECT [学号] FROM [学生表] WHERE [班级名称] = '{0}') " + + "AND [购票时间] BETWEEN #{1}# AND #{2}#", + this.txtClassName.Text, BeginDate.ToShortDateString(), EndDate.ToShortDateString()); + string sql2 = string.Format("SELECT st.学号,st.姓名,LEFT(a.开始时间,10) AS 日期,WeekDay(a.开始时间) AS 星期,Format(a.开始时间,'HH:mm') AS 时间,a.类型 FROM " + + "(SELECT * FROM " + + "(SELECT [学号],[姓名] FROM [学生表] WHERE [班级名称] = '{0}') s " + + "INNER JOIN " + + "(SELECT [礼堂ID],[购买者ID] FROM [票务表]) t " + + "ON s.学号 = t.购买者ID) st " + + "INNER JOIN " + + "(SELECT * FROM [礼堂表] WHERE [开始时间] BETWEEN #{1}# AND #{2}#) a " + + "ON st.礼堂ID = a.ID ORDER BY [学号] ASC", + this.txtClassName.Text, BeginDate.ToShortDateString(), EndDate.ToShortDateString()); + string sql3 = string.Format("SELECT LEFT(a.开始时间,10) AS 日期,WeekDay(a.开始时间) AS 星期,Format(a.开始时间,'HH:mm') AS 时间,a.类型,t.数量 FROM " + + "(SELECT [礼堂ID],COUNT(*) AS 数量 FROM [票务表] " + + "WHERE [购买者ID] IN(SELECT [学号] FROM [学生表] WHERE [班级名称] = '{0}') " + + "GROUP BY [礼堂ID]) t " + + "INNER JOIN " + + "(SELECT * FROM [礼堂表] WHERE [开始时间] BETWEEN #{1}# AND #{2}#) a " + + "ON t.礼堂ID = a.ID ORDER BY [a.开始时间] ASC", + this.txtClassName.Text, BeginDate.ToShortDateString(), EndDate.ToShortDateString()); + try + { + this.dataGridView1.DataSource = Access.obj.GetDataTable(sql1); + DataTable dt2 = Access.obj.GetDataTable(sql2); + DataTable dt3 = Access.obj.GetDataTable(sql3); + dt2.Columns.Add("序号"); + dt3.Columns.Add("序号"); + dt2.Columns["序号"].SetOrdinal(0); + dt3.Columns["序号"].SetOrdinal(0); + for (int i = 0; i < dt2.Rows.Count; ++i) + dt2.Rows[i]["序号"] = i + 1; + for (int i = 0; i < dt3.Rows.Count; ++i) + dt3.Rows[i]["序号"] = i + 1; + this.dataGridView2.DataSource = dt2; + this.dataGridView3.DataSource = dt3; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/AuditoriumMS/UserControls/UCSummaryReport.resx b/AuditoriumMS/UserControls/UCSummaryReport.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AuditoriumMS/UserControls/UCSummaryReport.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AuditoriumMS/UserControls/UCTicketCountSelect.Designer.cs b/AuditoriumMS/UserControls/UCTicketCountSelect.Designer.cs new file mode 100644 index 0000000..3ce45d6 --- /dev/null +++ b/AuditoriumMS/UserControls/UCTicketCountSelect.Designer.cs @@ -0,0 +1,85 @@ +namespace AuditoriumMS.UserControls +{ + partial class UCTicketCountSelect + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.label1 = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.SuspendLayout(); + // + // dataGridView1 + // + this.dataGridView1.AllowUserToAddRows = false; + this.dataGridView1.AllowUserToDeleteRows = false; + this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Location = new System.Drawing.Point(3, 89); + this.dataGridView1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.ReadOnly = true; + this.dataGridView1.RowTemplate.Height = 23; + this.dataGridView1.Size = new System.Drawing.Size(878, 441); + this.dataGridView1.TabIndex = 0; + // + // label1 + // + this.label1.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Bold); + this.label1.Location = new System.Drawing.Point(363, 31); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(158, 31); + this.label1.TabIndex = 1; + this.label1.Text = "票务数量信息"; + // + // UCTicketCountSelect + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label1); + this.Controls.Add(this.dataGridView1); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.Name = "UCTicketCountSelect"; + this.Size = new System.Drawing.Size(884, 534); + this.Load += new System.EventHandler(this.UCTicketCountSelect_Load); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.Label label1; + } +} diff --git a/AuditoriumMS/UserControls/UCTicketCountSelect.cs b/AuditoriumMS/UserControls/UCTicketCountSelect.cs new file mode 100644 index 0000000..94ef379 --- /dev/null +++ b/AuditoriumMS/UserControls/UCTicketCountSelect.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace AuditoriumMS.UserControls +{ + public partial class UCTicketCountSelect : UserControl + { + public UCTicketCountSelect() + { + InitializeComponent(); + } + + private void UCTicketCountSelect_Load(object sender, EventArgs e) + { + string sql = "SELECT a.*, t.购票量, a.票数-t.购票量 as 剩余票数 FROM " + + "(SELECT [礼堂ID],COUNT(*) as 购票量 FROM [票务表] GROUP BY [礼堂ID]) t" + + " RIGHT JOIN [礼堂表] a ON t.礼堂ID = a.ID"; + + try + { + this.dataGridView1.DataSource = Access.obj.GetDataTable(sql); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/AuditoriumMS/UserControls/UCTicketCountSelect.resx b/AuditoriumMS/UserControls/UCTicketCountSelect.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AuditoriumMS/UserControls/UCTicketCountSelect.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AuditoriumMS/UserControls/UCTicketCountStatistics.Designer.cs b/AuditoriumMS/UserControls/UCTicketCountStatistics.Designer.cs new file mode 100644 index 0000000..1c8f981 --- /dev/null +++ b/AuditoriumMS/UserControls/UCTicketCountStatistics.Designer.cs @@ -0,0 +1,264 @@ +namespace AuditoriumMS.UserControls +{ + partial class UCTicketCountStatistics + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.DTPEndDate = new System.Windows.Forms.DateTimePicker(); + this.DTPBeginDate = new System.Windows.Forms.DateTimePicker(); + this.label1 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.dataGridView2 = new System.Windows.Forms.DataGridView(); + this.tabPage3 = new System.Windows.Forms.TabPage(); + this.dataGridView3 = new System.Windows.Forms.DataGridView(); + this.btnStartStatistics = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.tabPage2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit(); + this.tabPage3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).BeginInit(); + this.SuspendLayout(); + // + // DTPEndDate + // + this.DTPEndDate.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.DTPEndDate.Location = new System.Drawing.Point(574, 64); + this.DTPEndDate.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); + this.DTPEndDate.Name = "DTPEndDate"; + this.DTPEndDate.Size = new System.Drawing.Size(130, 23); + this.DTPEndDate.TabIndex = 28; + // + // DTPBeginDate + // + this.DTPBeginDate.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.DTPBeginDate.Location = new System.Drawing.Point(252, 64); + this.DTPBeginDate.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); + this.DTPBeginDate.Name = "DTPBeginDate"; + this.DTPBeginDate.Size = new System.Drawing.Size(130, 23); + this.DTPBeginDate.TabIndex = 29; + // + // label1 + // + this.label1.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label1.Location = new System.Drawing.Point(503, 65); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(79, 20); + this.label1.TabIndex = 26; + this.label1.Text = "结束日期:"; + // + // label9 + // + this.label9.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label9.Location = new System.Drawing.Point(412, 65); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(68, 21); + this.label9.TabIndex = 25; + this.label9.Text = "<——>"; + // + // label2 + // + this.label2.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label2.Location = new System.Drawing.Point(181, 65); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(79, 20); + this.label2.TabIndex = 27; + this.label2.Text = "起始日期:"; + // + // tabControl1 + // + this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Controls.Add(this.tabPage3); + this.tabControl1.Location = new System.Drawing.Point(3, 96); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(878, 435); + this.tabControl1.TabIndex = 30; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.dataGridView1); + this.tabPage1.Location = new System.Drawing.Point(4, 26); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(870, 405); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "预订信息统计"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // dataGridView1 + // + this.dataGridView1.AllowUserToAddRows = false; + this.dataGridView1.AllowUserToDeleteRows = false; + this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Location = new System.Drawing.Point(6, 6); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.ReadOnly = true; + this.dataGridView1.RowTemplate.Height = 23; + this.dataGridView1.Size = new System.Drawing.Size(858, 393); + this.dataGridView1.TabIndex = 0; + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.dataGridView2); + this.tabPage2.Location = new System.Drawing.Point(4, 26); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(870, 395); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "学生预订信息统计"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // dataGridView2 + // + this.dataGridView2.AllowUserToAddRows = false; + this.dataGridView2.AllowUserToDeleteRows = false; + this.dataGridView2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView2.Location = new System.Drawing.Point(6, 6); + this.dataGridView2.Name = "dataGridView2"; + this.dataGridView2.ReadOnly = true; + this.dataGridView2.RowTemplate.Height = 23; + this.dataGridView2.Size = new System.Drawing.Size(858, 383); + this.dataGridView2.TabIndex = 1; + // + // tabPage3 + // + this.tabPage3.Controls.Add(this.dataGridView3); + this.tabPage3.Location = new System.Drawing.Point(4, 26); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Padding = new System.Windows.Forms.Padding(3); + this.tabPage3.Size = new System.Drawing.Size(870, 395); + this.tabPage3.TabIndex = 2; + this.tabPage3.Text = "班级预订信息统计"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // dataGridView3 + // + this.dataGridView3.AllowUserToAddRows = false; + this.dataGridView3.AllowUserToDeleteRows = false; + this.dataGridView3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView3.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView3.Location = new System.Drawing.Point(6, 6); + this.dataGridView3.Name = "dataGridView3"; + this.dataGridView3.ReadOnly = true; + this.dataGridView3.RowTemplate.Height = 23; + this.dataGridView3.Size = new System.Drawing.Size(858, 383); + this.dataGridView3.TabIndex = 1; + // + // btnStartStatistics + // + this.btnStartStatistics.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnStartStatistics.Location = new System.Drawing.Point(751, 37); + this.btnStartStatistics.Name = "btnStartStatistics"; + this.btnStartStatistics.Size = new System.Drawing.Size(120, 49); + this.btnStartStatistics.TabIndex = 31; + this.btnStartStatistics.Text = "开始统计"; + this.btnStartStatistics.UseVisualStyleBackColor = true; + this.btnStartStatistics.Click += new System.EventHandler(this.btnStartStatistics_Click); + // + // label3 + // + this.label3.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(339, 13); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(206, 31); + this.label3.TabIndex = 35; + this.label3.Text = "预订数量信息统计"; + // + // UCTicketCountStatistics + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label3); + this.Controls.Add(this.btnStartStatistics); + this.Controls.Add(this.tabControl1); + this.Controls.Add(this.DTPEndDate); + this.Controls.Add(this.DTPBeginDate); + this.Controls.Add(this.label1); + this.Controls.Add(this.label9); + this.Controls.Add(this.label2); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.Name = "UCTicketCountStatistics"; + this.Size = new System.Drawing.Size(884, 534); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.tabPage2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit(); + this.tabPage3.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.DateTimePicker DTPEndDate; + private System.Windows.Forms.DateTimePicker DTPBeginDate; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.DataGridView dataGridView2; + private System.Windows.Forms.TabPage tabPage3; + private System.Windows.Forms.DataGridView dataGridView3; + private System.Windows.Forms.Button btnStartStatistics; + private System.Windows.Forms.Label label3; + } +} diff --git a/AuditoriumMS/UserControls/UCTicketCountStatistics.cs b/AuditoriumMS/UserControls/UCTicketCountStatistics.cs new file mode 100644 index 0000000..1c1f611 --- /dev/null +++ b/AuditoriumMS/UserControls/UCTicketCountStatistics.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace AuditoriumMS.UserControls +{ + public partial class UCTicketCountStatistics : UserControl + { + public UCTicketCountStatistics() + { + InitializeComponent(); + } + + private void btnStartStatistics_Click(object sender, EventArgs e) + { + DateTime BeginDate = this.DTPBeginDate.Value.Date; + DateTime EndDate = this.DTPEndDate.Value.Date; + + string sql1 = string.Format("SELECT t.购票日期,a.类型,t.预订数量 FROM " + + "(SELECT LEFT([购票时间], 10) AS 购票日期,礼堂ID,COUNT(*) AS 预订数量 " + + "FROM 票务表 WHERE [购票时间] Between #{0}# AND #{1}# GROUP BY LEFT([购票时间], 10), 礼堂ID) t " + + "LEFT JOIN [礼堂表] a ON t.礼堂ID = a.ID", + BeginDate, EndDate); + string sql2 = string.Format("SELECT s.*,t.预订数量 FROM " + + "(SELECT [购买者ID],count(*) AS 预订数量 FROM 票务表 WHERE [购票时间] Between #{0}# AND #{1}# AND [购买者ID] <> 0 " + + "GROUP BY [购买者ID]) t " + + "LEFT JOIN [学生表] s ON t.购买者ID = s.学号", + BeginDate, EndDate); + string sql3 = string.Format("SELECT s.班级名称,SUM(t.预订数量) AS 总预订数量 FROM " + + "(SELECT [购买者ID],count(*) AS 预订数量 FROM 票务表 WHERE [购票时间] Between #{0}# AND #{1}# AND [购买者ID] <> 0 " + + "GROUP BY [购买者ID]) t " + + "LEFT JOIN [学生表] s ON t.购买者ID = s.学号 " + + "GROUP BY s.班级名称", + BeginDate, EndDate); + try + { + this.dataGridView1.DataSource = Access.obj.GetDataTable(sql1); + this.dataGridView2.DataSource = Access.obj.GetDataTable(sql2); + this.dataGridView3.DataSource = Access.obj.GetDataTable(sql3); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/AuditoriumMS/UserControls/UCTicketCountStatistics.resx b/AuditoriumMS/UserControls/UCTicketCountStatistics.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AuditoriumMS/UserControls/UCTicketCountStatistics.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AuditoriumMS/UserControls/UCTicketSelect.Designer.cs b/AuditoriumMS/UserControls/UCTicketSelect.Designer.cs new file mode 100644 index 0000000..2858cff --- /dev/null +++ b/AuditoriumMS/UserControls/UCTicketSelect.Designer.cs @@ -0,0 +1,353 @@ +namespace AuditoriumMS.UserControls +{ + partial class UCTicketSelect + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.NUDBeginMinute = new System.Windows.Forms.NumericUpDown(); + this.NUDBeginHour = new System.Windows.Forms.NumericUpDown(); + this.DTPBeginDate = new System.Windows.Forms.DateTimePicker(); + this.label8 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.DTPEndDate = new System.Windows.Forms.DateTimePicker(); + this.NUDEndHour = new System.Windows.Forms.NumericUpDown(); + this.NUDEndMinute = new System.Windows.Forms.NumericUpDown(); + this.label9 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.btnSelect = new System.Windows.Forms.Button(); + this.label10 = new System.Windows.Forms.Label(); + this.cmbType = new System.Windows.Forms.ComboBox(); + ((System.ComponentModel.ISupportInitialize)(this.NUDBeginMinute)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDBeginHour)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDEndHour)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDEndMinute)).BeginInit(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.SuspendLayout(); + // + // NUDBeginMinute + // + this.NUDBeginMinute.Location = new System.Drawing.Point(205, 66); + this.NUDBeginMinute.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.NUDBeginMinute.Maximum = new decimal(new int[] { + 60, + 0, + 0, + 0}); + this.NUDBeginMinute.Name = "NUDBeginMinute"; + this.NUDBeginMinute.Size = new System.Drawing.Size(62, 23); + this.NUDBeginMinute.TabIndex = 12; + // + // NUDBeginHour + // + this.NUDBeginHour.Location = new System.Drawing.Point(98, 66); + this.NUDBeginHour.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.NUDBeginHour.Maximum = new decimal(new int[] { + 24, + 0, + 0, + 0}); + this.NUDBeginHour.Name = "NUDBeginHour"; + this.NUDBeginHour.Size = new System.Drawing.Size(62, 23); + this.NUDBeginHour.TabIndex = 13; + this.NUDBeginHour.Value = new decimal(new int[] { + 14, + 0, + 0, + 0}); + // + // DTPBeginDate + // + this.DTPBeginDate.Location = new System.Drawing.Point(97, 22); + this.DTPBeginDate.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); + this.DTPBeginDate.Name = "DTPBeginDate"; + this.DTPBeginDate.Size = new System.Drawing.Size(209, 23); + this.DTPBeginDate.TabIndex = 11; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label8.Location = new System.Drawing.Point(274, 66); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(26, 21); + this.label8.TabIndex = 7; + this.label8.Text = "分"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label7.Location = new System.Drawing.Point(167, 66); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(26, 21); + this.label7.TabIndex = 8; + this.label7.Text = "时"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label6.Location = new System.Drawing.Point(12, 66); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(90, 21); + this.label6.TabIndex = 9; + this.label6.Text = "起始时间:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label2.Location = new System.Drawing.Point(12, 23); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(90, 21); + this.label2.TabIndex = 10; + this.label2.Text = "起始日期:"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label1.Location = new System.Drawing.Point(386, 23); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(90, 21); + this.label1.TabIndex = 10; + this.label1.Text = "结束日期:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label3.Location = new System.Drawing.Point(386, 66); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(90, 21); + this.label3.TabIndex = 9; + this.label3.Text = "结束时间:"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label4.Location = new System.Drawing.Point(543, 67); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(26, 21); + this.label4.TabIndex = 8; + this.label4.Text = "时"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label5.Location = new System.Drawing.Point(651, 67); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(26, 21); + this.label5.TabIndex = 7; + this.label5.Text = "分"; + // + // DTPEndDate + // + this.DTPEndDate.Location = new System.Drawing.Point(473, 23); + this.DTPEndDate.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); + this.DTPEndDate.Name = "DTPEndDate"; + this.DTPEndDate.Size = new System.Drawing.Size(209, 23); + this.DTPEndDate.TabIndex = 11; + // + // NUDEndHour + // + this.NUDEndHour.Location = new System.Drawing.Point(474, 67); + this.NUDEndHour.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.NUDEndHour.Maximum = new decimal(new int[] { + 24, + 0, + 0, + 0}); + this.NUDEndHour.Name = "NUDEndHour"; + this.NUDEndHour.Size = new System.Drawing.Size(62, 23); + this.NUDEndHour.TabIndex = 13; + this.NUDEndHour.Value = new decimal(new int[] { + 14, + 0, + 0, + 0}); + // + // NUDEndMinute + // + this.NUDEndMinute.Location = new System.Drawing.Point(582, 67); + this.NUDEndMinute.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.NUDEndMinute.Maximum = new decimal(new int[] { + 60, + 0, + 0, + 0}); + this.NUDEndMinute.Name = "NUDEndMinute"; + this.NUDEndMinute.Size = new System.Drawing.Size(62, 23); + this.NUDEndMinute.TabIndex = 12; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label9.Location = new System.Drawing.Point(312, 45); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(68, 21); + this.label9.TabIndex = 9; + this.label9.Text = "<——>"; + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.dataGridView1); + this.groupBox1.Location = new System.Drawing.Point(3, 98); + this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.groupBox1.Size = new System.Drawing.Size(878, 432); + this.groupBox1.TabIndex = 14; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "查询结果"; + // + // dataGridView1 + // + this.dataGridView1.AllowUserToAddRows = false; + this.dataGridView1.AllowUserToDeleteRows = false; + this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Location = new System.Drawing.Point(6, 23); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.ReadOnly = true; + this.dataGridView1.RowTemplate.Height = 23; + this.dataGridView1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.dataGridView1.Size = new System.Drawing.Size(866, 402); + this.dataGridView1.TabIndex = 0; + // + // btnSelect + // + this.btnSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnSelect.Location = new System.Drawing.Point(710, 61); + this.btnSelect.Name = "btnSelect"; + this.btnSelect.Size = new System.Drawing.Size(167, 36); + this.btnSelect.TabIndex = 15; + this.btnSelect.Text = "查询"; + this.btnSelect.UseVisualStyleBackColor = true; + this.btnSelect.Click += new System.EventHandler(this.btnSelect_Click); + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label10.Location = new System.Drawing.Point(706, 22); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(51, 20); + this.label10.TabIndex = 10; + this.label10.Text = "类型:"; + // + // cmbType + // + this.cmbType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbType.FormattingEnabled = true; + this.cmbType.Items.AddRange(new object[] { + "全部", + "讲座", + "电影"}); + this.cmbType.Location = new System.Drawing.Point(753, 21); + this.cmbType.Name = "cmbType"; + this.cmbType.Size = new System.Drawing.Size(86, 25); + this.cmbType.TabIndex = 16; + // + // UCTicketSelect + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.cmbType); + this.Controls.Add(this.btnSelect); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.NUDEndMinute); + this.Controls.Add(this.NUDBeginMinute); + this.Controls.Add(this.NUDEndHour); + this.Controls.Add(this.NUDBeginHour); + this.Controls.Add(this.DTPEndDate); + this.Controls.Add(this.label5); + this.Controls.Add(this.DTPBeginDate); + this.Controls.Add(this.label4); + this.Controls.Add(this.label8); + this.Controls.Add(this.label3); + this.Controls.Add(this.label7); + this.Controls.Add(this.label10); + this.Controls.Add(this.label1); + this.Controls.Add(this.label9); + this.Controls.Add(this.label6); + this.Controls.Add(this.label2); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.Name = "UCTicketSelect"; + this.Size = new System.Drawing.Size(884, 534); + ((System.ComponentModel.ISupportInitialize)(this.NUDBeginMinute)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDBeginHour)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDEndHour)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUDEndMinute)).EndInit(); + this.groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.NumericUpDown NUDBeginMinute; + private System.Windows.Forms.NumericUpDown NUDBeginHour; + private System.Windows.Forms.DateTimePicker DTPBeginDate; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.DateTimePicker DTPEndDate; + private System.Windows.Forms.NumericUpDown NUDEndHour; + private System.Windows.Forms.NumericUpDown NUDEndMinute; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.Button btnSelect; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.ComboBox cmbType; + } +} diff --git a/AuditoriumMS/UserControls/UCTicketSelect.cs b/AuditoriumMS/UserControls/UCTicketSelect.cs new file mode 100644 index 0000000..b9df67f --- /dev/null +++ b/AuditoriumMS/UserControls/UCTicketSelect.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace AuditoriumMS.UserControls +{ + public partial class UCTicketSelect : UserControl + { + public UCTicketSelect() + { + InitializeComponent(); + this.cmbType.SelectedIndex = 0; + } + + private void btnSelect_Click(object sender, EventArgs e) + { + DateTime BeginTime = this.DTPBeginDate.Value.Date; + BeginTime = BeginTime.AddHours((double)this.NUDBeginHour.Value); + BeginTime = BeginTime.AddMinutes((double)this.NUDBeginMinute.Value); + DateTime EndTime = this.DTPEndDate.Value.Date; + EndTime = EndTime.AddHours((double)this.NUDEndHour.Value); + EndTime = EndTime.AddMinutes((double)this.NUDEndMinute.Value); + + string selectType; + if (this.cmbType.SelectedIndex == 0) + selectType = ""; + else + selectType = string.Format("[类型] = '{0}' AND ", this.cmbType.SelectedItem as string); + string sql = string.Format("SELECT * FROM 礼堂表 WHERE {0} [开始时间] Between #{1}# AND #{2}#", + selectType, BeginTime.ToString("yyyy-MM-dd HH:mm:ss"), EndTime.ToString("yyyy-MM-dd HH:mm:ss")); + try + { + this.dataGridView1.DataSource = Access.obj.GetDataTable(sql); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/AuditoriumMS/UserControls/UCTicketSelect.resx b/AuditoriumMS/UserControls/UCTicketSelect.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AuditoriumMS/UserControls/UCTicketSelect.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AuditoriumMS/UserControls/UCTicketStatistics.Designer.cs b/AuditoriumMS/UserControls/UCTicketStatistics.Designer.cs new file mode 100644 index 0000000..cdb860a --- /dev/null +++ b/AuditoriumMS/UserControls/UCTicketStatistics.Designer.cs @@ -0,0 +1,180 @@ +namespace AuditoriumMS.UserControls +{ + partial class UCTicketStatistics + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.btnStartStatistics = new System.Windows.Forms.Button(); + this.DTPEndDate = new System.Windows.Forms.DateTimePicker(); + this.DTPBeginDate = new System.Windows.Forms.DateTimePicker(); + this.label1 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.dataGridView1); + this.groupBox1.Location = new System.Drawing.Point(3, 95); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(878, 436); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "统计结果"; + // + // dataGridView1 + // + this.dataGridView1.AllowUserToAddRows = false; + this.dataGridView1.AllowUserToDeleteRows = false; + this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Location = new System.Drawing.Point(6, 22); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.ReadOnly = true; + this.dataGridView1.RowTemplate.Height = 23; + this.dataGridView1.Size = new System.Drawing.Size(866, 408); + this.dataGridView1.TabIndex = 0; + // + // btnStartStatistics + // + this.btnStartStatistics.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnStartStatistics.Location = new System.Drawing.Point(755, 34); + this.btnStartStatistics.Name = "btnStartStatistics"; + this.btnStartStatistics.Size = new System.Drawing.Size(120, 49); + this.btnStartStatistics.TabIndex = 37; + this.btnStartStatistics.Text = "开始统计"; + this.btnStartStatistics.UseVisualStyleBackColor = true; + this.btnStartStatistics.Click += new System.EventHandler(this.btnStartStatistics_Click); + // + // DTPEndDate + // + this.DTPEndDate.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.DTPEndDate.Location = new System.Drawing.Point(574, 60); + this.DTPEndDate.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); + this.DTPEndDate.Name = "DTPEndDate"; + this.DTPEndDate.Size = new System.Drawing.Size(130, 23); + this.DTPEndDate.TabIndex = 35; + // + // DTPBeginDate + // + this.DTPBeginDate.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.DTPBeginDate.Location = new System.Drawing.Point(252, 60); + this.DTPBeginDate.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); + this.DTPBeginDate.Name = "DTPBeginDate"; + this.DTPBeginDate.Size = new System.Drawing.Size(130, 23); + this.DTPBeginDate.TabIndex = 36; + // + // label1 + // + this.label1.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label1.Location = new System.Drawing.Point(503, 61); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(79, 20); + this.label1.TabIndex = 33; + this.label1.Text = "结束日期:"; + // + // label9 + // + this.label9.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("微软雅黑", 12F); + this.label9.Location = new System.Drawing.Point(412, 61); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(68, 21); + this.label9.TabIndex = 32; + this.label9.Text = "<——>"; + // + // label2 + // + this.label2.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑", 10F); + this.label2.Location = new System.Drawing.Point(181, 61); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(79, 20); + this.label2.TabIndex = 34; + this.label2.Text = "起始日期:"; + // + // label3 + // + this.label3.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(363, 9); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(158, 31); + this.label3.TabIndex = 34; + this.label3.Text = "票务信息统计"; + // + // UCTicketStatistics + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.btnStartStatistics); + this.Controls.Add(this.DTPEndDate); + this.Controls.Add(this.DTPBeginDate); + this.Controls.Add(this.label1); + this.Controls.Add(this.label9); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.groupBox1); + this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.Name = "UCTicketStatistics"; + this.Size = new System.Drawing.Size(884, 534); + this.groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.Button btnStartStatistics; + private System.Windows.Forms.DateTimePicker DTPEndDate; + private System.Windows.Forms.DateTimePicker DTPBeginDate; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + } +} diff --git a/AuditoriumMS/UserControls/UCTicketStatistics.cs b/AuditoriumMS/UserControls/UCTicketStatistics.cs new file mode 100644 index 0000000..2becb98 --- /dev/null +++ b/AuditoriumMS/UserControls/UCTicketStatistics.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace AuditoriumMS.UserControls +{ + public partial class UCTicketStatistics : UserControl + { + public UCTicketStatistics() + { + InitializeComponent(); + } + + private void btnStartStatistics_Click(object sender, EventArgs e) + { + DateTime BeginDate = this.DTPBeginDate.Value.Date; + DateTime EndDate = this.DTPEndDate.Value.Date; + + string sql = string.Format("SELECT LEFT([开始时间], 10) AS 日期,COUNT(*) AS 总场次," + + "SUM(IIF([类型] = '讲座', 1, 0)) AS 讲座场次, 总场次-讲座场次 AS 电影场次 " + + "FROM [礼堂表] " + + "WHERE [开始时间] Between #{0}# AND #{1}# GROUP BY LEFT([开始时间], 10)", + BeginDate, EndDate); + try + { + this.dataGridView1.DataSource = Access.obj.GetDataTable(sql); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/AuditoriumMS/UserControls/UCTicketStatistics.resx b/AuditoriumMS/UserControls/UCTicketStatistics.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AuditoriumMS/UserControls/UCTicketStatistics.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AuditoriumMS/bin/x86/Debug/AuditoriumMS.exe b/AuditoriumMS/bin/x86/Debug/AuditoriumMS.exe new file mode 100644 index 0000000..e069deb Binary files /dev/null and b/AuditoriumMS/bin/x86/Debug/AuditoriumMS.exe differ diff --git a/AuditoriumMS/bin/x86/Debug/AuditoriumMS.pdb b/AuditoriumMS/bin/x86/Debug/AuditoriumMS.pdb new file mode 100644 index 0000000..bdc499a Binary files /dev/null and b/AuditoriumMS/bin/x86/Debug/AuditoriumMS.pdb differ diff --git a/AuditoriumMS/bin/x86/Debug/DbTicketing.accdb b/AuditoriumMS/bin/x86/Debug/DbTicketing.accdb new file mode 100644 index 0000000..f5eddf7 Binary files /dev/null and b/AuditoriumMS/bin/x86/Debug/DbTicketing.accdb differ diff --git a/AuditoriumMS/bin/x86/Release/AuditoriumMS.exe b/AuditoriumMS/bin/x86/Release/AuditoriumMS.exe new file mode 100644 index 0000000..7e31db2 Binary files /dev/null and b/AuditoriumMS/bin/x86/Release/AuditoriumMS.exe differ diff --git a/AuditoriumMS/bin/x86/Release/AuditoriumMS.pdb b/AuditoriumMS/bin/x86/Release/AuditoriumMS.pdb new file mode 100644 index 0000000..5764798 Binary files /dev/null and b/AuditoriumMS/bin/x86/Release/AuditoriumMS.pdb differ diff --git a/AuditoriumMS/bin/x86/Release/DbTicketing.accdb b/AuditoriumMS/bin/x86/Release/DbTicketing.accdb new file mode 100644 index 0000000..196a622 Binary files /dev/null and b/AuditoriumMS/bin/x86/Release/DbTicketing.accdb differ