<%@ Page Title="中类设置" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Category2.aspx.cs" Inherits="Helpdesk.Admin.Category2" %>
<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"  CssClass="form-control"
                                   AutoPostBack="true"  runat="server"   Width="250"  >
        </asp:DropDownList>  
                            </td>
                        </tr>
                        
                         <tr>
                                <th width="150">类别名称：</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:TextBox id="txt_usernames" Text="" Style="display:inline-block " ClientIDMode="Static"  class="form-control" Runat="Server"  Width=300px ValidationGroup="Add" ></asp:TextBox>
                             &nbsp;&nbsp;&nbsp;&nbsp;
                            <a href="javascript:void(0);" onclick="window.open('../helpdesk/popupn.aspx?t=open',null,'left=200,top=100,width=500,height=450'); return false" >
                             选择默认负责人</a> 
                             </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>
        
 

    <br /><br />


        
 
  <div id="thetable" class="result-content"> 
                    
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
     class="table table-hover" GridLines="None"
     DataKeyNames="id" DataSourceID="SqlDataSource1" OnRowUpdating="GridView1_RowUpdating">
       
       
        <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>    
          <HeaderStyle  Width=50px   />        
        
          </asp:TemplateField>
                        

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

      

     <asp:BoundField DataField="catname"   HeaderStyle-Width="450px" HeaderText="中类名称" SortExpression="catname" />

      <asp:BoundField DataField="usernames"   HeaderStyle-Width="250px" HeaderText="默认负责人" SortExpression="usernames" />

      <asp:CommandField HeaderText="操作" EditText="编辑" DeleteText="<span onclick=&quot;JavaScript:return confirm('确定删除吗？')&quot;>删除</span> "  UpdateText="更新"  CancelText="取消" ShowDeleteButton="True" ShowEditButton="True" />

          
        </Columns>
        
          
    
    </asp:GridView>









                </div>
            
        </div>












        






        <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 " OnUpdating="SqlDataSource1_Updating"  >
       
       <SelectParameters>
        <asp:ControlParameter ControlID="ddl_parentcategory" Name="parentid" />
       </SelectParameters>
       
        <DeleteParameters>
           <asp:Parameter Name="id" Type="Int32" />
        </DeleteParameters>
       
       
          <UpdateParameters>
            <asp:Parameter Name="catname" Type="String" />
            <asp:Parameter Name="orderid" Type="Int32" />
         
            <asp:Parameter Name="id" Type="Int32" />
        </UpdateParameters>

        
    </asp:SqlDataSource>
 





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







     <script> 
      

         $('#span_help').on('click', function () {
             layer.msg('在问题大类里，选择一个分类，下表显示该类别下的子类', this, { time: 5,
                 style: ['background-color:#0FA6D8; color:#fff', '#0FA6D8'],
                 maxWidth: 450
             });
         });


         $('#span_help2').on('click', function () {
             layer.msg('设置中级分类默认负责人，这样，在启用邮件的情况下，当用户提交问题时，默认负责人会收到邮件通知。', this, {
                 time: 10,
                 style: ['background-color:#0FA6D8; color:#fff', '#0FA6D8'],
                 maxWidth: 450
             });
         });
     
     </script>



      

      
  <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>
</asp:Content>
