<%@ Page Title="角色管理" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Users_Role.aspx.cs" Inherits="Vote.Admin.Users_Role" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">





<div class="result-wrap">
      
                <div class="result-title">
                    <div class="result-list">
                        <a href="#" id="a_addnew"><i class="icon-font"></i>新建角色</a>


                        <asp:LinkButton ID="lb_delete" 
                         OnClientClick="if(!isselect()) return false; " 
                        runat="server" onclick="lb_delete_Click"><i class="icon-font"></i>批量删除</asp:LinkButton> 
                     
 
                   <a href="#"><span id="span_help"><i class="icon-font">&#xe023;</i>说明</span></a>
                    </div>
                </div>
 




 

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


    <table class="insert-tab" width="100%">
                        <tbody> 
                            <tr>
                                <th><i class="require-red">*</i>角色名称：</th>
                                <td>
                                   
                                    <asp:TextBox class="common-text required"  ValidationGroup="Add" ID="txt_catname" Text="" Width=300px runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ValidationGroup="Add" ID="RequiredFieldValidator1" runat="server" ErrorMessage="必须填写类别" ControlToValidate="txt_catname" Display="Static"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            
                            
                            <tr>
                                <th></th>
                                <td>
                                    <asp:Button ID="btn_add" runat="server" Text="提交"  ValidationGroup="Add" 
                                        class="btn btn-primary btn6 mr10" onclick="btn_add_Click" />
 
                                    <input class="btn btn6"  id="btn_back" value="返回" type="button">
                                </td>
                            </tr>
                        </tbody></table>

  </div>












  <div class="result-content" id="thetable">
  
  
<asp:gridview  id="RoleList"   
        DataKeyNames="id" 
        CssClass="result-tab" 
        Width="100%"
        AutoGenerateColumns="False"   
        Runat="Server" 
        DataSourceID="SqlDataSource1" 
         >
 
<columns>


  <asp:TemplateField> 
        <HeaderTemplate> 
              <asp:CheckBox ID="chk_SelectedHeader" runat="server" AutoPostBack="False" onclick="selectall(this)"  /> 
         </HeaderTemplate> 
                            
         <ItemTemplate  > 

            <input type="checkbox" 
            <%#Eval("IsSystem").ToString() == "1" ? " disabled=disabled " : ""%> 
             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="rolename" ItemStyle-Width="400px"   HeaderText="角色名称" />

  <asp:TemplateField>
  <HeaderTemplate>系统内置</HeaderTemplate>
  <ItemTemplate>
  
  <%#Eval("IsSystem").ToString() == "1" ? "<img src=images/onCorrect.gif >" : ""%>
  </ItemTemplate>
  </asp:TemplateField>
 

     <asp:TemplateField>
         <HeaderTemplate>人员查询</HeaderTemplate>
         <ItemTemplate>
         <a  href="javascript:void(0);" onclick="Pop('Users_Query.aspx?t=rple&name=<%#Server.UrlEncode(Eval("rolename").ToString()) %>',850,450,'部门员工查询');return false;"   >查询</a>
         </ItemTemplate>
         <ItemStyle Width=100px />
         </asp:TemplateField>


 <asp:TemplateField>
 
 <HeaderTemplate>操作</HeaderTemplate>
 <ItemTemplate>
 <span <%#Eval("IsSystem").ToString() == "1" ? " style='display:none'" : ""%> >
 
 
 <asp:LinkButton runat="server" ID="btnEdit" CommandName="Edit" Text="编辑" ></asp:LinkButton> 

<asp:LinkButton runat="server" ID="btnDel" CommandName="Delete" Text="删除" OnClientClick="return confirm('确定要删除吗？');"></asp:LinkButton>
 </span>
 </ItemTemplate>
 
 <EditItemTemplate>
 
  <asp:LinkButton runat="server" CausesValidation="false" ID="lbUpdate" CommandName="Update" Text="更新" ></asp:LinkButton>
   <asp:LinkButton runat="server" CausesValidation="false" ID="lbCanel" CommandName="Cancel" Text="取消" ></asp:LinkButton>

 </EditItemTemplate>
 
 </asp:TemplateField>
 
  
 
 
</columns>
 </asp:gridview>












 
        <asp:SqlDataSource ID="SqlDataSource1"  
           ConnectionString='<%$ ConnectionStrings:ConnectionString %>'
           Runat="server" 
           DeleteCommand="DELETE FROM [users_roles] WHERE [id] = @id" 
         
           SelectCommand="SELECT * FROM [users_roles] order by issystem desc  " 
           UpdateCommand="UPDATE [users_roles] SET [rolename] = @rolename  WHERE [id] = @id"  >
        <DeleteParameters>
            <asp:Parameter Name="id" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="rolename" Type="String" /> 
            <asp:Parameter Name="id" Type="Int32" />
        </UpdateParameters>
       
    </asp:SqlDataSource>















</div>












 </div>





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







     <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>



      
</asp:Content>
