<%@ Import Namespace="SWTraining" %>

<%@ Page Language="c#" CodeBehind="PotentialList.aspx.cs" AutoEventWireup="True"
    Inherits="SWTraining.Consultant.PotentialList" Title="顾问工作台-咨询信息列表" %>

<!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">
    <link id="linkStyle" runat="server" href="../Themes/Orange/css.css" rel="stylesheet"
        type="text/css" />

    <script type="text/javascript">
        function Checks(checkbox) {
            for (var i = 0; i < document.forms[0].elements.length; i++) {
                var e = document.forms[0].elements[i];
                if (e.type == "checkbox" && e.id == "id") {
                    e.checked = checkbox.checked;
                }
            }
        }

        function Send() {
            var StudentID = "";
            for (var i = 0; i < document.forms[0].elements.length; i++) {
                var e = document.forms[0].elements[i];
                if (e.type == "checkbox" && e.id == "id") {
                    if (e.checked) {
                        StudentID += "," + e.value;
                    }
                }
            }

            if (StudentID.length > 0) {
                StudentID = StudentID.substring(1, StudentID.length);
                document.getElementById("PotentialID").value = StudentID;
                document.formStudent.action = "../SMS/SendToStudent.aspx";
                document.formStudent.submit();
            }
        }
    </script>

</head>
<body>
    <form id="Form1" method="post" runat="server">
    <div class="divpanel">
        <table class="table" cellspacing="0" width="100%" border="0">
            <tr>
                <th colspan="2">
                    咨询快速查询
                </th>
            </tr>
            <tr>
                <td>
                    校区：
                </td>
                <td>
                    <asp:DropDownList ID="ddlSchool" runat="server" DataTextField="SchoolName" DataValueField="SchoolID">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    课程：
                </td>
                <td>
                    <asp:DropDownList ID="ddlCourse" runat="server" DataTextField="CourseName" DataValueField="CourseID">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    姓名：
                </td>
                <td>
                    <asp:TextBox ID="tbxPotentialName" runat="server" Width="159px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    电话：
                </td>
                <td>
                    <asp:TextBox ID="tbxTel" runat="server" Width="160px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    日期：
                </td>
                <td>
                    <asp:TextBox ID="tbxStartDate" runat="server"></asp:TextBox>
                    -<asp:TextBox ID="tbxEndDate" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    下次回访日期：
                </td>
                <td>
                    <asp:DropDownList ID="ddlNextReplyDate" runat="server">
                        <asp:ListItem Text="  " Value="0"></asp:ListItem>
                        <asp:ListItem Value="1">今日到期</asp:ListItem>
                        <asp:ListItem Value="2">明天到期</asp:ListItem>
                        <asp:ListItem Value="3">后天到期</asp:ListItem>
                        <asp:ListItem Value="7">一周内到期</asp:ListItem>
                        <asp:ListItem Value="-1">已过期</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    状态：
                </td>
                <td>
                    <asp:DropDownList ID="ddlStatus" runat="server" DataTextField="StatusName" DataValueField="StatusID">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    咨询顾问：
                </td>
                <td>
                    <asp:DropDownList ID="ddlUser" runat="server" DataTextField="TrueName" DataValueField="UserID">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <asp:Button ID="btnSelect" runat="server" Text="查询" OnClick="btnSelect_Click"></asp:Button>
                </td>
            </tr>
        </table>
    </div>
    <span runat="server" id="spanAllBox">
        <div class="divpanel" style="text-align: left">
            <div style="float: left">
                    <fieldset style="width: auto; padding-bottom: 5px">
                        <legend style="font-size: 10px">控制面板</legend>
                        <ul class="grouptools">
                            <li style="float: left">
                                <input onclick="Checks(this)" type="checkbox">
                            </li>
                            <li style="float: left">全选 </li>
                            <li style="float: left" class="ico_sms"></li>
                            <li style="float: left">
                                <asp:HyperLink ID="hlkSMS" runat="server" NavigateUrl='<%#string.Format("javascript:Send();void(0);") %>'
                                    Text="发短信" /></li>
                        </ul>
                    </fieldset>
            </div>
        </div>
    </span>
    <div class="divpanel">
        <asp:GridView ID="GridView1" runat="server" CssClass="gridview" AutoGenerateColumns="False"
            DataKeyNames="PotentialID" OnRowDeleting="GridView1_RowDeleting" OnRowDataBound="GridView1_RowDataBound">
            <Columns>
                <asp:TemplateField HeaderText="咨询号">
                    <ItemTemplate>
                        <span runat="server" id="spanBox">
                            <input type="checkbox" id="id" value='<%#Eval("PotentialID")%>' /></span>
                        <asp:Label ID="labPotentialID" runat="server" Text='<%# Eval("PotentialID") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="姓名">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="labPotentialName" ForeColor='<%# Convert.ToInt32(Eval("StatusID")) == 3 ? System.Drawing.Color.ForestGreen:System.Drawing.Color.Black%>'
                            Text='<%#Eval("PotentialName")%>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="来源">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="labSourceType" Text='<%#Rs.Items.GetSourceType(Eval("SourceType"))%>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="CourseName" ReadOnly="True" HeaderText="课程" />
                <asp:BoundField DataField="DateAndTime" ReadOnly="True" HeaderText="咨询日期" />
                <asp:TemplateField HeaderText="客户状态">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="labStatusName" Text='<%# Eval("StatusName") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="咨询顾问">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="labTrueName" Text='<%#Eval("TrueName") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="最后回访信息">
                    <ItemTemplate>
                        <%#Eval("LastPostName")%>|<%#Eval("LastPostTime")%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="回访">
                    <ItemTemplate>
                        <font color="red">
                            <%#Eval("ReCount")%>
                        </font>次|<a href='Reply.aspx?PotentialID=<%#Eval("PotentialID")%>&GetURL=<% = swq.Web.PathAndQuery() %>'>回访</a>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="转正">
                    <ItemTemplate>
                        <asp:HyperLink ID="hlkOfficial" runat="server" Text="转正" NavigateUrl='<%# string.Format("../Register/PostStudent.aspx?PotentialID={0}",Eval("PotentialID"),swq.Web.PathAndQuery()) %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="编辑">
                    <ItemTemplate>
                        <asp:HyperLink ID="hlkEdit" runat="server" Text="编辑" NavigateUrl='<%# string.Format("PostPotential.aspx?PotentialID={0}&GetURL={1}",Eval("PotentialID"),swq.Web.PathAndQuery()) %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="删除" SortExpression="delete">
                    <ItemTemplate>
                        <asp:LinkButton ID="lbnDelete" runat="server" Text="删除" CommandName="Delete" CommandArgument='<%#Eval("UserID")%>'
                            OnClientClick="<%# Rs.Messages.确定删除%>"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
    <div class="divpanel">
        <asp:Literal ID="litPagerButton" runat="server"></asp:Literal>
    </div>
    </form>
    <form id="formStudent" name="formStudent" method="post">
    <input id="PotentialID" name="PotentialID" type="hidden" value="" />
    </form>
</body>
</html>
