📄 userlist.cs
字号:
namespace PowerEasy.WebSite.Admin.User
{
using PowerEasy.Common;
using PowerEasy.Components;
using PowerEasy.Controls;
using PowerEasy.Model.UserManage;
using PowerEasy.UserManage;
using PowerEasy.Web.UI;
using System;
using System.Collections.Generic;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public class UserList : AdminPage
{
protected Button BtnSearch;
protected HtmlGenericControl DivAdd;
protected HtmlGenericControl DivUserName;
protected HtmlHead Head1;
protected int i;
protected string m_allUser;
protected string m_allUserName;
protected int m_GroupID;
protected string m_UserInput;
protected HtmlForm myform;
protected ObjectDataSource OdsUserGroupName;
protected AspNetPager Pager;
protected Repeater RepUser;
protected Repeater RptUserGroupName;
protected TextBox TxtKeyWord;
private void BindData(int userGroupId, string keyword)
{
IList<string> list = Users.GetUserNameList((this.Pager.CurrentPageIndex - 1) * this.Pager.PageSize, this.Pager.PageSize, userGroupId, keyword);
if (list.Count == 0)
{
this.DivAdd.Visible = false;
this.DivUserName.Visible = true;
}
else
{
this.DivUserName.Visible = false;
}
this.RepUser.DataSource = list;
this.Pager.RecordCount = Users.GetUserNameListTotal(userGroupId, keyword);
this.RepUser.DataBind();
}
private void CheckKeyword()
{
string str = DataSecurity.FilterBadChar(base.Request.Form["TxtKeyWord"]);
if (string.IsNullOrEmpty(str))
{
this.BindData(0, this.m_GroupID.ToString());
}
else
{
this.BindData(1, str);
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!PEContext.Current.Admin.Identity.IsAuthenticated)
{
AdminPage.WriteErrMsg("<li>对不起,您还没有登录不能访问此页面。</li>");
}
this.m_GroupID = BasePage.RequestInt32("GroupID");
if (this.m_GroupID == 0)
{
this.m_GroupID = 1;
}
this.m_UserInput = BasePage.RequestString("OpenerText");
this.Pager.PageSize = 20;
this.CheckKeyword();
}
protected void Pager_PageChanged(object src, PageChangedEventArgs e)
{
this.Pager.CurrentPageIndex = e.NewPageIndex;
this.CheckKeyword();
}
protected void RepUser_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
{
if (string.IsNullOrEmpty(this.m_allUser))
{
this.m_allUser = e.Item.DataItem.ToString();
}
else
{
this.m_allUser = this.m_allUser + "," + e.Item.DataItem.ToString();
}
}
}
protected void RepUserGroup_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
{
string str = "<a href=\"UserList.aspx?OpenerText=" + this.m_UserInput + "&GroupID=" + ((UserGroupsInfo) e.Item.DataItem).GroupId.ToString() + "\">" + ((UserGroupsInfo) e.Item.DataItem).GroupName + "</a>";
Label label = (Label) e.Item.FindControl("LblTitle");
if (this.m_GroupID == ((UserGroupsInfo) e.Item.DataItem).GroupId)
{
label.Text = "| <span style='color:#ff6600'>" + ((UserGroupsInfo) e.Item.DataItem).GroupName + "</span>";
}
else
{
label.Text = "| " + str;
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -