<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="UserDept.aspx.cs" Inherits="ServiceDesk.Admin.UserDept" %>
<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-row layui-col-space15">
             <div class="layui-col-md12">
                 <div class="layui-card">
                     <div class="layui-card-header">部门管理</div>
                     <div class="layui-card-body">

                         <div class="layui-form"  >
                           
                            
                             <div class="layui-form-item">
                                 <label class="layui-form-label req">部门名称</label>
                                 <div class="layui-input-block">
                                     <asp:TextBox class="layui-input" 
                                          ValidationGroup="add" 
                                         width="600px"
                                         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 req">排序号</label>
                                 <div class="layui-input-inline">
                                   
                                <asp:TextBox class="layui-input" ID="txt_orderid" Text="0" runat="server"></asp:TextBox>

                                 </div>

                                   <div class="layui-form-mid layui-word-aux">数字越小越靠前 支持负数</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>
             </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" />

           

             <asp:LinkButton ID="lb_update_order" runat="server" 
                            class="layui-btn layui-btn-primary "
                            onclick="lb_update_order_Click"> 
                             更新排序

                            </asp:LinkButton>  <span class="layui-word-aux">在下表的排序号里输入数字 一次性更新</span>



                       &nbsp;|&nbsp;
       <a href="###"  class="layui-btn layui-btn-pimary"
       
        onclick="Pop('UserDeptReset.aspx',500,380,'根据员工部门重置部门');return false;"
       
       >重置部门</a>


                             
      
        </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 >操作</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") %>"  name="chk_item" lay-skin="primary" >
                                      <asp:HiddenField runat="server" ID="hf_id" Value='<%#Eval("id") %>' />
                                 </td>

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

                                 </td>

                                 <td>
                                     <asp:Label ID="catnameLabel" runat="server" Text='<%# Eval("catname") %>' />
                                </td>
                                   
                                  

                                 <td>

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


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

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


                                 <td>
                                     <asp:TextBox ID="catnameTextBox" runat="server"  CssClass="layui-input  "  Text='<%# Bind("catname") %>' />
                                 </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_dept] WHERE [id] = @id"  
           SelectCommand="SELECT id,catname,orderid from users_dept     order by orderid asc    " 
           UpdateCommand="UPDATE [users_dept] SET [catname] = @catname,  orderid=@orderid   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>
