<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="UserRoles.aspx.cs" Inherits="ServiceDesk.Admin.UserRoles" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">


    


    <!-- add check item -->
       <asp:UpdatePanel runat="server" ID="pnl1"  UpdateMode="Conditional"  >
        <ContentTemplate>

     <div class="layui-fluid">
         
                 <div class="layui-card">
                     <div class="layui-card-header">角色管理</div>
                     <div class="layui-card-body">
                            
                            
                             <div class="layui-form-item">
                                 <label class="layui-form-label req">角色名称</label>
                                 <div class="layui-input-inline">
                                     <asp:TextBox class="layui-input" 
                                          ValidationGroup="add" 
                                          
                                         ID="txt_catname"   runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ValidationGroup="add" ID="RequiredFieldValidator1" runat="server" ErrorMessage="必须填写名称" ControlToValidate="txt_catname" Display="Dynamic"></asp:RequiredFieldValidator>

 
                                 </div>
                             </div>



                             <div class="layui-form-item">
                                 <label class="layui-form-label">角色说明</label>
                                 <div class="layui-input-block">
                                   
                                <asp:TextBox class="layui-input" ID="txt_roletype"    runat="server"></asp:TextBox>

                                 </div> 

                               
                             </div>

                              
                             <div class="layui-form-item">
                                 <div class="layui-input-block">
                                     <asp:Button runat="server"  class="layui-btn" ID="btn_save" ValidationGroup="add"  Text="添加" OnClick="btn_save_Click"/>
                                    
                                 </div>
                             </div>
                         </div>

                     </div>
                 </div>
          
 
            </ContentTemplate>
           </asp:UpdatePanel>
     <!-- /add check item -->






    

    <!-- list -->

     <asp:UpdatePanel runat="server" ID="pnl2"  >
        <ContentTemplate>
   
            <div class="layui-card">
                 <div class="layui-card-body">
     
      <div style="padding-bottom: 10px;">
          <asp:Button runat="server" ID="btn_del" 
               OnClientClick=" if(!isselect()) { return false;} "
               Text="批量删除" 
              class="layui-btn layui-btn-danger"
               OnClick="btn_del_Click" />
           
                             
      
        </div>


 

                     <asp:ListView runat="server" 
                         ID="lv_lists" EnableViewState="false" 
                          DataSourceID="sds" DataKeyNames="id">

                           <LayoutTemplate>
                            
                                         <table    class="layui-table"  >
                                              <thead>
                                              <tr>
                                                
                                                 <th width="60px" > 
                                                     
                                                      <input type="checkbox"   id="chk_all" lay-skin="primary"  lay-filter="chk_all" >

                                                 </th>
                                                 <th width="100px">角色名称</th>
                                                 <th width="500px" >角色说明</th>  
                                                 <th width="80px" >系统内置</th>  
                                                 <th width="180px" >角色人员查询</th>  
                                                 <th >操作</th>
                                             </tr>
                                                  </thead>
                                            
                                             
                                              <tbody>  
                                                 <tr id="itemPlaceholder" runat="server">
                                                 </tr>
                                            </tbody>
                                         </table>
                                     
                                         
                                   
                         </LayoutTemplate>
                       


                          <ItemTemplate>
                             <tr  > 
                                 
                                 <td>

                                     <input type="checkbox" class="chk_item" value="<%# Eval("id") %>" 

                                          <%#Eval("IsSystem").ToString() == "1" ? " disabled=disabled " : ""%>  
                                        
                                           name="chk_item" lay-skin="primary" >

                                      <asp:HiddenField runat="server" ID="hf_id" Value='<%#Eval("id") %>' />
                                 </td>

                                   <td>
                                        <%#Eval("rolename") %>

                                 </td>

                                 <td>
                                     <%#Eval("roletype") %>
                                </td>
                                   
                               <td>
                                    <%#Eval("IsSystem").ToString() == "1" ? "<img src=images/ok.gif >" : ""%>

                     </td>
 

        <td>

        <a  href="###" class="layui-btn layui-btn-normal layui-btn-xs"
             onclick="Pop('UserQuery.aspx?t=role&name=<%#Server.UrlEncode(Eval("rolename").ToString()) %>',900,500,'查询角色人员');return false;"   >查询角色人员

        </a>
          </td>


                                 <td>
                                      <div <%#Eval("IsSystem").ToString() == "1" ? " style='display:none'" : ""%> > 
                                   <asp:LinkButton runat="server" ID="EditButton"  CommandName="Edit"
                                        class="layui-btn layui-btn-xs"
                                       >编辑</asp:LinkButton>


                                         <asp:LinkButton runat="server" ID="DeleteButton" 
                                             
                                              OnClientClick="return confirm('确定删除吗？')"
                                              CommandName="Delete"
                                        class="layui-btn layui-btn-danger layui-btn-xs"
                                       >删除</asp:LinkButton>

                                          </div>
                                      
                                     
                                 </td>
                             </tr>
                         </ItemTemplate>
                        
                         
                         <EditItemTemplate>
                             <tr style="">
                                
                                 <td>
                                    
                                 </td>

                                   
                                 <td>
                                     <asp:TextBox ID="txt_rolename" CssClass="layui-input  " runat="server" Text='<%# Bind("rolename") %>' />
                                 </td>


                                 <td>
                                     <asp:TextBox ID="txt_roletype" runat="server"  CssClass="layui-input  "  Text='<%# Bind("roletype") %>' />
                                 </td>


                              <td>

                              </td>
                                
                            <td>

                            </td>
                               
                                 <td>
                                     <asp:LinkButton ID="UpdateButton" 
                                          class="layui-btn layui-btn-xs layui-btn-normal"

                                         runat="server" CommandName="Update" Text="更新" />
 

                                     <asp:LinkButton 
                                         
                                           class="layui-btn layui-btn-xs layui-btn-warm"
                                         ID="CancelButton" runat="server" CommandName="Cancel" Text="取消" />
                                 </td>
                             </tr>
                         </EditItemTemplate>
                         
                         


                     </asp:ListView>
                      


 








       <asp:SqlDataSource ID="sds"  
           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,  roletype=@roletype   WHERE [id] = @id" 
             >

              

       
        
    </asp:SqlDataSource>

 
     
</div>
                </div>
      
            



                


        </ContentTemplate>
    </asp:UpdatePanel>


    <!-- /list -->



     
    
    
      <script src="../layuiadmin/layui/layui.all.js"></script> 

     

    <script> 
          
        chkAll();

    </script>

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










































</asp:Content>
