<%@ Page Title="" Language="C#" MasterPageFile="~/helpdesk/Pc.master" EnableViewState="false" AutoEventWireup="true" CodeBehind="Pc_ListSoft.aspx.cs" Inherits="helpdesk.helpdesk.Pc_ListSoft" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">


       <link href="../javascript/datatables/datatables.css" rel="stylesheet" />
      <script src="../javascript/datatables/datatables.min.js"></script>

        <style>
          .xxx  {
              background-color: #DFF0D8;  
            font-weight:bold 
          }
        </style>
    
    

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

     
    
     <div class="alert form-inline" style="border:solid 1px #ccc">
  

                         
     软件类别： <asp:DropDownList ID="ddl_types"  AppendDataBoundItems="true" ClientIDMode="Static"   class="form-control"
          style="display:inline-block; width:150px" runat="server">
             <asp:ListItem Text="所有" Value=""></asp:ListItem>
        </asp:DropDownList>



                            
     关键字：     


 <asp:TextBox ID="txt_search" CssClass="form-control" 
     placeholder="" ClientIDMode="Static" 
      style="display:inline-block; width:250px" runat="server" ToolTip=""></asp:TextBox>


             
           &nbsp;&nbsp;&nbsp;&nbsp;  |  &nbsp;&nbsp;&nbsp;&nbsp; 


            <input type="submit"  style="display:none" onclick="return false;"/>

       <a href='Pc_AddEditSoftware.aspx'" class="btn btn-sm bg-green btn-flat" >添加新软件</a>
            

        <asp:Button   runat="server" ID="btndelete" Text="删除"  
            OnClientClick=" if(!IsSel()){ return false;} "   
           class="btn btn-danger btn-sm btn-flat" onclick="btndelete_Click"  
          />
           &nbsp;&nbsp;&nbsp;&nbsp;  |  &nbsp;&nbsp;&nbsp;&nbsp; 
 
        
            <a href="javascript:void(0)"; onclick="ept('Export_Data.aspx?types=software')" class="btn btn-sm  btn-primary   btn-flat"> 导出</a>

   <a href="javascript:void(0)"; onclick="ept('Import_Data.aspx?types=software')" class="btn  btn-sm  bg-teal   btn-flat"> 导入</a>

   
    
    

          
              
            
        </div>


   
   
     <asp:GridView ID="gv_list" 
         AllowPaging="false"  
         EnableViewState="false" 
         GridLines="None"
         ClientIDMode="Static"
         DataSourceID="SqlDataSource1" 
         AutoGenerateColumns="false" 
         runat="server" 
         class="table table-hover" 
         AllowSorting="false" 
         Width="99%"
         OnPreRender="gv_list_PreRender" >
    
    <Columns>
    

         
      
   <asp:BoundField DataField="id" HeaderText="ID" HeaderStyle-Width="50px"   />
   <asp:BoundField  HeaderText="软件类别" DataField="types"  HeaderStyle-Width="100px"   />
   <asp:HyperLinkField DataTextField="softwarename" DataNavigateUrlFields="id" DataNavigateUrlFormatString="Pc_AddEditSoftware.aspx?id={0}"   HeaderText="软件名称"    HeaderStyle-Width="100px" />
   <asp:BoundField  HeaderText="软件版本" DataField="version"    HeaderStyle-Width="100px"  />
     <asp:BoundField  HeaderText="软件供应商" DataField="manufacturer"   HeaderStyle-Width="100px"   />
   <asp:BoundField  HeaderText="使用部门"  DataField="dept"    HeaderStyle-Width="100px"  />
       <asp:BoundField  HeaderText="操作系统" DataField="os"     HeaderStyle-Width="120px"   />
        <asp:BoundField  HeaderText="编程语言" DataField="lng"     HeaderStyle-Width="120px"   />
       <asp:BoundField  HeaderText="数据库" DataField="db"     HeaderStyle-Width="120px"   />
       <asp:BoundField  HeaderText="备注" DataField="notes"     HeaderStyle-Width="350px"   />

  
    </Columns>
    
    </asp:GridView>
  
         

     <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
          CacheDuration="120" CacheExpirationPolicy="Absolute" 
         CacheKeyDependency="pclist"
          EnableCaching="true"
         ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
         SelectCommand="SELECT ID,types,softwarename,manufacturer,belongto,dept,version,buydate,os,db,lng,notes from  helpdesk_software    ORDER BY [id] DESC">
      </asp:SqlDataSource>

  
  
  
  
  
   
  
  
  <script>


      var lang = {
          "sProcessing": "处理中...",
          "sLengthMenu": "每页 _MENU_ 项",
          "sZeroRecords": "没有匹配结果",
          "sInfo": "   当前显示第 _PAGE_页 共 _PAGES_ 页，共 _TOTAL_ 条 ",
          "sInfoEmpty": "当前显示第 0 至 0 项，共 0 项",
          "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
          "sInfoPostFix": "",
          "sSearch": "搜索:",
          "sUrl": "",
          "sEmptyTable": "表中数据为空",
          "sLoadingRecords": "载入中...",
          "sInfoThousands": ",",
          "oPaginate": {
              "sFirst": "首页",
              "sPrevious": "上页",
              "sNext": "下页",
              "sLast": "末页",
              "sJump": "跳转"
          },
          "oAria": {
              "sSortAscending": ": 以升序排列此列",
              "sSortDescending": ": 以降序排列此列"
          }
      };



      $(document).ready(function () {
          $('#gv_list').dataTable({
              language: lang,  //提示信息
              autoWidth: false, //禁用自动调整列宽 
              pageLength: 10,
              order: [[ 0, "desc" ]],
             lengthMenu: [[10,20, 50, -1], [10, 20,50, "All"]],
             dom: 'irtp',//lfrtip frtip
          });


       

          oTable = $('#gv_list').DataTable();

          $('#txt_search').keyup(function () {
              oTable.search($(this).val()).draw();
          })




          $("#ddl_types").change(function () {
              oTable.column(3).search($(this).val()).draw();
          });


          $('#gv_list tbody').on('click', 'tr', function () {
              $(this).toggleClass('xxx');
          });
          


      });




      function IsSel() {
         
          var checked = 0;
          var result = "";
          var _c = 0;

          var rows = $("tr.xxx"); 

          for (var i = 0; i < rows.length; i++) {
              checked++;
              var __id = $(rows[i]).find("td:eq(0)").html().trim();
              result = __id + "," + result;
          }

          result = result + "-1";

          if (checked > 0) {
              $("#hf_ids").val(result);
             
              return true;
          }
          else {
              $("#hf_ids").val("");
              layer.alert("请选择需要删除的软件");
              return false;
          }
      }


       
  </script>
  
 
</asp:Content>
