<%@ Page Title="" Language="C#" MasterPageFile="~/bps/bps.Master" AutoEventWireup="true" CodeBehind="customer_list.aspx.cs" Inherits="bps.bps.custom" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

     
        <h1  class="border-active subnav" ><%=isen?"Customer List":"客户列表" %>  </h1>

       

    <asp:UpdatePanel runat="server"   ID="pnl">
       
        <ContentTemplate>






             <table class="table">
        <tr>
            

             <th width="100px">
                    请输入关键字
            </th>

             

              <td>
                <asp:TextBox runat="server" Width="600px"  style="display:inline-block" placeholder="客户代号/客户名称/城市/国家/货币/地址/电话" CssClass="form-control"   ValidationGroup="add"  ID="txt_key"></asp:TextBox> 
                     
             

                <asp:Button runat="server" ID="btn_search"   CausesValidation="false"
                     Text="查询" CssClass="btn btn-primary btn-sm"  />
           
                   <a href="###"  onclick="Pop('customer_addedit.aspx',1250,650,'添加修改查看客户');" 
                       class="btn btn-danger btn-sm" >添加</a>
                   
                 </td>

        </tr>

    </table>






      

    <asp:GridView runat="server" ID="gv_list"  DataKeyNames="id" PageSize="10" GridLines="None" DataSourceID="sds"  CssClass="table table-hover"
         AutoGenerateColumns="false"  
         AllowPaging="True">
        <Columns>
            <asp:BoundField DataField="ID" Visible="false" HeaderText="ID" HeaderStyle-Width="80px" />

           
             <asp:BoundField DataField="customercode" HeaderText="客户代号" HeaderStyle-Width="100px" />


            <asp:TemplateField>
                 <HeaderStyle Width="250" />
                <HeaderTemplate>客户名称</HeaderTemplate>
                <ItemTemplate>
                      <a href="###"  onclick="Pop('customer_addedit.aspx?id=<%#Eval("id") %>',1250,650,'查看修改客户');" 
                      >
                          <%#Eval("name") %>
                          </a>

                </ItemTemplate>

            </asp:TemplateField>
 

             <asp:BoundField DataField="city" HeaderText="城市" HeaderStyle-Width="100px" />

             <asp:BoundField DataField="country" HeaderText="国家" HeaderStyle-Width="60px" />

              <asp:BoundField DataField="currency" HeaderText="货币" HeaderStyle-Width="60px" />

              <asp:BoundField DataField="address" HeaderText="地址" HeaderStyle-Width="60px" />

             <asp:BoundField DataField="contactmobile" HeaderText="联系电话" HeaderStyle-Width="120px" />

             <asp:BoundField DataField="paytype" HeaderText="支付方式" HeaderStyle-Width="100px" />

 
        </Columns>
        <PagerStyle CssClass="pagination-ys" />

    </asp:GridView>




    <asp:SqlDataSource runat="server" ID="sds"
         ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
         DeleteCommand="DELETE FROM [purchase_customer] WHERE [id] = @id" 
          SelectCommand="SELECT  *  FROM [purchase_customer]  where  (@key='' or  customercode+name+address+city+country+contactmobile+currency like '%'+@key+'%') ORDER BY [id] DESC"
       

        
        >
        <SelectParameters>
            <asp:ControlParameter ControlID="txt_key" ConvertEmptyStringToNull="false" Name="key" />

        </SelectParameters>

        <DeleteParameters>
            <asp:Parameter Name="id" Type="Int32" />
        </DeleteParameters>
        
        
    </asp:SqlDataSource>


              </ContentTemplate>

    </asp:UpdatePanel>


</asp:Content>
