📄 admin_peopleadmin.aspx
字号:
<% @ Import Namespace="Packaging" %>
<% @ Import Namespace="System.Data" %>
<% @ Import Namespace="System.Xml" %>
<% @ Register TagPrefix="pb" TagName="Header" Src="header.ascx" %>
<% @ Register TagPrefix="pb" TagName="Footer" Src="footer.ascx" %>
<% @ Register TagPrefix="pb" TagName="Login" Src="login.ascx" %>
<% @ Register TagPrefix="pb" TagName="admin" Src="admin.ascx" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Content-Language" content="zh-cn">
<title>Dot.Net管理区!</title>
<script language="JavaScript">
<!--
function openwin(url,w,h) {
window.open(url,"","top=50,left=150,height="+h+",width="+w+",toolbar=0,location=0,directories=0,menubar=0,scrollbars=0,resizable=yes,status=0");
}
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);//-->
</script>
<link rel="stylesheet" type="text/css" href="pack.css">
</head>
<body topmargin="6" leftmargin="0" bgcolor="#eaeaea">
<form id="myForm" runat="server" name="myForm">
<pb:Header id="Header" runat="server" />
<div align="center">
<table border="0" cellpadding="0" cellspacing="1" bgColor="#006699" width="750" height="125">
<tr><td width="25%" valign="top" background="images/bd.gif" rowspan="2" height="125">
<pb:admin id="admin" runat="server" />
<pb:Login id="login" runat="server" />
</td>
<td width="75%" valign="top" bgcolor="#FFFFFF" height="228" background="images/ldb.gif">
<table cellpadding=0 cellspacing=1 width="100%" border="0" align="center">
<tr height=35>
<td><b><br><font color=green>注册用户管理</font></b></td>
</tr>
</table>
<asp:Label id="mes" runat="server" /><br>
<ASP:DataGrid id="MyGrid" runat="server"
Width="100%"
Align="center"
ShowHeader="true"
ShowFooter="false"
CellPadding=3
DataKeyField="UserId"
OnItemCommand="MyGrid_Edit"
BorderColor="#00A71C"
HeaderStyle-BackColor="#99cc33"
CellSpacing="0"
AllowPaging="True"
AutoGenerateColumns="false"
PageSize="10"
PagerStyle-Mode="NumericPages"
PagerStyle-HorizontalAlign="right"
OnPageIndexChanged="changepage" >
<AlternatingItemStyle BackColor="#CCFF99" />
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<a href=# onClick="openwin('admin_coveruser.aspx?id=<%# DataBinder.Eval(Container.DataItem, "UserId") %>',100,50)">
锁定/解锁</a>
</ItemTemplate>
</asp:TemplateColumn>
<asp:HyperLinkColumn
HeaderText="用户账号"
DataNavigateUrlField="UserAccount"
DataNavigateUrlFormatString="javascript:openwin('info.aspx?name={0}',332,320)"
DataTextField="UserAccount"
DataTextFormatString="{0}"
/>
<asp:BoundColumn
HeaderText="用户最后访问时间"
DataField="UserLastAccess" />
<asp:BoundColumn
HeaderText="用户是否在线"
DataField="UserOnline" />
<asp:BoundColumn
HeaderText="用户锁定"
DataField="UserLocked" />
<asp:ButtonColumn ButtonType="LinkButton"
CommandName="resetpass"
Text="密码重置" />
</Columns>
</ASP:DataGrid>
<asp:Label id="error1" runat="server" style="color:red" /><br>
<ASP:DataGrid id="MyGrid2" runat="server"
Width="100%"
Align="center"
ShowHeader="true"
ShowFooter="false"
CellPadding=3
DataKeyField="Id"
OnEditCommand="MyGrid_Edit2"
OnCancelCommand="MyGrid_Cancel2"
OnUpdateCommand="MyGrid_Update2"
BorderColor="#00A71C"
HeaderStyle-BackColor="#99cc33"
CellSpacing="0"
AllowPaging="True"
AutoGenerateColumns="false"
PageSize="10"
PagerStyle-Mode="NumericPages"
PagerStyle-HorizontalAlign="right"
OnPageIndexChanged="changepage2" >
<AlternatingItemStyle BackColor="#CCFF99" />
<Columns>
<asp:EditCommandColumn EditText="编辑" CancelText="取消" UpdateText="更新" ItemStyle-Wrap="false"/>
<asp:HyperLinkColumn
HeaderText="用户名"
DataNavigateUrlField="Id"
DataNavigateUrlFormatString="s_personal.aspx?id={0}"
Target="_blank"
DataTextField="Name"
DataTextFormatString="{0}"
/>
<asp:BoundColumn
HeaderText="用户类型"
DataField="type" />
<asp:BoundColumn
HeaderText="用户账号"
DataField="UserAccount" />
</Columns>
</ASP:DataGrid>
<table border="0" cellpadding="0" cellspacing="1" width="90%" bgcolor="#006699">
<tr bgcolor="#99CC33">
<td width="100%" colspan="2"> 添加同事或朋友</td>
</tr>
<tr bgcolor="#CCFF99">
<td width="22%" align="center">用户名</td>
<td width="78%"> <asp:Textbox id="addName" runat=server size=20 maxlength=255 />
</td>
</tr>
<tr bgcolor="#CCFF99">
<td width="22%" align="center">类型</td>
<td width="78%"> <asp:Textbox id="addType" runat=server size=20 maxlength=255 text="1" /><br>(有三种类型设置,1-Dot.net成员,2-同事,3-其它朋友)
</td>
</tr>
<tr bgcolor="#CCFF99">
<td width="22%" align="center">用户账号</td>
<td width="78%" bgcolor="#CCFF99"> <asp:Textbox id="addAccount" runat=server size=20 maxlength=20 />
</td>
</tr>
<tr><td colspan="2" bgcolor=white>
<input type="submit" value="添加" id="addlink" onServerClick="addlink_Click"
runat=server /></td></tr>
</table>
</td>
<tr><td width="75%" valign="bottom" bgcolor="#FFFFFF" height="80" align="right" background="images/ldb.gif">
<img border="0" src="images/pen.gif" width="400" height="80"><br> </td></tr>
</table>
</div>
<pb:Footer id="footer" runat="server" />
</form>
</body>
</html>
<script language="VB" runat="server">
Dim startIndex As Integer
Sub Page_Load(Sender As Object, e As EventArgs)
If Not Request.IsAuthenticated Then
Response.Redirect("login.aspx")
End If
Dim CounterXml As String=ConfigurationSettings.AppSettings("CounterXml")
Dim objXml As XMLDocument=New XMLDocument()
objXml.Load(CounterXml)
Dim objRootSite As XMLNode
objRootSite=objXml.documentElement.SelectSingleNode("admin")
Dim j As Integer
Dim flag As Boolean=false
For j=0 To objRootSite.ChildNodes.Count-1
If objRootSite.ChildNodes.Item(j).InnerText=Context.User.Identity.Name Then
flag=true
End If
Next
If Not flag Then
Response.Redirect("admin.aspx")
End If
If Not Page.IsPostBack Then
startIndex=0
End If
If Not Page.IsPostBack Then
BindGrid
BindGrid2
End If
End Sub
Sub BindGrid()
Dim MyUser As UserDB=New UserDB()
Dim DV As DataView=MyUser.GetAllUser()
MyGrid.DataSource=DV
MyGrid.DataBind()
End Sub
Sub changepage(Sender As Object, e As DataGridPageChangedEventArgs)
startIndex=e.NewPageIndex*MyGrid.PageSize
MyGrid.CurrentPageIndex=e.NewPageIndex
BindGrid
End Sub
Sub changepage2(Sender As Object, e As DataGridPageChangedEventArgs)
startIndex=e.NewPageIndex*MyGrid2.PageSize
MyGrid2.CurrentPageIndex=e.NewPageIndex
BindGrid2
End Sub
Sub MyGrid_Edit(Sender As Object, E As DataGridCommandEventArgs)
Dim MyUser As UserDB=New UserDB()
Dim id As Integer=MyGrid.DataKeys(CInt(E.Item.ItemIndex))
Dim str As String=MyUser.ResetPass(id)
error1.Text="密码已经更改为:"+str
BindGrid
End Sub
Sub BindGrid2()
Dim MyInfo As InfoDB=New InfoDB()
Dim DV As DataView=MyInfo.GetAllInfo()
MyGrid2.DataSource=DV
MyGrid2.DataBind()
End Sub
Sub MyGrid_Edit2(Sender As Object, E As DataGridCommandEventArgs)
MyGrid2.EditItemIndex = CInt(E.Item.ItemIndex)
BindGrid2()
End Sub
Sub MyGrid_Cancel2(Sender As Object, E As DataGridCommandEventArgs)
MyGrid2.EditItemIndex = -1
BindGrid2()
End Sub
Sub MyGrid_Update2(Sender As Object, E As DataGridCommandEventArgs)
Dim CurTextBox As TextBox
CurTextBox=E.Item.Cells(2).Controls(0)
Dim type As Integer=CInt(CurTextBox.Text)
CurTextBox=E.Item.Cells(3).Controls(0)
Dim UserAccount As String=CurTextBox.Text
Dim id As Integer=MyGrid2.DataKeys(CInt(E.Item.ItemIndex))
Dim MyDB As InfoDB=New InfoDB()
MyDB.UpdateInfo(id,UserAccount,type)
MyGrid2.EditItemIndex = -1
BindGrid2()
End Sub
Sub addlink_Click(Sender As Object, e As EventArgs)
Dim MyInfo As InfoDB=New InfoDB()
If addAccount.Text.Length>0 And addName.Text.Length>0 Then
Try
MyInfo.AddNew(CInt(addType.Text), addAccount.Text, addName.Text)
addType.Text=1
addAccount.Text=""
addName.Text=""
Catch ex As Exception
error1.Text=ex.ToString()
End Try
End If
End Sub
</script>
<style>
td {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size : 10pt;
}
.whiteB {
color: white;
font-weight : bold;
}
input {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size : 10pt;
}
td.bar {
color: green; font-weight: bold;
}
a.whiteLink:link {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-weight : bold;
color : white;
text-decoration : none;
}
a.whiteLink:visited {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-weight : bold;
color : white;
text-decoration : none;
}
a.whiteLink:hover {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-weight : bold;
color : white;
text-decoration : none;
}
a.barLink:link {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
color : #CCFF99;
text-decoration : none;
}
a.barLink:visited {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
color : #CCFF99;
text-decoration : none;
}
a.barLink:hover {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
color : #CCFF99;
text-decoration : underline;
}
a.author:link {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
color : black;
text-decoration : none;
}
a.author:visited {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
color : black;
text-decoration : none;
}
a.author:hover {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
color : black;
text-decoration : underline;
}
</style>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -