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; namespace RfidWeb.Frm { public partial class FormAccount : UserControl { private UserService userService = new UserService(); private UserDto userDto = UserManager.GetUser(); public FormAccount() { InitializeComponent(); Init(); } private void Init() { List lstCulumns = new List(); lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Id", HeadText = "编号", Width = 170, 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 = false; ucPagerControl21.PageModel = PageModel.PageCount; ucPagerControl21.PageIndex = 1; ucPagerControl21.PageSize = 20; // ucPagerControl21_ShowSourceChanged(null); } private void ucPagerControl21_ShowSourceChanged(object currentSource) { string key = this.textBoxSel.Text.Trim(); var index = ucPagerControl21.PageIndex; List lsInts = new List(); if (userDto != null) { lsInts.Clear(); if (userDto.RoleLevel == 1) { lsInts.Add(1); lsInts.Add(2); lsInts.Add(3); } if (userDto.RoleLevel == 2) { lsInts.Add(2); lsInts.Add(3); } if (userDto.RoleLevel == 3) { key = userDto.UserName; lsInts.Add(3); } } 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()); } } }