<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/ExhibitorMaster.Master"
    Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
    <script src="<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Scripts/DynaForm.js"
        type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#CurrentPosition").html("感兴趣的观众");
            $("#menu61").css("visibility", "visible");
        });

        function Back() {
            $("#f1").attr("action", "<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Exhibitor/VisitorSearch");
            $("#f1").submit();
        }

        function Sub() {

            $("#f1").submit();
        }

        var dynaform;
        function AddMatch(id) {
            dynaform = new DynaForm({
                id: "dynaform",
                title: "新增预约",
                src: "<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Exhibitor/MeetingEdit?id=" + id,
                width: "650px",
                height: "500px",
                top: "50px"
            });
            dynaform.showModalDialog();
        }

        function showInfo(id, ifView) {
            //            var canView = $("#canView").val();
            //            var message = $("#message").val();
            //            if (ifView == "0") {
            //                if (canView == "1") {
            //                    if (confirm(message)) {

            //                    } else {
            //                        return;
            //                    }
            //                } else {
            //                    alert(message);
            //                    return;
            //                }
            //            }
            $("#PsnID").val(id);
            $("#f1").attr("action", "<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Exhibitor/ShowVisitorInfo");
            $("#f1").submit();
        }
        
        function AddETInfo() {

            dynaform = new DynaForm({
                id: "dynaform",
                title: "展品分类",
                src: "<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Exhibitor/SetExhiTypeInfo",
                width: "300px",
                height: "400px",
                top: "50px"
            });
            dynaform.showModalDialog();

        }
    </script>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <center>
            <form id="f1" action="" method="post">
            <table width="100%" border="0" style="text-align: left" cellpadding="0" cellspacing="0"
                id="main">
                <%
                    Dictionary<string, int> diCount = ViewData["DiCount"] as Dictionary<string, int>;
                    int dayMaxNum = diCount["AtrMeetCountPerDay"];
                    int totalMaxNum = diCount["AtrMeetCount"];
                    int todayNum = diCount["TodayNum"];
                    int totalNum = diCount["TotalNum"];

                    string message = "";
                    int canView;
                    int totalCanNum = totalMaxNum - totalNum;
                    int todayCanNumNumber = dayMaxNum - todayNum;
                    int todayCanNum = totalCanNum > todayCanNumNumber ? todayCanNumNumber : totalCanNum;
                    if (totalCanNum == 0)
                    {
                        canView = 0;
                        message = "您可以查看的总人数已满，不能继续查看观众了！";
                    }
                    else
                    {
                        if (todayCanNum == 0)
                        {
                            canView = 0;
                            message = "您今天可查看的人数已满，请明天再继续查看！";
                        }
                        else
                        {
                            canView = 1;
                            message = "您今天还可以查看 " + todayCanNum + " 名观众，您一共还可以查看 " + totalCanNum + " 名观众,请问您确定要查看此观众的信息吗？";
                        }
                    }
                %>
                <%--<tr>
                    <td>
                        您今天已查看数量 <font color="red">
                            <%=todayNum %></font>/<%=dayMaxNum %>
                        ，您总共查看数量 <font color="red">
                            <%=totalNum %></font>/<%=totalMaxNum %>。
                    </td>
                </tr>--%>
                <%--<tr>
                    <td>
                        以下是您查询的结果： （注：☉&nbsp;表示已查看，☏&nbsp;表示是通过邀请链接的注册登记观众）
                    </td>
                </tr>--%>
                <%--<tr>
                    <td>
                        以下是您查询的结果： （注：☉&nbsp;表示已查看）
                    </td>
                </tr>--%>
                <tr>
                    <td align="left">
                        <table width="100%" border="0">
                            <tr>
                                <td style="width: 600px">
                                    展品索引：<input type="text" class="text" style="width:500px" readonly="readonly" id="pint" name="pint" onclick="AddETInfo()"
                                        value="<%=ViewData["TypeName"] %>" /><input type="hidden" class="text" id="pintvalue" name="pintvalue"
                                        value="<%=ViewData["TypeID"] %>" />
                                </td>
                                <td>
                                    <div class="button" onclick="Sub()">
                                        查询</div>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td align="left">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td class="td01">
                                    姓名
                                </td>
                                <td class="td01">
                                    公司
                                </td>
                                <td class="td01">
                                    职务
                                </td>
                                <td class="td01">
                                    国家
                                </td>
                                <td class="td01">
                                    是否预约
                                </td>
                                <td class="td01">
                                    操作
                                </td>
                            </tr>
                            <%
                                System.Data.DataTable dt = ViewData["Data"] as System.Data.DataTable;
                                if (dt.Rows.Count > 0)
                                {
                                    foreach (System.Data.DataRow dr in dt.Rows)
                                    {
                                        string state = "";
                                        if (Convert.ToInt32(dr["ActorMaaCount"]) > 0)
                                        {
                                            state = "<a href='" + FamousFurnitureExpo.Models.Helper.VRoot + "/Exhibitor/ShowMeetingInfo/" + dr["PsnID"] + "'>已预约</a>";
                                        }
                            %>
                            <tr>
                                <td class="td03" align="left" width="20%">
                                    <% 
int ifView = 0;
if (Convert.ToInt32(dr["IfView"]) > 0)
{
    ifView = 1;
    //Response.Write("☉&nbsp;");
}
if (Convert.ToInt32(dr["IfInvite"]) > 0)
{
    ifView = 1;
    //Response.Write("☏&nbsp;");
}
                                    %>
                                    <%--<a href="javascript:;" onclick="showInfo(<%=dr["PsnID"] %>,<%=ifView %>)">--%>
                                        <%=Server.HtmlEncode(dr["PsnName"].ToString())%>
                                    <%--</a>--%>
                                </td>
                                <td class="td03" align="left" width="30%">
                                    <%=Server.HtmlEncode(dr["PsnComName"].ToString()) %>
                                </td>
                                <td class="td03" align="left" width="20%">
                                    <%=Server.HtmlEncode(dr["PsnRank"].ToString()) %>
                                </td>
                                <td class="td03" align="left" width="10%">
                                    <%=Server.HtmlEncode(dr["PsnCountry"].ToString()) %>
                                </td>
                                <td class="td03" align="center" width="10%">
                                    <%=state %>
                                </td>
                                <td class="td03" align="center" width="20%">
                                    <%--<a href="javascript:;" onclick="showInfo(<%=dr["PsnID"] %>,<%=ifView %>)">查看详情</a>--%>
                                    <% 
                                        if (Convert.ToInt32(dr["IfView"]) > 0)
                                        {
                                    %>
                                        <%--<a href="javascript:;" onclick="AddMatch(<%=dr["PsnID"] %>)">预约</a>--%>
                                    <%
                                        }
                                    %>
                                    <a href="javascript:;" onclick="AddMatch(<%=dr["PsnID"] %>)">预约</a>
                                </td>
                            </tr>
                            <%            
}
                            %>
                            <tr>
                                <td colspan="6">
                                    <script type="text/javascript">
                                        PagerPost.Display("<%=ViewData["Page"] %>", "<%=ViewData["PageSize"] %>", "<%=ViewData["TotalNum"] %>", "f1");
                                    </script>
                                </td>
                            </tr>
                            <%
}
                                else
                                { 
                            %>
                            <tr>
                                <td colspan="6" class="td03" align="center" valign="middle" height="40" width="100%">
                                    暂无信息
                                </td>
                            </tr>
                            <%    
}
                            %>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        <%--<div class="button" onclick="Back()">
                            返回</div>--%>
                        <input type="hidden" id="SearchStr" name="SearchStr" value="<%=ViewData["SearchStr"] %>" />
                        <input type="hidden" id="Meet" name="Meet" value="Meet" />
                        <input type="hidden" id="PsnID" name="PsnID" />
                        <input type="hidden" id="canView" name="canView" value="<%=canView %>" />
                        <input type="hidden" id="message" name="message" value="<%=message %>" />
                        <input type="hidden" id="Count" name="Count" value="" />
                    </td>
                </tr>
            </table>
            </form>
        </center>
    </div>
</asp:Content>
