<%@ page language="C#" enableeventvalidation="false" masterpagefile="AdminIndexMaster.master" autoeventwireup="true" inherits="HL_Admin_Admin_Passport, HoWaveVGO" title="通行证管理" debug="false" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"/>
<script src="Js/Function.js" type="text/javascript"></script> 
<script type="text/javascript">
 
function AddUser(ctlName,action){
  var recdata=false;
  switch (action){
      case "Add":      
      recdata=showModalDialog('Admin_AddPassport.aspx?Action=Add','','dialogWidth:500px; dialogHeight:500px; help: yes; scroll: yes; status: no');
      break;
      case "Modify":
      recdata=showModalDialog('Admin_AddPassport.aspx?Action=Modify&UserID='+document.getElementById(ctlName).value,'','dialogWidth:500px; dialogHeight:500px; help: yes; scroll: yes; status: no');      
      break;
      case "Show":
      recdata=showModalDialog('Admin_AddPassport.aspx?Action=Show&UserID='+document.getElementById(ctlName).value,'','dialogWidth:500px; dialogHeight:500px; help: yes; scroll: yes; status: no');      
      break;
      
  }
       //判断对应的返回值
      if(recdata==true)
      {
         // 刷新当前窗口
         window.location.reload();       
      } 
   
}
</script>
	  <table class="adminheading" width="100%">
         <tr>
            <th class="user" align="left" style="width: 19%">通行证管理</th>
            <td align="right">
            <div style="width:100px"><a href="javascript:void(0)" id="addNewUser" onClick="AddUser('','Add')">添加用户</a></div>
            </td>
            <td class="rtdw"></td>
         </tr>
      </table>
   
   <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>

           <table class="nick">
        <tr><td colspan="4" class="tit">快速查找</td></tr>
        <tr><td class="ltd">搜索会员:</td><td class="rtd" style="width:35%">
               <asp:TextBox ID="SearchUserTextBox" runat="server" autocomplete="off"/>                  
               <ajaxToolkit:AutoCompleteExtender runat="server" ID="autoComplete1"
                              TargetControlID="SearchUserTextBox" 
                              EnableCaching="true"
                              ServicePath="AutoCompleteService.asmx" 
                              ServiceMethod="GetWordList" 
                              minimumprefixlength="2" 
                              CompletionInterval="1000"
                              CompletionSetCount="12" />
              
                 <asp:DropDownList ID="DDL_SearchType" runat="server">
                 
                     <asp:ListItem Value="1" Text="模糊查询" />
                     <asp:ListItem Value="0" Text="精确查询" />
                 </asp:DropDownList>
                 <asp:Button ID="SearchButton" runat="server" Text="搜索" OnClick="SearchButton_Click" />
                              </td>
                              <td class="ltd">快速搜索：</td><td class="rtd" style="width:35%">
                              <asp:DropDownList ID="SelectUserType" runat="server" AutoPostBack="True" OnSelectedIndexChanged="SelectUserType_SelectedIndexChanged">
                 <asp:ListItem value="all" Text="所有会员" />
                  <asp:ListItem value="0" Text="未验证会员" /> 
                  <asp:ListItem value="1" Text="注册会员" />
                  <asp:ListItem value="2" Text="VIP会员" /> 
                  <asp:ListItem value="3" Text="商业客户" />  
                  <asp:ListItem value="4" Text="代理商" />                       
                  <asp:ListItem Value="24hourlogin" Text="最近24小时登录会员" />
                  <asp:ListItem Value="24hourreg" Text="最近24小时注册会员" />
                  <asp:ListItem Value="loginmost" Text="登录次数最多会员" />
                  <asp:ListItem Value="coinzero" Text="通行币为0的会员" />                      
                </asp:DropDownList>
                </td></tr>
          </table>
          <br />
              <asp:GridView ID="GridView1" runat="server" allowPaging="True" autoGenerateColumns="False" DataKeyNames="UserID" DataSourceID="ObjectDataSource1" OnRowDataBound="GridView1_RowDataBound" Width="100%" RowStyle-HorizontalAlign="Center" PageSize="12" CssClass="adminlist" EnableViewState="false">
                    <Columns>
                           <asp:TemplateField>
                            <ItemTemplate>                                        
                                <asp:CheckBox ID="chkSelect" runat="server"/>                                         
                            </ItemTemplate>
                            <HeaderTemplate>
                               全选<input id="chkAll" onclick="SelectAllCheckboxes(this);" runat="server" type="checkbox" />                                     
                            </HeaderTemplate>
                               <HeaderStyle Width="6%" />
                           </asp:TemplateField>                                                                 
                           <asp:BoundField DataField="UserID" HeaderText="会员ID" InsertVisible="False" ReadOnly="True"  SortExpression="UserID"/>
                           <asp:TemplateField HeaderText="会员组">
                              <ItemTemplate>
                                 <asp:Label ID="GroupName" runat="server" Text='<%# Bind("GroupName") %>' />
                              </ItemTemplate>
                           </asp:TemplateField> 
                           <asp:BoundField DataField="UserName" HeaderText="会员名" SortExpression="UserName"/>                                      
                           <asp:BoundField DataField="RegTime" HeaderText="注册时间" SortExpression="RegTime"/>                                      
                           <asp:BoundField DataField="LastLoginTime" HeaderText="最后登录" SortExpression="LastLoginTime"/> 
                           <asp:BoundField DataField="LoginTimes" HeaderText="登录次数" SortExpression="LoginTimes" >
                              <HeaderStyle Width="8%" />
                           </asp:BoundField>                                       
                           <asp:BoundField DataField="GoldCoin" HeaderText="通行币" SortExpression="GoldCoin"/> 
                           <asp:TemplateField HeaderText="状态">
                              <ItemTemplate>
                                 <asp:Label ID="labelIsLocked" runat="server" Text='<%#Bind("IsLocked") %>' />
                              </ItemTemplate>
                           </asp:TemplateField>
                           <asp:TemplateField HeaderText="操作">
                              <ItemTemplate>
                                 <a href="javascript:void(0)" id="Detail" runat="server">查看通行证</a>|
                                 <a href='<%#"Admin_UserDetail.aspx?UserID="+Eval("UserID") %>'>查看详细信息</a>
                                 <asp:HiddenField ID="HiddenUserID" runat="server" Value='<%# Eval("UserID") %>' />                                
                              </ItemTemplate>
                               <ItemStyle Width="20%"/> 
                           </asp:TemplateField>       
                       </Columns> 
                       <RowStyle HorizontalAlign="Center" />
                       <EmptyDataTemplate>
                       <tr>
				         <th width="6%">全选</th><th>会员ID</th><th>会员组</th><th scope="col">会员名</th><th scope="col">注册时间</th><th scope="col">最后登录</th><th scope="col" style="width:8%;">登录次数</th><th scope="col">通行币</th><th scope="col">状态</th><th scope="col">操作</th>
			           </tr>
			           <tr>
			             <td colspan="10">没有你所查找的记录</td>
			           </tr>
                       </EmptyDataTemplate>
              </asp:GridView>               
            
          </ContentTemplate> 
           <Triggers>                           
               <asp:AsyncPostBackTrigger ControlID="SelectUserType"  />
               <asp:AsyncPostBackTrigger ControlID="SearchButton"/>
           </Triggers>
         
       </asp:UpdatePanel>
       <div style="text-align:center">                  
          <asp:Button ID="Button2"　OnClientClick="return confirm('您确定要删除吗？此操作将删除所有跟删除通行证用户相关联的数据，并且删除后不能恢复?')"　 runat="server" Text="批量删除用户" CommandName="Delete" OnCommand="UserButtonOnCommon"/>
          <asp:Button ID="Button3" runat="server" Text="锁定用户" CommandName="Lock" OnCommand="UserButtonOnCommon"/>
          <asp:Button ID="Button4" runat="server" Text="取消锁定用户" CommandName="CancleLock" OnCommand="UserButtonOnCommon"/>
      </div>

    <!--数据控件-->
     <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
       <ProgressTemplate>
<DIV style="LEFT: 387px; TOP: 96px" class="wait"><IMG alt="稍等" src="../ims_img/wait.gif" align=middle />请稍等... </DIV>
</ProgressTemplate>
    </asp:UpdateProgress>
    &nbsp;
    <!--数据控件-->
 <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Delete"
      SelectMethod="SearchUser" TypeName="UserBLL"  OnDataBinding="ObjectDataSource1_DataBinding" OnSelecting="ObjectDataSource1_Selecting" >
     <DeleteParameters>
         <asp:Parameter Name="UserID" Type="Int32" />
     </DeleteParameters>                        
     <SelectParameters>
         <asp:ControlParameter ControlID="SearchUserTextBox" DefaultValue="" Name="UserName"  PropertyName="Text" Type="String" />
         <asp:Parameter Name="SearchType" Type="String"   DefaultValue="QuickSearch"/>
         <asp:ControlParameter ControlID="DDL_SearchType" Name="DetailSearchType" PropertyName="SelectedValue"
             Type="Int32" />
         <asp:ControlParameter ControlID="SelectUserType" Name="QuickSearchValue" PropertyName="SelectedValue"
             Type="String" />
     </SelectParameters>
</asp:ObjectDataSource>           
</asp:Content>


