You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.3 KiB
C#
101 lines
3.3 KiB
C#
using HZH_Controls.Controls;
|
|
|
|
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.Web;
|
|
using System.Windows.Forms;
|
|
using DB.Dto;
|
|
using DB.Service;
|
|
using HZH_Controls.Forms;
|
|
|
|
namespace RfidWeb.Frm
|
|
{
|
|
public partial class FormAccount : UserControl
|
|
{
|
|
private UserService userService = new UserService();
|
|
private UserDto OlduserDto;
|
|
public FormAccount()
|
|
{
|
|
InitializeComponent();
|
|
Init();
|
|
OlduserDto= UserManager.GetUser();
|
|
|
|
}
|
|
|
|
private void Init()
|
|
{
|
|
List<DataGridViewColumnEntity> lstCulumns = new List<DataGridViewColumnEntity>();
|
|
lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Id", HeadText = "编号", Width = 100, WidthType = SizeType.Absolute });
|
|
lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "UserName", HeadText = "姓名", Width = 50, WidthType = SizeType.Percent });
|
|
lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "RoleName", HeadText = "权限名称", Width = 50, WidthType = SizeType.Percent });
|
|
|
|
this.ucDataGridViewContent.Columns = lstCulumns;
|
|
this.ucDataGridViewContent.IsShowCheckBox = true;
|
|
ucPagerControl21.PageModel = PageModel.PageCount;
|
|
ucPagerControl21.PageIndex = 1;
|
|
ucPagerControl21.PageSize = 20;
|
|
|
|
}
|
|
|
|
private void ucPagerControl21_ShowSourceChanged(object currentSource)
|
|
{
|
|
string key = this.textBoxSel.Text.Trim();
|
|
var index = ucPagerControl21.PageIndex;
|
|
List<int> lsInts = new List<int>();
|
|
|
|
if (OlduserDto != null)
|
|
{
|
|
switch (OlduserDto.RoleLevel)
|
|
{
|
|
case 1:
|
|
lsInts.AddRange(new[] { 1, 2, 3 });
|
|
break;
|
|
case 2:
|
|
lsInts.AddRange(new[] { 2, 3 });
|
|
break;
|
|
case 3:
|
|
lsInts.Add(3);
|
|
break;
|
|
}
|
|
}
|
|
var page = userService.GetPagedList(index, ucPagerControl21.PageSize, key,lsInts);
|
|
ucPagerControl21.PageCount = page.TotalPages;
|
|
this.ucDataGridViewContent.DataSource = page.Items;
|
|
}
|
|
|
|
private void ucBtnSelect_BtnClick(object sender, EventArgs e)
|
|
{
|
|
ucPagerControl21_ShowSourceChanged(new object());
|
|
}
|
|
|
|
private void ucBtnAdd_BtnClick(object sender, EventArgs e)
|
|
{
|
|
var user = UserManager.GetUser();
|
|
if (user != null)
|
|
{
|
|
|
|
FormRegister formRegis = new FormRegister(user);
|
|
formRegis.StartPosition = FormStartPosition.CenterScreen; // 设置窗口显示在屏幕中央
|
|
formRegis.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
FormLogin fromLogin=new FormLogin();
|
|
fromLogin.ShowDialog();
|
|
}
|
|
}
|
|
|
|
private void ucBtnDel_BtnClick(object sender, EventArgs e)
|
|
{
|
|
var dataGridViewRows = ucDataGridViewContent.SelectRows;
|
|
var dataSource = dataGridViewRows.First().DataSource as UserDto;
|
|
}
|
|
}
|
|
}
|