<%@ Page Title="小类设置" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Category3.aspx.cs" Inherits="Helpdesk.Admin.Category3" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">


 
    
       <div class="result-wrap">


   <div class="result-title">
             <span class="span_help">说明</span>:设定问题Tickets的中类。<font color="red">每一个中类必须设置小类</font>
       
   </div>

 

 
              
                    <table class="table">
                        <tr>
                            <th width="150">问题大类:</th>
                            <td>
                              <asp:DropDownList ID="ddl_parentcategory" runat="server"  CssClass="form-control"  Width="300"  AutoPostBack="true"
            onselectedindexchanged="ddl_parentcategory_SelectedIndexChanged" >
        </asp:DropDownList>
                            </td>
                        </tr>

                         <tr>
                            <th>问题中类:</th>
                            <td>
                               <asp:DropDownList ID="ddl_midparentcategory" AutoPostBack="true"   CssClass="form-control" 
            runat="server"   Width="300" 
            onselectedindexchanged="ddl_midparentcategory_SelectedIndexChanged"  >
        </asp:DropDownList>
                            </td>
                        </tr>


                        
                         <tr>
                                <th>小类名称：</th>
                                <td>
                                   
                                    <asp:TextBox class="form-control"  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="Dynamic"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <th>排序数字：</th>
                                <td>
                                    <asp:TextBox class="form-control" ID="txt_orderid" Text="0" Width=300px runat="server"></asp:TextBox>
                             </td>
                             </tr>

                            

                                   
                            <tr>
                                <th></th>
                                <td>
                                    <asp:Button ID="btn_add" runat="server" Text="添加小类"  ValidationGroup="Add" 
                                        class="btn btn-primary " onclick="btn_add_Click" />
 
                                
                                </td>
                            </tr> 
                    </table>
         














 
                    <div class="result-list">
                         

                        <asp:LinkButton ID="lb_delete"  CssClass="btn btn-danger"
                         OnClientClick="if(!isselect()) return false; " 
                        runat="server" onclick="lb_delete_Click"> 批量删除</asp:LinkButton> 
                      <asp:LinkButton ID="lb_update_order" runat="server" 
                           CssClass="btn btn-default"
                            onclick="lb_update_order_Click">
                            
                        更新排序

                            </asp:LinkButton>
                               
      
                    </div>
                </div>
 




 
  <div id="thetable" class="result-content"> 
                    
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
         
     class="table table-hover"  GridLines="None"
     DataKeyNames="id" DataSourceID="SqlDataSource1">
       
       
        <Columns> 
  <asp:TemplateField> 
        <HeaderTemplate> 
             <input id="cb_selectall" type="checkbox"  value='<%# Eval("id") %>'  /> 
         </HeaderTemplate> 
                            
         <ItemTemplate  > 
             <input type="checkbox"  class="ck_item"   value=<%# Eval("id") %>   />  
            <asp:HiddenField runat="server" ID="hf_id" Value=<%# Eval("id") %> /> 
          </ItemTemplate>    
         
        
          </asp:TemplateField>
                        

         <asp:TemplateField>
         <HeaderTemplate>排序</HeaderTemplate>
          <ItemTemplate>
            <asp:TextBox runat="server" class="form-control" Width="80" Text='<%#Bind("orderId") %>' ID="txt_orderid"></asp:TextBox>
          </ItemTemplate>
           <HeaderStyle  Width=130px  /> 
         </asp:TemplateField> 

      

     <asp:BoundField DataField="catname"   HeaderStyle-Width="600px" HeaderText="小类名称" SortExpression="catname" />
      
      <asp:CommandField HeaderText="操作" EditText="编辑" DeleteText="<span onclick=&quot;JavaScript:return confirm('确定删除吗？')&quot;>删除</span> "  UpdateText="更新"  CancelText="取消" ShowDeleteButton="True" ShowEditButton="True" />

          
        </Columns>
        
          
    
    </asp:GridView>







       











        






        <asp:SqlDataSource ID="SqlDataSource1"  
           ConnectionString='<%$ ConnectionStrings:ConnectionString %>'
           Runat="server" 
       DeleteCommand="DELETE FROM [helphesk_categories] WHERE [id] = @id" 
SelectCommand=" select * from helphesk_categories where parentid =@parentid order by orderid asc " 
  UpdateCommand="UPDATE [helphesk_categories] SET [catname] = @catname,   [orderid] = @orderid  WHERE [id] = @id">
       
       <SelectParameters>
        <asp:ControlParameter ControlID="ddl_midparentcategory" Name="parentid" />
       </SelectParameters>
          <DeleteParameters>
              <asp:Parameter Name="id" Type="Int32" />
          </DeleteParameters>
          <UpdateParameters>
              <asp:Parameter Name="catname" Type="String" />
              <asp:Parameter Name="orderid" Type="Int32" />
            </UpdateParameters>


    </asp:SqlDataSource>
 





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




 



      

      
  <script>





      function SetOpValue(o2) {
          try {
              result = o2.split(";");
              for (i = 0; i < result.length; i++) {
                  if (result[i] != "") {
                      var r = result[i].split("$");
                      var _username = r[1];
                      $("#txt_usernames").val($("#txt_usernames").val() + ";" + _username);
                  }
              }
          }
          catch (e) {

          }

      }



      function PopM() {
          layer.open({
              type: 2,
              maxmin: true,
              shadeClose: true,
              title: '分类一览表',
              shade: [0.1, '#fff'],
              offset: ['20px', ''],
              area: ['1000px', ($(window).height() - 50) + 'px'],
              content: "CategoryTable.aspx"  
          });
      }
  </script>




      </div>
    


</asp:Content>
