<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AssetStep1.aspx.cs" Inherits="OAWeb.crm.service.AssetStep1"
    EnableViewState="true" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>第1步 查找相似客户</title>
    <style type="text/css">
        body
        {
            margin: 0px;
            font-size: 12px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div style="width: 600px; height: 400px; overflow-y: scroll">
        <table border="0" cellpadding="3px" cellspacing="1" style="width: 100%; margin-bottom: 3px;"
            bgcolor="#bbbbbb">
            <tr>
                <td style="height: 20px; font-size: 12px" align="center" bgcolor="#f0f0f0">
                    <b>第1步 查找相似客户</b>
                </td>
            </tr>
            <tr style="background-color: #ffffff">
                <td align="center">
                    <table border="0" cellpadding="3" cellspacing="0">
                        <tr>
                            <td>
                                客户名称：
                            </td>
                            <td>
                                <asp:TextBox ID="txtCustomerName" runat="server"></asp:TextBox>
                            </td>
                            <td>
                                联系电话：
                            </td>
                            <td>
                                <asp:TextBox ID="txtTelephone" runat="server"></asp:TextBox>
                            </td>
                            <td rowspan="3" valign="middle">
                                <asp:Button ID="btnCheck" runat="server" Text=" 检 测 " OnClick="btnCheck_Click" />
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                手机：
                            </td>
                            <td>
                                <asp:TextBox ID="txtMobilePhone" runat="server"></asp:TextBox>
                            </td>
                            <td align="right">
                                QQ：
                            </td>
                            <td>
                                <asp:TextBox ID="txtQQ" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr style="background-color: #ffffff">
                <td align="left">
                    <b>查询结果</b>
                </td>
            </tr>
            <asp:Repeater ID="rptCustomer" runat="server" OnItemDataBound="rptCustomer_ItemDataBound">
                <ItemTemplate>
                    <tr style="background-color: #ffffff">
                        <td>
                            <input type="radio" name="rdoItem" id="rdoItem" value='<%#Eval("CustomerID") %>' />
                            <%#Eval("CustomerName")%>
                            <asp:Literal ID="ltlText" runat="server"></asp:Literal><br />
                            <asp:Repeater ID="rptChildItem" runat="server">
                                <HeaderTemplate>
                                    <table border="0" cellpadding="3px" cellspacing="1" style="width: 80%; margin: 8px;"
                                        bgcolor="#D6D4D2">
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <tr style="background-color: #Ffffff">
                                        <td width="20%">
                                            <%#Eval("Name")%>
                                        </td>
                                        <td width="30%">
                                            手机：<%#Eval("MobilePhone")%>
                                        </td>
                                        <td width="30%">
                                            电话：<%#Eval("Telphone")%>
                                        </td>
                                        <td width="20%">
                                            QQ：<%#Eval("QQ")%>
                                        </td>
                                    </tr>
                                </ItemTemplate>
                                <FooterTemplate>
                                    </table></FooterTemplate>
                            </asp:Repeater>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:Repeater>
            <tr style="background-color: #ffffff;" id="tr_rdoItem" runat="server" visible="false">
                <td>
                    <asp:RadioButton ID="rdoItem" runat="server" GroupName="rdoItem" Checked="true" />
                    不选择
                </td>
            </tr>
            <tr style="background-color: #ffffff">
                <td>
                    <webdiyer:AspNetPager ID="pager" runat="server" CssClass="anpager" currentpagebuttonclass="cpb"
                        PageSize="6" NextPageText="下一页" LastPageText="页尾" FirstPageText="第一页" PrevPageText="上一页"
                        ShowBoxThreshold="10" SubmitButtonText="跳转" OnPageChanged="pager_PageChanged">
                    </webdiyer:AspNetPager>
                </td>
            </tr>
            <tr style="background-color: #ffffff">
                <td align="center">
                    <asp:Button ID="btnNext" runat="server" Text="下一步" Enabled="false" />
                </td>
            </tr>
        </table>
    </div>
    </form>
    <script type="text/javascript">

        function selectItem(input, type) {
            var customerId = "";
            elem = input.form.elements;
            for (i = 0; i < elem.length; i++) {
                if (elem[i].type == "radio" && elem[i].checked) {
                    customerId = elem[i].value;
                }
            }
            if (type != "clue" && (customerId == "" || customerId == "rdoItem")) {
                alert("请选择要绑定的客户，如果找不到客户，请减少查询条件。");
                return false;
            }
            var QueryString = "<%=gID %>"; //window.location.search.substring(1);
            if (type == "clue") {
                if (customerId == "" || customerId == "rdoItem")
                    location.href = "../customer/CustomerEdit.aspx?ClueId=" + QueryString;
                else
                    location.href = "../customer/CustomerEdit.aspx?ClueId=" + QueryString + "&CustomerID=" + customerId;
            }
            else {
                if (customerId == "" || customerId == "rdoItem")
                    location.href = "../customer/CustomerEdit.aspx?AssetId=" + QueryString;
                else
                    location.href = "../customer/CustomerEdit.aspx?AssetId=" + QueryString + "&CustomerID=" + customerId;
            }
            return false;
        } 
    </script>
</body>
</html>
