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

   
            <table class="layui-table table2">
            <tr>
                <th class="req">
                    部门名称
                </th>
                <td>
                       <asp:TextBox class="layui-input" 
                                          AutoComplete="off"
                                          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>


                </td>

                <th>
                    排序号
                </th>

                <td>
                       <asp:TextBox class="layui-input"  ValidationGroup="add"  ID="txt_orderid" Text="0" runat="server"></asp:TextBox>
                </td>
                
                <td>
                       <asp:Button runat="server"  class="layui-btn" ID="btn_save" ValidationGroup="add"  Text="添加" OnClick="btn_save_Click"/>
                </td>
            </tr>    
            
            </table>

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





    <hr />
    

    <!-- list -->

     <asp:UpdatePanel runat="server" ID="pnl2"  >
        <ContentTemplate>
   
          
     
      <div style="padding-bottom: 10px;">
          <asp:Button runat="server" ID="btn_del" 
               OnClientClick=" if(!issel()) { 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>  



                       &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" >
                                                     
                                                     <input type="hidden" name="hf_ids" id="hf_ids" />

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


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

 
 


                


        </ContentTemplate>
    </asp:UpdatePanel>


    <!-- /list -->



     
     
















</asp:Content>
