<%@ Page Title="投票人列表" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Vote_Users_Lists.aspx.cs" Inherits="Vote.Admin.Vote_Users_Lists" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">



<style>
    .must{ color:#ff0000}
    .txt0{ width:150px}
    .txt1{width:120px}
    .txt2{width:150px}
    .txt3{width:150px}
   
    </style>


<div class="result-wrap">
      
                <div class="result-title">
              
                        <a href="#" id="a_addnew" class="btn btn-primary">批量添加</a>

                           <a href="Vote_Users_Imports.aspx" class="btn btn-default">导入数据</a>

                        <asp:LinkButton ID="lb_delete" 
                         OnClientClick="if(!isselect()) return false; " 
                        runat="server" onclick="lb_delete_Click" CssClass="btn btn-danger">批量删除</asp:LinkButton> 
                                        
                                            &nbsp;    &nbsp;   | &nbsp;    &nbsp;
                    
                    
                       姓名 <asp:TextBox ID="txt_key" CssClass="form-control" Style="width:200px; display:inline-block" runat="server"></asp:TextBox>  
                        <asp:Button ID="btn_search" runat="server" Text="搜索"  class="btn btn-primary btn2"/>
                    

                    
                    
                    
              </div>
 


         <div id="thenew" style="display:none"   class="result-content">  

   
   <table id="Table1"  class="table"   runat="server" >
    <tr>
     <th> 登录名<span class="must">*</span> </th>
     <th > 密码<span class="must">*</span>  </th>
     <th> 部门   </th>
     <th>员工号  </th>
     
     </tr>
   </table>


   <div class="bunc">
   
    <asp:Button ID="btn_add" runat="server" Text="批量添加"    class="btn btn-primary btn6 mr10" onclick="btn_add_Click" />
    <input class="btn btn6"  id="btn_back" value="返回" type="button">
                              
   </div>

  </div>

 





  <div id="thetable" class="result-content"> 
    

      <b>说明：当投票规则选择“根据员工号可以投票(StaffCode模式)”时，可用在这里维护可用使用的投票人员列表</b>

        <br /><br />
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"    PageSize="20"
    class="table" GridLines="None" width="100%"
        AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSource1">
    <Columns>

      <asp:TemplateField> 
        <HeaderTemplate> 
              <asp:CheckBox ID="chk_SelectedHeader" runat="server" AutoPostBack="False" onclick="selectall(this)"  /> 
         </HeaderTemplate> 
                            
         <ItemTemplate  > 
            <input type="checkbox"  class="ck_item"   title=<%# Eval("id") %> value='<%# Eval("id") %>'  /> 
            <asp:HiddenField runat="server" ID="hf_id" Value=<%# Eval("id") %> /> 
          </ItemTemplate>    
          <HeaderStyle  Width=50px  CssClass="tc"/>        
          <ItemStyle  Width=50px  CssClass="tc"/>
          </asp:TemplateField>
                        
                         
        <asp:BoundField DataField="username" HeaderText="姓名" 
            SortExpression="username" />
        <asp:BoundField DataField="staffcode" HeaderText="员工号" 
            SortExpression="staffcode" />
        <asp:BoundField DataField="dept" HeaderText="部门" SortExpression="dept" />
        <asp:BoundField DataField="pwd" HeaderText="密码" SortExpression="pwd" />

         <asp:CommandField HeaderText="操作" EditText="编辑" DeleteText="<span onclick=&quot;JavaScript:return confirm('确定删除吗？')&quot;>删除</span> "  UpdateText="更新"  CancelText="取消" ShowDeleteButton="True" ShowEditButton="True" />
    </Columns>
    
     
    
    </asp:GridView>

    <br />
    <asp:SqlDataSource ID="SqlDataSource1"     
     ConnectionString='<%$ ConnectionStrings:ConnectionString %>' 
     runat="server" 
        DeleteCommand="DELETE FROM [vote_users] WHERE [id] = @id"  
        ProviderName="System.Data.SqlClient" 
        SelectCommand="SELECT * FROM [vote_users]  where   (@key='' or username like '%'+@key+'%')  ORDER BY [id] desc " 
        UpdateCommand="UPDATE [vote_users] SET [username] = @username, [staffcode] = @staffcode, [dept] = @dept, [pwd] = @pwd WHERE [id] = @id">
         
        
  <SelectParameters> 
  <asp:ControlParameter ControlID="txt_key" ConvertEmptyStringToNull="false" DefaultValue="" Name="key" />
  </SelectParameters>
  
  <DeleteParameters>
            <asp:Parameter Name="id" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="username" Type="String" />
            <asp:Parameter Name="staffcode" Type="String" />
            <asp:Parameter Name="dept" Type="String" />
            <asp:Parameter Name="pwd" Type="String" />
            <asp:Parameter Name="id" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="username" Type="String" />
            <asp:Parameter Name="staffcode" Type="String" />
            <asp:Parameter Name="dept" Type="String" />
            <asp:Parameter Name="pwd" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>



 </div>
            
       
       
       
       
       
       
       
        </div>

        










        





















    <script>


        $(document).ready(

         function () {
             $("#a_addnew").click(
             function () {
                 $("#thenew").show();
                 $("#thetable").hide();
             }
             );

             $("#btn_back").click(
             function () {
                 $("#thenew").hide();
                 $("#thetable").show();
             }
             );

         }
         );




           $('#span_help').on('click', function () {
             layer.tips('可以投票的人员名单列表，具体能否投票需要在投票列表的名单里配置', this, {time:5,
                 style: ['background-color:#0FA6D8; color:#fff', '#0FA6D8'],
                 maxWidth: 450
             });
         });

    </script>


               <input type="hidden" name="hf_ids" id="hf_ids" />


</asp:Content>
