add - 添加角色

master
SoulStar 7 months ago
parent 0050dadc66
commit 5dbaa7427c

@ -63,10 +63,8 @@
<Compile Include="domain\SysRoleEntity.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Repository.cs" />
<Compile Include="service\Impl\BaseSysUserRoleServiceImpl.cs" />
<Compile Include="service\ISysUserRoleService.cs" />
<Compile Include="service\ISysUserInfoService.cs" />
<Compile Include="service\Impl\BaseSysUserInfoServiceImpl.cs" />
<Compile Include="service\SysUserRoleService.cs" />
<Compile Include="service\SysUserInfoService.cs" />
<Compile Include="SqlSugarHelper.cs" />
</ItemGroup>
<ItemGroup>

@ -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
{
/// <summary>
/// 条件查询所有用户列表 用户名为模糊查询
/// </summary>
/// <param name="userName">用户名</param>
/// <param name="userRole">用户角色</param>
/// <param name="beginTime">开始时间</param>
/// <param name="endTime">结束时间</param>
/// <param name="isSelectByTime">是否</param>
/// <returns></returns>
List<SysUserEntity> GetUserInfos(string userName = null, string userRole = null, DateTime? beginTime = null, DateTime? endTime = null, bool isSelectByTime = false);
/// <summary>
/// 根据用户名查询单条用户信息
/// </summary>
/// <param name="userName"></param>
/// <returns></returns>
List<SysUserEntity> GetUserInfoByUserName(string userName);
/// <summary>
/// 添加用户信息
/// </summary>
/// <param name="sysUserEntity"></param>
/// <returns></returns>
bool InsertUserInfo(SysUserEntity sysUserEntity);
/// <summary>
/// 修改用户信息
/// </summary>
/// <param name="sysUserEntity"></param>
/// <returns></returns>
bool UpdateUserInfo(SysUserEntity sysUserEntity);
/// <summary>
/// 根据ID删除用户信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
bool DeleteUserInfoById(int id);
}
}

@ -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
{
/// <summary>
/// 条件查询所有角色列表
/// </summary>
/// <param name="userName">用户名</param>
/// <param name="userRole">用户角色</param>
/// <param name="beginTime">开始时间</param>
/// <param name="endTime">结束时间</param>
/// <param name="isSelectByTime">是否</param>
/// <returns></returns>
List<SysRoleEntity> GetRoleInfos();
/// <summary>
/// 添加角色信息
/// </summary>
/// <param name="sysRoleEntity"></param>
/// <returns></returns>
bool InsertRoleInfo(SysRoleEntity sysRoleEntity);
/// <summary>
/// 修改角色信息
/// </summary>
/// <param name="sysRoleEntity"></param>
/// <returns></returns>
bool UpdateRoleInfo(SysRoleEntity sysRoleEntity);
/// <summary>
/// 根据ID删除角色信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
bool DeleteRoleInfoById(int id);
}
}

@ -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<SysUserEntity> _repository => new Repository<SysUserEntity>("sqlserver");
/// <summary>
/// 条件查询所有用户列表 用户名为模糊查询
/// </summary>
/// <param name="userName">用户名</param>
/// <param name="userRole">用户角色</param>
/// <param name="beginTime">开始时间</param>
/// <param name="endTime">结束时间</param>
/// <param name="isSelectByTime">是否</param>
/// <returns></returns>
public List<SysUserEntity> 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
}
}
/// <summary>
/// 添加用户信息
/// </summary>
/// <param name="sysUserEntity"></param>
/// <returns></returns>
public bool InsertUserInfo(SysUserEntity sysUserEntity)
{
try
@ -57,6 +71,11 @@ namespace HighWayIot.Repository.service.Impl
}
}
/// <summary>
/// 修改用户信息
/// </summary>
/// <param name="sysUserEntity"></param>
/// <returns></returns>
public bool UpdateUserInfo(SysUserEntity sysUserEntity)
{
try
@ -70,6 +89,11 @@ namespace HighWayIot.Repository.service.Impl
}
}
/// <summary>
/// 根据ID删除用户信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public bool DeleteUserInfoById(int id)
{
try
@ -85,6 +109,11 @@ namespace HighWayIot.Repository.service.Impl
}
}
/// <summary>
/// 根据用户名查询单条用户信息
/// </summary>
/// <param name="userName"></param>
/// <returns></returns>
public List<SysUserEntity> GetUserInfoByUserName(string userName)
{
try

@ -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<SysRoleEntity> _repository => new Repository<SysRoleEntity>("sqlserver");
/// <summary>
/// 查询所有角色列表
/// </summary>
/// <returns></returns>
public List<SysRoleEntity> GetRoleInfos()
{
try
@ -30,6 +34,11 @@ namespace HighWayIot.Repository.service.Impl
}
}
/// <summary>
/// 添加角色信息
/// </summary>
/// <param name="sysRoleEntity"></param>
/// <returns></returns>
public bool InsertRoleInfo(SysRoleEntity sysRoleEntity)
{
try
@ -43,6 +52,11 @@ namespace HighWayIot.Repository.service.Impl
}
}
/// <summary>
/// 修改角色信息
/// </summary>
/// <param name="sysRoleEntity"></param>
/// <returns></returns>
public bool UpdateRoleInfo(SysRoleEntity sysRoleEntity)
{
try
@ -56,6 +70,11 @@ namespace HighWayIot.Repository.service.Impl
}
}
/// <summary>
/// 根据ID删除角色信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public bool DeleteRoleInfoById(int id)
{
try

@ -94,17 +94,17 @@
<Compile Include="UserControlPages\SysConfigPages\TestPage.Designer.cs">
<DependentUpon>TestPage.cs</DependentUpon>
</Compile>
<Compile Include="UserControlPages\SysConfigPages\UserRoleUpdateForm.cs">
<Compile Include="UserControlPages\SysConfigPages\RoleUpdateForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UserControlPages\SysConfigPages\UserRoleUpdateForm.Designer.cs">
<DependentUpon>UserRoleUpdateForm.cs</DependentUpon>
<Compile Include="UserControlPages\SysConfigPages\RoleUpdateForm.Designer.cs">
<DependentUpon>RoleUpdateForm.cs</DependentUpon>
</Compile>
<Compile Include="UserControlPages\SysConfigPages\UserRoleAddForm.cs">
<Compile Include="UserControlPages\SysConfigPages\RoleAddForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UserControlPages\SysConfigPages\UserRoleAddForm.Designer.cs">
<DependentUpon>UserRoleAddForm.cs</DependentUpon>
<Compile Include="UserControlPages\SysConfigPages\RoleAddForm.Designer.cs">
<DependentUpon>RoleAddForm.cs</DependentUpon>
</Compile>
<Compile Include="UserControlPages\SysConfigPages\UserAddForm.cs">
<SubType>Form</SubType>
@ -155,11 +155,11 @@
<EmbeddedResource Include="UserControlPages\SysConfigPages\TestPage.resx">
<DependentUpon>TestPage.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UserControlPages\SysConfigPages\UserRoleUpdateForm.resx">
<DependentUpon>UserRoleUpdateForm.cs</DependentUpon>
<EmbeddedResource Include="UserControlPages\SysConfigPages\RoleUpdateForm.resx">
<DependentUpon>RoleUpdateForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UserControlPages\SysConfigPages\UserRoleAddForm.resx">
<DependentUpon>UserRoleAddForm.cs</DependentUpon>
<EmbeddedResource Include="UserControlPages\SysConfigPages\RoleAddForm.resx">
<DependentUpon>RoleAddForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UserControlPages\SysConfigPages\UserAddForm.resx">
<DependentUpon>UserAddForm.cs</DependentUpon>

@ -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();
}

@ -26,9 +26,10 @@ namespace HighWayIot.Winform
[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
}
}
}

@ -1,6 +1,6 @@
namespace HighWayIot.Winform.UserControlPages.SysConfigPages
{
partial class UserRoleAddForm
partial class RoleAddForm
{
/// <summary>
/// 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;
}

@ -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
{
/// <summary>
/// Sql业务类
/// </summary>
SysUserRoleService _sysUserRoleService;
/// <summary>
/// XML读取类
/// </summary>
XmlUtil xmlUtil = new XmlUtil();
/// <summary>
/// 规则字符数组
/// </summary>
char[] RoleChars = new char[80];
/// <summary>
/// 页面规则偏移量配置
/// </summary>
List<RoleConfig> ConfigList;
/// <summary>
/// 前端展示DataTable
/// </summary>
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;
}
/// <summary>
/// 确认添加按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ConfrimAddButton_Click(object sender, EventArgs e)
{
this.Close();
this.Dispose();
}
/// <summary>
/// 全选按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SelectAll_Click(object sender, EventArgs e)
{
for (int i = 0; i < 80; i++)
{
RoleChars[i] = '1';
}
GridViewRefresh();
}
/// <summary>
/// 取消全选按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SelectNone_Click(object sender, EventArgs e)
{
for (int i = 0; i < 80; i++)
{
RoleChars[i] = '0';
}
GridViewRefresh();
}
/// <summary>
/// 前端页面刷新
/// </summary>
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;
}
}
}

@ -123,10 +123,4 @@
<metadata name="IsUseable.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="TableName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="IsUseable.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

@ -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<SysRoleEntity> List = new List<SysRoleEntity>();
@ -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)

@ -1,6 +1,6 @@
namespace HighWayIot.Winform.UserControlPages.SysConfigPages
{
partial class UserRoleUpdateForm
partial class RoleUpdateForm
{
/// <summary>
/// Required designer variable.

@ -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;
}
/// <summary>

@ -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;
}
}

@ -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);
}
}
}

@ -17,9 +17,9 @@ namespace HighWayIot.Winform.UserControlPages.SysConfigPages
/// <summary>
/// 数据库服务类
/// </summary>
ISysUserInfoService SysUserInfoService;
SysUserInfoService SysUserInfoService;
public UserAddForm(ISysUserInfoService sysUserInfoService)
public UserAddForm(SysUserInfoService sysUserInfoService)
{
InitializeComponent();
this.SysUserInfoService = sysUserInfoService;

@ -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<SysUserEntity> List = new List<SysUserEntity>();
@ -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;
}

@ -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;
}
/// <summary>
/// 确认添加按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ConfrimAddButton_Click(object sender, EventArgs e)
{
this.Close();
this.Dispose();
}
/// <summary>
/// 全选按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SelectAll_Click(object sender, EventArgs e)
{
}
/// <summary>
/// 取消全选按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SelectNone_Click(object sender, EventArgs e)
{
}
}
}

@ -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;

@ -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;

Loading…
Cancel
Save