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

            <table class="layui-table table2">
                <tr>
                    <th class="req">
                        角色名称
                    </th>
                    <td>

                         <asp:TextBox class="layui-input" 
                                          ValidationGroup="add"    AutoComplete="off"
                                         ID="txt_catname"   runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ValidationGroup="add" ID="RequiredFieldValidator1" runat="server" ErrorMessage="必须填写名称" ControlToValidate="txt_catname" Display="Dynamic"></asp:RequiredFieldValidator>


                    </td>

                    <th>
                        角色说明
                    </th>
                    <td>
        
                                <asp:TextBox class="layui-input" ID="txt_roletype"    runat="server"></asp:TextBox>


                    </td>
                    <td>
                           
                        
                        <asp:Button runat="server"  class="layui-btn" ID="btn_save" ValidationGroup="add"  Text="添加" OnClick="btn_save_Click"/>
                              
                          <asp:Button runat="server" ID="btn_del" 
               OnClientClick=" if(!issel()) { return false;} "
               Text="批量删除" 
              class="layui-btn layui-btn-danger"
               OnClick="btn_del_Click" />
           

                    </td>
                </tr>

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




    <hr />

    

    <!-- list -->

     <asp:UpdatePanel runat="server" ID="pnl2"  >
        <ContentTemplate>
    
      

                     <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" >
                                                         <input type="hidden" name="hf_ids" id="hf_ids" />
                                                 </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-sm"
             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-sm"
                                       >编辑</asp:LinkButton>


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

                                          </div>
                                      
                                     
                                 </td>
                             </tr>
                         </ItemTemplate>
                        
                         
                         <EditItemTemplate>
                             <tr  >
                                
                                 <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-sm layui-btn-normal" 
                                         runat="server" CommandName="Update" Text="更新" />
 

                                     <asp:LinkButton 
                                          class="layui-btn layui-btn-sm 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>

 
     
 



                


        </ContentTemplate>
    </asp:UpdatePanel>


    <!-- /list -->



     
    
      






</asp:Content>
