From 5dbaa7427c723a723e2ad772fe17eeda31b7b192 Mon Sep 17 00:00:00 2001 From: SoulStar Date: Mon, 25 Nov 2024 17:56:42 +0800 Subject: [PATCH] =?UTF-8?q?add=20-=20=E6=B7=BB=E5=8A=A0=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HighWayIot.Repository.csproj | 6 +- .../service/ISysUserInfoService.cs | 52 ------- .../service/ISysUserRoleService.cs | 45 ------ ...foServiceImpl.cs => SysUserInfoService.cs} | 33 ++++- ...leServiceImpl.cs => SysUserRoleService.cs} | 23 ++- HighWayIot.Winform/HighWayIot.Winform.csproj | 20 +-- HighWayIot.Winform/MainForm/LoginForm.cs | 5 +- HighWayIot.Winform/Program.cs | 7 +- ...rm.Designer.cs => RoleAddForm.Designer.cs} | 99 +++++++------ .../SysConfigPages/RoleAddForm.cs | 131 ++++++++++++++++++ ...erRoleUpdateForm.resx => RoleAddForm.resx} | 6 - .../SysConfigPages/RoleConfigPage.cs | 15 +- ...Designer.cs => RoleUpdateForm.Designer.cs} | 2 +- ...serRoleUpdateForm.cs => RoleUpdateForm.cs} | 8 +- ...erRoleAddForm.resx => RoleUpdateForm.resx} | 0 .../SysConfigPages/TestPage.Designer.cs | 13 ++ .../SysConfigPages/TestPage.cs | 11 ++ .../SysConfigPages/UserAddForm.cs | 4 +- .../SysConfigPages/UserConfigPage.cs | 19 ++- .../SysConfigPages/UserRoleAddForm.cs | 58 -------- .../SysConfigPages/UserUpDateForm.cs | 4 +- HighWayIot/Program.cs | 1 - 22 files changed, 312 insertions(+), 250 deletions(-) delete mode 100644 HighWayIot.Repository/service/ISysUserInfoService.cs delete mode 100644 HighWayIot.Repository/service/ISysUserRoleService.cs rename HighWayIot.Repository/service/{Impl/BaseSysUserInfoServiceImpl.cs => SysUserInfoService.cs} (72%) rename HighWayIot.Repository/service/{Impl/BaseSysUserRoleServiceImpl.cs => SysUserRoleService.cs} (72%) rename HighWayIot.Winform/UserControlPages/SysConfigPages/{UserRoleAddForm.Designer.cs => RoleAddForm.Designer.cs} (77%) create mode 100644 HighWayIot.Winform/UserControlPages/SysConfigPages/RoleAddForm.cs rename HighWayIot.Winform/UserControlPages/SysConfigPages/{UserRoleUpdateForm.resx => RoleAddForm.resx} (94%) rename HighWayIot.Winform/UserControlPages/SysConfigPages/{UserRoleUpdateForm.Designer.cs => RoleUpdateForm.Designer.cs} (99%) rename HighWayIot.Winform/UserControlPages/SysConfigPages/{UserRoleUpdateForm.cs => RoleUpdateForm.cs} (76%) rename HighWayIot.Winform/UserControlPages/SysConfigPages/{UserRoleAddForm.resx => RoleUpdateForm.resx} (100%) delete mode 100644 HighWayIot.Winform/UserControlPages/SysConfigPages/UserRoleAddForm.cs diff --git a/HighWayIot.Repository/HighWayIot.Repository.csproj b/HighWayIot.Repository/HighWayIot.Repository.csproj index c1e514a..e66ea67 100644 --- a/HighWayIot.Repository/HighWayIot.Repository.csproj +++ b/HighWayIot.Repository/HighWayIot.Repository.csproj @@ -63,10 +63,8 @@ - - - - + + diff --git a/HighWayIot.Repository/service/ISysUserInfoService.cs b/HighWayIot.Repository/service/ISysUserInfoService.cs deleted file mode 100644 index 7b4d0d7..0000000 --- a/HighWayIot.Repository/service/ISysUserInfoService.cs +++ /dev/null @@ -1,52 +0,0 @@ -using HighWayIot.Repository.domain; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HighWayIot.Repository.service -{ - public interface ISysUserInfoService - { - - /// - /// 条件查询所有用户列表 用户名为模糊查询 - /// - /// 用户名 - /// 用户角色 - /// 开始时间 - /// 结束时间 - /// 是否 - /// - List GetUserInfos(string userName = null, string userRole = null, DateTime? beginTime = null, DateTime? endTime = null, bool isSelectByTime = false); - - /// - /// 根据用户名查询单条用户信息 - /// - /// - /// - List GetUserInfoByUserName(string userName); - - /// - /// 添加用户信息 - /// - /// - /// - bool InsertUserInfo(SysUserEntity sysUserEntity); - - /// - /// 修改用户信息 - /// - /// - /// - bool UpdateUserInfo(SysUserEntity sysUserEntity); - - /// - /// 根据ID删除用户信息 - /// - /// - /// - bool DeleteUserInfoById(int id); - } -} diff --git a/HighWayIot.Repository/service/ISysUserRoleService.cs b/HighWayIot.Repository/service/ISysUserRoleService.cs deleted file mode 100644 index 5c3ec45..0000000 --- a/HighWayIot.Repository/service/ISysUserRoleService.cs +++ /dev/null @@ -1,45 +0,0 @@ -using HighWayIot.Repository.domain; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HighWayIot.Repository.service -{ - public interface ISysUserRoleService - { - - /// - /// 条件查询所有角色列表 - /// - /// 用户名 - /// 用户角色 - /// 开始时间 - /// 结束时间 - /// 是否 - /// - List GetRoleInfos(); - - /// - /// 添加角色信息 - /// - /// - /// - bool InsertRoleInfo(SysRoleEntity sysRoleEntity); - - /// - /// 修改角色信息 - /// - /// - /// - bool UpdateRoleInfo(SysRoleEntity sysRoleEntity); - - /// - /// 根据ID删除角色信息 - /// - /// - /// - bool DeleteRoleInfoById(int id); - } -} diff --git a/HighWayIot.Repository/service/Impl/BaseSysUserInfoServiceImpl.cs b/HighWayIot.Repository/service/SysUserInfoService.cs similarity index 72% rename from HighWayIot.Repository/service/Impl/BaseSysUserInfoServiceImpl.cs rename to HighWayIot.Repository/service/SysUserInfoService.cs index 996fd45..8ee6312 100644 --- a/HighWayIot.Repository/service/Impl/BaseSysUserInfoServiceImpl.cs +++ b/HighWayIot.Repository/service/SysUserInfoService.cs @@ -7,13 +7,22 @@ using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; -namespace HighWayIot.Repository.service.Impl +namespace HighWayIot.Repository.service { - public class BaseSysUserInfoServiceImpl : ISysUserInfoService + public class SysUserInfoService { private LogHelper log = LogHelper.Instance; Repository _repository => new Repository("sqlserver"); + /// + /// 条件查询所有用户列表 用户名为模糊查询 + /// + /// 用户名 + /// 用户角色 + /// 开始时间 + /// 结束时间 + /// 是否 + /// public List GetUserInfos(string userName = null, string userRole = null, DateTime? beginTime = null, DateTime? endTime = null, bool isSelectByTime = false) { try @@ -44,6 +53,11 @@ namespace HighWayIot.Repository.service.Impl } } + /// + /// 添加用户信息 + /// + /// + /// public bool InsertUserInfo(SysUserEntity sysUserEntity) { try @@ -57,6 +71,11 @@ namespace HighWayIot.Repository.service.Impl } } + /// + /// 修改用户信息 + /// + /// + /// public bool UpdateUserInfo(SysUserEntity sysUserEntity) { try @@ -70,6 +89,11 @@ namespace HighWayIot.Repository.service.Impl } } + /// + /// 根据ID删除用户信息 + /// + /// + /// public bool DeleteUserInfoById(int id) { try @@ -85,6 +109,11 @@ namespace HighWayIot.Repository.service.Impl } } + /// + /// 根据用户名查询单条用户信息 + /// + /// + /// public List GetUserInfoByUserName(string userName) { try diff --git a/HighWayIot.Repository/service/Impl/BaseSysUserRoleServiceImpl.cs b/HighWayIot.Repository/service/SysUserRoleService.cs similarity index 72% rename from HighWayIot.Repository/service/Impl/BaseSysUserRoleServiceImpl.cs rename to HighWayIot.Repository/service/SysUserRoleService.cs index 6d931d5..f30c2ef 100644 --- a/HighWayIot.Repository/service/Impl/BaseSysUserRoleServiceImpl.cs +++ b/HighWayIot.Repository/service/SysUserRoleService.cs @@ -7,13 +7,17 @@ using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; -namespace HighWayIot.Repository.service.Impl +namespace HighWayIot.Repository.service { - public class BaseSysUserRoleServiceImpl : ISysUserRoleService + public class SysUserRoleService { private LogHelper log = LogHelper.Instance; Repository _repository => new Repository("sqlserver"); + /// + /// 查询所有角色列表 + /// + /// public List GetRoleInfos() { try @@ -30,6 +34,11 @@ namespace HighWayIot.Repository.service.Impl } } + /// + /// 添加角色信息 + /// + /// + /// public bool InsertRoleInfo(SysRoleEntity sysRoleEntity) { try @@ -43,6 +52,11 @@ namespace HighWayIot.Repository.service.Impl } } + /// + /// 修改角色信息 + /// + /// + /// public bool UpdateRoleInfo(SysRoleEntity sysRoleEntity) { try @@ -56,6 +70,11 @@ namespace HighWayIot.Repository.service.Impl } } + /// + /// 根据ID删除角色信息 + /// + /// + /// public bool DeleteRoleInfoById(int id) { try diff --git a/HighWayIot.Winform/HighWayIot.Winform.csproj b/HighWayIot.Winform/HighWayIot.Winform.csproj index bfa4b43..116ad8b 100644 --- a/HighWayIot.Winform/HighWayIot.Winform.csproj +++ b/HighWayIot.Winform/HighWayIot.Winform.csproj @@ -94,17 +94,17 @@ TestPage.cs - + Form - - UserRoleUpdateForm.cs + + RoleUpdateForm.cs - + Form - - UserRoleAddForm.cs + + RoleAddForm.cs Form @@ -155,11 +155,11 @@ TestPage.cs - - UserRoleUpdateForm.cs + + RoleUpdateForm.cs - - UserRoleAddForm.cs + + RoleAddForm.cs UserAddForm.cs diff --git a/HighWayIot.Winform/MainForm/LoginForm.cs b/HighWayIot.Winform/MainForm/LoginForm.cs index 02b7dc9..c15ca34 100644 --- a/HighWayIot.Winform/MainForm/LoginForm.cs +++ b/HighWayIot.Winform/MainForm/LoginForm.cs @@ -1,6 +1,5 @@ using HighWayIot.Repository.domain; using HighWayIot.Repository.service; -using HighWayIot.Repository.service.Impl; using System; using System.Collections.Generic; using System.ComponentModel; @@ -15,7 +14,7 @@ namespace HighWayIot.Winform.MainForm { public partial class LoginForm : Form { - ISysUserInfoService sysUserInfoService = new BaseSysUserInfoServiceImpl(); + SysUserInfoService sysUserInfoService = new SysUserInfoService(); public LoginForm() { @@ -34,6 +33,8 @@ namespace HighWayIot.Winform.MainForm if (lists.Count == 1 && lists.First().Password == PassText.Text) { + lists.First().LastLoginTime = DateTime.Now; + sysUserInfoService.UpdateUserInfo(lists.First()); DialogResult = DialogResult.OK; this.Close(); } diff --git a/HighWayIot.Winform/Program.cs b/HighWayIot.Winform/Program.cs index f4db8b7..da013bf 100644 --- a/HighWayIot.Winform/Program.cs +++ b/HighWayIot.Winform/Program.cs @@ -23,12 +23,13 @@ namespace HighWayIot.Winform /// /// 应用程序的主入口点。 /// - [STAThread] + [STAThread] static void Main() { +#if DEBUG AllocConsole();//调用系统API,调用控制台窗口 Console.OutputEncoding = System.Text.Encoding.UTF8; - +#endif // 设置控制台编码为系统默认编码(解决乱码问题) Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); @@ -41,7 +42,9 @@ namespace HighWayIot.Winform logger.Info("登陆成功"); Application.Run(new BaseForm()); } +#if DEBUG FreeConsole();//释放控制台 +#endif } } } diff --git a/HighWayIot.Winform/UserControlPages/SysConfigPages/UserRoleAddForm.Designer.cs b/HighWayIot.Winform/UserControlPages/SysConfigPages/RoleAddForm.Designer.cs similarity index 77% rename from HighWayIot.Winform/UserControlPages/SysConfigPages/UserRoleAddForm.Designer.cs rename to HighWayIot.Winform/UserControlPages/SysConfigPages/RoleAddForm.Designer.cs index 4c4befe..e6bb325 100644 --- a/HighWayIot.Winform/UserControlPages/SysConfigPages/UserRoleAddForm.Designer.cs +++ b/HighWayIot.Winform/UserControlPages/SysConfigPages/RoleAddForm.Designer.cs @@ -1,6 +1,6 @@ namespace HighWayIot.Winform.UserControlPages.SysConfigPages { - partial class UserRoleAddForm + partial class RoleAddForm { /// /// Required designer variable. @@ -34,16 +34,16 @@ this.ConfrimAddButton = new System.Windows.Forms.Button(); this.panel1 = new System.Windows.Forms.Panel(); this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.panel2 = new System.Windows.Forms.Panel(); - this.dataGridView1 = new System.Windows.Forms.DataGridView(); - this.SelectAll = new System.Windows.Forms.Button(); this.SelectNone = new System.Windows.Forms.Button(); + this.SelectAll = new System.Windows.Forms.Button(); + this.panel2 = new System.Windows.Forms.Panel(); + this.RolesDataGridView = new System.Windows.Forms.DataGridView(); this.TableName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.IsUseable = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.panel1.SuspendLayout(); this.groupBox1.SuspendLayout(); this.panel2.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.RolesDataGridView)).BeginInit(); this.SuspendLayout(); // // label1 @@ -83,11 +83,12 @@ // // panel1 // + this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.panel1.Controls.Add(this.ConfrimAddButton); this.panel1.Controls.Add(this.label2); this.panel1.Controls.Add(this.UserNameTextBox); this.panel1.Controls.Add(this.label1); - this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(398, 66); @@ -95,10 +96,12 @@ // // 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.SelectNone); this.groupBox1.Controls.Add(this.SelectAll); this.groupBox1.Controls.Add(this.panel2); - this.groupBox1.Dock = System.Windows.Forms.DockStyle.Bottom; this.groupBox1.Location = new System.Drawing.Point(0, 72); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(398, 593); @@ -106,39 +109,6 @@ this.groupBox1.TabStop = false; this.groupBox1.Text = "权限设置"; // - // panel2 - // - this.panel2.Controls.Add(this.dataGridView1); - this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom; - this.panel2.Location = new System.Drawing.Point(3, 49); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(392, 541); - this.panel2.TabIndex = 0; - // - // dataGridView1 - // - this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.TableName, - this.IsUseable}); - this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; - this.dataGridView1.Location = new System.Drawing.Point(0, 0); - this.dataGridView1.Name = "dataGridView1"; - this.dataGridView1.RowHeadersVisible = false; - this.dataGridView1.RowTemplate.Height = 23; - this.dataGridView1.Size = new System.Drawing.Size(392, 541); - this.dataGridView1.TabIndex = 0; - // - // SelectAll - // - this.SelectAll.Location = new System.Drawing.Point(12, 20); - this.SelectAll.Name = "SelectAll"; - this.SelectAll.Size = new System.Drawing.Size(52, 23); - this.SelectAll.TabIndex = 1; - this.SelectAll.Text = "全选"; - this.SelectAll.UseVisualStyleBackColor = true; - this.SelectAll.Click += new System.EventHandler(this.SelectAll_Click); - // // SelectNone // this.SelectNone.Location = new System.Drawing.Point(70, 20); @@ -149,35 +119,76 @@ this.SelectNone.UseVisualStyleBackColor = true; this.SelectNone.Click += new System.EventHandler(this.SelectNone_Click); // + // SelectAll + // + this.SelectAll.Location = new System.Drawing.Point(12, 20); + this.SelectAll.Name = "SelectAll"; + this.SelectAll.Size = new System.Drawing.Size(52, 23); + this.SelectAll.TabIndex = 1; + this.SelectAll.Text = "全选"; + this.SelectAll.UseVisualStyleBackColor = true; + this.SelectAll.Click += new System.EventHandler(this.SelectAll_Click); + // + // panel2 + // + this.panel2.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.panel2.Controls.Add(this.RolesDataGridView); + this.panel2.Location = new System.Drawing.Point(3, 49); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(392, 541); + this.panel2.TabIndex = 0; + // + // RolesDataGridView + // + this.RolesDataGridView.AllowUserToAddRows = false; + this.RolesDataGridView.AllowUserToDeleteRows = false; + this.RolesDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.RolesDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.TableName, + this.IsUseable}); + this.RolesDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; + this.RolesDataGridView.Location = new System.Drawing.Point(0, 0); + this.RolesDataGridView.Name = "RolesDataGridView"; + this.RolesDataGridView.ReadOnly = true; + this.RolesDataGridView.RowHeadersVisible = false; + this.RolesDataGridView.RowTemplate.Height = 23; + this.RolesDataGridView.Size = new System.Drawing.Size(392, 541); + this.RolesDataGridView.TabIndex = 0; + // // TableName // this.TableName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.TableName.DataPropertyName = "TableName"; this.TableName.HeaderText = "页面名称"; this.TableName.Name = "TableName"; + this.TableName.ReadOnly = true; // // IsUseable // + this.IsUseable.DataPropertyName = "IsUseable"; this.IsUseable.HeaderText = "是否有权限"; this.IsUseable.Name = "IsUseable"; this.IsUseable.Resizable = System.Windows.Forms.DataGridViewTriState.True; this.IsUseable.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; this.IsUseable.Width = 90; // - // UserRoleAddForm + // RoleAddForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(398, 665); this.Controls.Add(this.groupBox1); this.Controls.Add(this.panel1); - this.Name = "UserRoleAddForm"; + this.Name = "RoleAddForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "添加角色"; this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.groupBox1.ResumeLayout(false); this.panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.RolesDataGridView)).EndInit(); this.ResumeLayout(false); } @@ -193,7 +204,7 @@ private System.Windows.Forms.Button SelectNone; private System.Windows.Forms.Button SelectAll; private System.Windows.Forms.Panel panel2; - private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.DataGridView RolesDataGridView; private System.Windows.Forms.DataGridViewTextBoxColumn TableName; private System.Windows.Forms.DataGridViewCheckBoxColumn IsUseable; } diff --git a/HighWayIot.Winform/UserControlPages/SysConfigPages/RoleAddForm.cs b/HighWayIot.Winform/UserControlPages/SysConfigPages/RoleAddForm.cs new file mode 100644 index 0000000..34a7512 --- /dev/null +++ b/HighWayIot.Winform/UserControlPages/SysConfigPages/RoleAddForm.cs @@ -0,0 +1,131 @@ +using HighWayIot.Repository.domain; +using HighWayIot.Repository.service; +using HighWayIot.Winform.Business; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace HighWayIot.Winform.UserControlPages.SysConfigPages +{ + public partial class RoleAddForm : Form + { + /// + /// Sql业务类 + /// + SysUserRoleService _sysUserRoleService; + + /// + /// XML读取类 + /// + XmlUtil xmlUtil = new XmlUtil(); + + /// + /// 规则字符数组 + /// + char[] RoleChars = new char[80]; + + /// + /// 页面规则偏移量配置 + /// + List ConfigList; + + /// + /// 前端展示DataTable + /// + DataTable dt = new DataTable(); + + public RoleAddForm(SysUserRoleService sysUserRoleService) + { + InitializeComponent(); + this._sysUserRoleService = sysUserRoleService; + + Init(); + } + + private void Init() + { + RolesDataGridView.AutoGenerateColumns = false; + for (int i = 0; i < 80; i++) + { + RoleChars[i] = '0'; + } + ConfigList = xmlUtil.ConfigReader(); + + dt.Columns.Add("TableName", typeof(string)); + dt.Columns.Add("IsUseable", typeof(bool)); + + foreach (var config in ConfigList) + { + dt.Rows.Add(config.PageName, true); + } + + RolesDataGridView.DataSource = null; + RolesDataGridView.DataSource = dt; + } + + /// + /// 确认添加按钮 + /// + /// + /// + private void ConfrimAddButton_Click(object sender, EventArgs e) + { + + this.Close(); + this.Dispose(); + } + + /// + /// 全选按钮 + /// + /// + /// + private void SelectAll_Click(object sender, EventArgs e) + { + for (int i = 0; i < 80; i++) + { + RoleChars[i] = '1'; + } + GridViewRefresh(); + } + + /// + /// 取消全选按钮 + /// + /// + /// + private void SelectNone_Click(object sender, EventArgs e) + { + for (int i = 0; i < 80; i++) + { + RoleChars[i] = '0'; + } + GridViewRefresh(); + } + + /// + /// 前端页面刷新 + /// + private void GridViewRefresh() + { + dt.Rows.Clear(); + + foreach (var config in ConfigList) + { + var dr = dt.NewRow(); + dr[0] = config.PageName; + dr[1] = RoleChars[config.RoleIndex] == '1'; + dt.Rows.Add(dr); + } + + RolesDataGridView.DataSource = null; + RolesDataGridView.DataSource = dt; + } + } +} diff --git a/HighWayIot.Winform/UserControlPages/SysConfigPages/UserRoleUpdateForm.resx b/HighWayIot.Winform/UserControlPages/SysConfigPages/RoleAddForm.resx similarity index 94% rename from HighWayIot.Winform/UserControlPages/SysConfigPages/UserRoleUpdateForm.resx rename to HighWayIot.Winform/UserControlPages/SysConfigPages/RoleAddForm.resx index 19a14a1..af8c043 100644 --- a/HighWayIot.Winform/UserControlPages/SysConfigPages/UserRoleUpdateForm.resx +++ b/HighWayIot.Winform/UserControlPages/SysConfigPages/RoleAddForm.resx @@ -123,10 +123,4 @@ True - - True - - - True - \ No newline at end of file diff --git a/HighWayIot.Winform/UserControlPages/SysConfigPages/RoleConfigPage.cs b/HighWayIot.Winform/UserControlPages/SysConfigPages/RoleConfigPage.cs index 4b06bed..b6ca1c5 100644 --- a/HighWayIot.Winform/UserControlPages/SysConfigPages/RoleConfigPage.cs +++ b/HighWayIot.Winform/UserControlPages/SysConfigPages/RoleConfigPage.cs @@ -1,5 +1,6 @@ using HighWayIot.Repository.domain; using HighWayIot.Repository.service; +using HighWayIot.Winform.UserControlPages.SysConfigPages; using System; using System.Collections.Generic; using System.ComponentModel; @@ -14,7 +15,7 @@ namespace HighWayIot.Winform.UserControlPages { public partial class RoleConfigPage : UserControl { - ISysUserRoleService roleService; + SysUserRoleService roleService = new SysUserRoleService(); private List List = new List(); @@ -35,12 +36,20 @@ namespace HighWayIot.Winform.UserControlPages private void UpdateRole_Click(object sender, EventArgs e) { - + RoleUpdateForm form = new RoleUpdateForm(roleService); + form.ShowDialog(); + List = roleService.GetRoleInfos(); + RoleDataGridView.DataSource = null; + RoleDataGridView.DataSource = List; } private void AddRole_Click(object sender, EventArgs e) { - + RoleAddForm form = new RoleAddForm(roleService); + form.ShowDialog(); + List = roleService.GetRoleInfos(); + RoleDataGridView.DataSource = null; + RoleDataGridView.DataSource = List; } private void DeleteRole_Click(object sender, EventArgs e) diff --git a/HighWayIot.Winform/UserControlPages/SysConfigPages/UserRoleUpdateForm.Designer.cs b/HighWayIot.Winform/UserControlPages/SysConfigPages/RoleUpdateForm.Designer.cs similarity index 99% rename from HighWayIot.Winform/UserControlPages/SysConfigPages/UserRoleUpdateForm.Designer.cs rename to HighWayIot.Winform/UserControlPages/SysConfigPages/RoleUpdateForm.Designer.cs index de1017e..6a28c2c 100644 --- a/HighWayIot.Winform/UserControlPages/SysConfigPages/UserRoleUpdateForm.Designer.cs +++ b/HighWayIot.Winform/UserControlPages/SysConfigPages/RoleUpdateForm.Designer.cs @@ -1,6 +1,6 @@ namespace HighWayIot.Winform.UserControlPages.SysConfigPages { - partial class UserRoleUpdateForm + partial class RoleUpdateForm { /// /// Required designer variable. diff --git a/HighWayIot.Winform/UserControlPages/SysConfigPages/UserRoleUpdateForm.cs b/HighWayIot.Winform/UserControlPages/SysConfigPages/RoleUpdateForm.cs similarity index 76% rename from HighWayIot.Winform/UserControlPages/SysConfigPages/UserRoleUpdateForm.cs rename to HighWayIot.Winform/UserControlPages/SysConfigPages/RoleUpdateForm.cs index 41bace5..f65237d 100644 --- a/HighWayIot.Winform/UserControlPages/SysConfigPages/UserRoleUpdateForm.cs +++ b/HighWayIot.Winform/UserControlPages/SysConfigPages/RoleUpdateForm.cs @@ -12,14 +12,14 @@ using System.Windows.Forms; namespace HighWayIot.Winform.UserControlPages.SysConfigPages { - public partial class UserRoleUpdateForm : Form + public partial class RoleUpdateForm : Form { - ISysUserInfoService SysUserInfoService; + SysUserRoleService _sysUserRoleService; - public UserRoleUpdateForm(ISysUserInfoService sysUserInfoService) + public RoleUpdateForm(SysUserRoleService sysUserRoleService) { InitializeComponent(); - this.SysUserInfoService = sysUserInfoService; + this._sysUserRoleService = sysUserRoleService; } /// diff --git a/HighWayIot.Winform/UserControlPages/SysConfigPages/UserRoleAddForm.resx b/HighWayIot.Winform/UserControlPages/SysConfigPages/RoleUpdateForm.resx similarity index 100% rename from HighWayIot.Winform/UserControlPages/SysConfigPages/UserRoleAddForm.resx rename to HighWayIot.Winform/UserControlPages/SysConfigPages/RoleUpdateForm.resx diff --git a/HighWayIot.Winform/UserControlPages/SysConfigPages/TestPage.Designer.cs b/HighWayIot.Winform/UserControlPages/SysConfigPages/TestPage.Designer.cs index b129e24..ea70030 100644 --- a/HighWayIot.Winform/UserControlPages/SysConfigPages/TestPage.Designer.cs +++ b/HighWayIot.Winform/UserControlPages/SysConfigPages/TestPage.Designer.cs @@ -29,6 +29,7 @@ private void InitializeComponent() { this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // button1 @@ -41,11 +42,22 @@ this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // + // button2 + // + this.button2.Location = new System.Drawing.Point(218, 57); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(93, 51); + this.button2.TabIndex = 1; + this.button2.Text = "测试"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // // TestPage // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.ControlLight; + this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Name = "TestPage"; this.Size = new System.Drawing.Size(1062, 681); @@ -56,5 +68,6 @@ #endregion private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; } } diff --git a/HighWayIot.Winform/UserControlPages/SysConfigPages/TestPage.cs b/HighWayIot.Winform/UserControlPages/SysConfigPages/TestPage.cs index 34869ec..2d28516 100644 --- a/HighWayIot.Winform/UserControlPages/SysConfigPages/TestPage.cs +++ b/HighWayIot.Winform/UserControlPages/SysConfigPages/TestPage.cs @@ -24,11 +24,22 @@ namespace HighWayIot.Winform.UserControlPages.SysConfigPages XmlUtil xmlUtil = new XmlUtil(); private void button1_Click(object sender, EventArgs e) { + var list = xmlUtil.ConfigReader(); foreach (var item in list) { Console.WriteLine(item.RoleIndex + item.PageName); } } + + private void button2_Click(object sender, EventArgs e) + { + char[] chars = new char[100]; + for (int i = 0; i < 100; i++) + { + chars[i] = '0'; + } + string originalRole = new string(chars); + } } } diff --git a/HighWayIot.Winform/UserControlPages/SysConfigPages/UserAddForm.cs b/HighWayIot.Winform/UserControlPages/SysConfigPages/UserAddForm.cs index b9baa75..52198cc 100644 --- a/HighWayIot.Winform/UserControlPages/SysConfigPages/UserAddForm.cs +++ b/HighWayIot.Winform/UserControlPages/SysConfigPages/UserAddForm.cs @@ -17,9 +17,9 @@ namespace HighWayIot.Winform.UserControlPages.SysConfigPages /// /// 数据库服务类 /// - ISysUserInfoService SysUserInfoService; + SysUserInfoService SysUserInfoService; - public UserAddForm(ISysUserInfoService sysUserInfoService) + public UserAddForm(SysUserInfoService sysUserInfoService) { InitializeComponent(); this.SysUserInfoService = sysUserInfoService; diff --git a/HighWayIot.Winform/UserControlPages/SysConfigPages/UserConfigPage.cs b/HighWayIot.Winform/UserControlPages/SysConfigPages/UserConfigPage.cs index dfe8c4a..853bf99 100644 --- a/HighWayIot.Winform/UserControlPages/SysConfigPages/UserConfigPage.cs +++ b/HighWayIot.Winform/UserControlPages/SysConfigPages/UserConfigPage.cs @@ -1,6 +1,5 @@ using HighWayIot.Repository.domain; using HighWayIot.Repository.service; -using HighWayIot.Repository.service.Impl; using HighWayIot.Winform.UserControlPages.SysConfigPages; using System; using System.Collections.Generic; @@ -16,7 +15,7 @@ namespace HighWayIot.Winform.UserControlPages { public partial class UserConfigPage : UserControl { - private ISysUserInfoService SysUserInfoService = new BaseSysUserInfoServiceImpl(); + private SysUserInfoService sysUserInfoService = new SysUserInfoService(); private List List = new List(); @@ -29,7 +28,7 @@ namespace HighWayIot.Winform.UserControlPages private void Init() { UserInfoDataGridView.AutoGenerateColumns = false; - List = SysUserInfoService.GetUserInfos(); + List = sysUserInfoService.GetUserInfos(); UserInfoDataGridView.DataSource = null; UserInfoDataGridView.DataSource = List; } @@ -43,18 +42,18 @@ namespace HighWayIot.Winform.UserControlPages entity.UserName = UserInfoDataGridView.Rows[a].Cells["UserName"].Value.ToString(); entity.UserRole = UserInfoDataGridView.Rows[a].Cells["UserRole"].Value.ToString(); entity.Password = UserInfoDataGridView.Rows[a].Cells["Password"].Value.ToString(); - UserUpDateForm form = new UserUpDateForm(SysUserInfoService, entity); + UserUpDateForm form = new UserUpDateForm(sysUserInfoService, entity); form.ShowDialog(); - List = SysUserInfoService.GetUserInfos(); + List = sysUserInfoService.GetUserInfos(); UserInfoDataGridView.DataSource = null; UserInfoDataGridView.DataSource = List; } private void AddUser_Click(object sender, EventArgs e) { - UserAddForm form = new UserAddForm(SysUserInfoService); + UserAddForm form = new UserAddForm(sysUserInfoService); form.ShowDialog(); - List = SysUserInfoService.GetUserInfos(); + List = sysUserInfoService.GetUserInfos(); UserInfoDataGridView.DataSource = null; UserInfoDataGridView.DataSource = List; } @@ -67,15 +66,15 @@ namespace HighWayIot.Winform.UserControlPages } int a = UserInfoDataGridView.CurrentRow.Index; int.TryParse(UserInfoDataGridView.Rows[a].Cells["Id"].Value.ToString(), out a); - SysUserInfoService.DeleteUserInfoById(a); - List = SysUserInfoService.GetUserInfos(); + sysUserInfoService.DeleteUserInfoById(a); + List = sysUserInfoService.GetUserInfos(); UserInfoDataGridView.DataSource = null; UserInfoDataGridView.DataSource = List; } private void SelectUser_Click(object sender, EventArgs e) { - List = SysUserInfoService.GetUserInfos(SelectUserName.Text, SelectUserRole.Text, SelectUserLoginBeginTime.Value, SelectUserLoginEndTime.Value, IsCheckByLoginTime.Checked); + List = sysUserInfoService.GetUserInfos(SelectUserName.Text, SelectUserRole.Text, SelectUserLoginBeginTime.Value, SelectUserLoginEndTime.Value, IsCheckByLoginTime.Checked); UserInfoDataGridView.DataSource = null; UserInfoDataGridView.DataSource = List; } diff --git a/HighWayIot.Winform/UserControlPages/SysConfigPages/UserRoleAddForm.cs b/HighWayIot.Winform/UserControlPages/SysConfigPages/UserRoleAddForm.cs deleted file mode 100644 index 276829c..0000000 --- a/HighWayIot.Winform/UserControlPages/SysConfigPages/UserRoleAddForm.cs +++ /dev/null @@ -1,58 +0,0 @@ -using HighWayIot.Repository.domain; -using HighWayIot.Repository.service; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace HighWayIot.Winform.UserControlPages.SysConfigPages -{ - public partial class UserRoleAddForm : Form - { - ISysUserInfoService SysUserInfoService; - - public UserRoleAddForm(ISysUserInfoService sysUserInfoService) - { - InitializeComponent(); - this.SysUserInfoService = sysUserInfoService; - } - - /// - /// 确认添加按钮 - /// - /// - /// - private void ConfrimAddButton_Click(object sender, EventArgs e) - { - - - this.Close(); - this.Dispose(); - } - - /// - /// 全选按钮 - /// - /// - /// - private void SelectAll_Click(object sender, EventArgs e) - { - - } - - /// - /// 取消全选按钮 - /// - /// - /// - private void SelectNone_Click(object sender, EventArgs e) - { - - } - } -} diff --git a/HighWayIot.Winform/UserControlPages/SysConfigPages/UserUpDateForm.cs b/HighWayIot.Winform/UserControlPages/SysConfigPages/UserUpDateForm.cs index 31bbc6f..3d21084 100644 --- a/HighWayIot.Winform/UserControlPages/SysConfigPages/UserUpDateForm.cs +++ b/HighWayIot.Winform/UserControlPages/SysConfigPages/UserUpDateForm.cs @@ -14,10 +14,10 @@ namespace HighWayIot.Winform.UserControlPages.SysConfigPages { public partial class UserUpDateForm : Form { - ISysUserInfoService _userInfoService; + SysUserInfoService _userInfoService; SysUserEntity _userEntity; - public UserUpDateForm(ISysUserInfoService sysUserInfoService, SysUserEntity userEntity) + public UserUpDateForm(SysUserInfoService sysUserInfoService, SysUserEntity userEntity) { InitializeComponent(); this._userInfoService = sysUserInfoService; diff --git a/HighWayIot/Program.cs b/HighWayIot/Program.cs index 8cbf45a..112b6a2 100644 --- a/HighWayIot/Program.cs +++ b/HighWayIot/Program.cs @@ -1,6 +1,5 @@ using HighWayIot.Log4net; using HighWayIot.Repository.service; -using HighWayIot.Repository.service.Impl; using System; using System.Collections.Generic; using System.Linq;