<%@ page language="C#" masterpagefile="AdminIndexMaster.master" autoeventwireup="true" inherits="Admin_Administrator, HoWaveIMSV5.0" title="管理员管理" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"></asp:ScriptManager>
 <table class="adminheading">
   <tr>
      <th  class="user" align="left">管理员管理</th>   
      <td style="width:15%; text-align:center;">
           <asp:Image ImageUrl="~/Images/Manage/new.png" ID="AddAdmin" runat="server" CssClass="Imagebutton" ImageAlign="Middle"/>
           <br>新增
      </td>                     
   </tr>
</table>

<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" InsertMethod="AddAdmin" SelectMethod="GetAllAdmin" TypeName="AdminBLL" OnInserted="ObjectDataSource2_Inserted" >
<InsertParameters>
   <asp:Parameter Name="UserName" Type="String" />
   <asp:Parameter Name="Password" Type="String" />
   <asp:Parameter Name="Access" Type="String" />
   <asp:Parameter Name="LastLoginIP" Type="String" />
   <asp:Parameter Name="AcceptIP" Type="String" />
   <asp:Parameter Name="LastLogin" Type="DateTime" />
</InsertParameters>
</asp:ObjectDataSource>   
         <table class="adminlist" width="100%">
             <tr>
               <td style=" vertical-align:top; width:100%" >
                   <fieldset>
                      <legend>管理员管理</legend>                           
                           <asp:UpdatePanel ID="UpdatePanel2" runat="server" >
                               <ContentTemplate>
                                   <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetAllAdmin" TypeName="AdminBLL" DeleteMethod="DeleteAdmin">
                                       <DeleteParameters>
                                           <asp:Parameter Name="Admin_ID" Type="Int32" />
                                       </DeleteParameters>
                                   </asp:ObjectDataSource>
                                        <asp:GridView ID="GridView1" runat="server" Width="100%" AutoGenerateColumns="False" DataKeyNames="Admin_ID" DataSourceID="ObjectDataSource1"  EnableViewState="false">
                                            <Columns>
                                                <asp:BoundField DataField="Admin_ID" HeaderText="管理员ID" InsertVisible="False" ReadOnly="True"
                                                    SortExpression="Admin_ID"/>                               
                                                     <asp:BoundField DataField="UserName" HeaderText="管理员名" SortExpression="UserName"/>                              
                                                     <asp:BoundField DataField="Access" HeaderText="权限" SortExpression="Access"/>                              
                                                     <asp:BoundField DataField="LoginTimes" HeaderText="登录次数" SortExpression="LoginTimes"/>                                
                                                     <asp:BoundField DataField="LastLogin" HeaderText="最后登录时间" SortExpression="LastLogin"/>                               
                                                     <asp:BoundField DataField="LastLoginIP" HeaderText="最后登录IP" SortExpression="LastLoginIP"/>                               
                                                     <asp:BoundField DataField="AcceptIP" HeaderText="允许登录IP" SortExpression="AcceptIP"/>                                                      
                                                     <asp:HyperLinkField DataTextField="Admin_ID" HeaderText="操作" DataNavigateUrlFields="Admin_ID" 
                                                         DataNavigateUrlFormatString="Admin_AdminPassword.aspx?Admin_ID={0}"  DataTextFormatString="修改" />
                                                     <asp:TemplateField HeaderText="删除">                                             
                                                        <ItemTemplate>                                                
                                                           <asp:Button id="btnDelete" runat="server" OnClientClick ="return confirm('您真的要删除?')" CommandName='<%# Eval("Admin_ID") %>' Text="删除" OnCommand="DeleteAdmin"/> 
                                                       </ItemTemplate> 
                                                     </asp:TemplateField>  
                                             </Columns>
                                     <RowStyle BorderStyle="Dotted" HorizontalAlign="Center" />
                                 </asp:GridView>
                             </ContentTemplate>
                         </asp:UpdatePanel>                                    
                    </fieldset>
                </td>
             </tr>
       </table>
        <asp:Panel ID="Panel1" runat="server" CssClass="popupControl">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
               <center>
                   <asp:FormView ID="FormView2" runat="server"  DefaultMode="Insert" DataKeyNames="Admin_ID" 
                        DataSourceID="ObjectDataSource2" Width="500px">
                       <InsertItemTemplate>
                          <table class="adminlist">
                              <tr>
                                  <td style=" width:30%; text-align:left">管理员名称：</td>
                                  <td align="left">
                                      <asp:TextBox ID="AdminName" runat="server" Text='<%# Bind("UserName") %>'/>
                                      <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="请输入管理员名称" 
                                           ControlToValidate="AdminName"/>
                                  </td>
                              </tr>
                              <tr>
                                  <td style=" width:30%; text-align:left">管理员密码：</td>
                                  <td align="left">
                                     <asp:TextBox ID="Password" runat="server" Text='<%# Bind("PassWord") %>' TextMode="Password"/>
                                     <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="请输入密码" 
                                          ControlToValidate="Password"/>
                                  </td>
                              </tr>
                              <tr>
                                  <td style=" width:30%; text-align:left">重复密码：</td>
                                  <td align="left">
                                     <asp:TextBox ID="RePassword" runat="server" TextMode="Password"/>
                                      <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="两次输入密码不相同" 
                                        ControlToCompare="Password" ControlToValidate="RePassword"/>
                                  </td>
                              </tr>
                              <tr>
                                  <td style=" width:30%; text-align:left">权限：</td>
                                  <td align="left"><asp:RadioButtonList ID="RadioButtonList2" SelectedValue='<%# Bind("Access") %>' 
                                       runat="server" RepeatDirection="Horizontal" >
                                         <asp:ListItem Text="系统管理员" Value="Supper" Selected="True"></asp:ListItem> 
                                         <asp:ListItem Text="商城管理员" Value="Shop"></asp:ListItem>
                                      </asp:RadioButtonList></td>
                              </tr>
                              <tr>
                                  <td colspan="2" align="center"> 
                                     <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Insert"
                                       Text="插入"/>                          
                                     <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                                       Text="取消"/> 
                                  </td>
                              </tr>
                          </table>                          
                       </InsertItemTemplate>
                      
                   </asp:FormView>                    
                </center>
            </ContentTemplate>
           
        </asp:UpdatePanel>
    </asp:Panel>
   <ajaxToolkit:PopupControlExtender ID="PopupControlExtender1" runat="server" TargetControlID="AddAdmin" PopupControlID="Panel1" Position="Left" />       
 
    <ajaxToolkit:DropShadowExtender ID="DropShadowExtender1" runat="server" TargetControlID="Panel1" TrackPosition="true" />       
      
</asp:Content>

