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


<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        $(function () {
            $("#CurrentPosition").html("收到的预约");
            $("#menu73").css("visibility", "visible");

            var st = $("#Status").val();
            $("#statusmenu" + st).attr("class", "selectDivSelected");
        });
        function Treat(id, type) {
            if (type == "拒绝") {
                if (confirm("确认要" + type + "预约？")) {

                } else {
                    return;
                }
            }
            $("#MmiID").val(id);
            $("#Type").val(type);
            $("#f1").submit();
        }
        function GoToStatus(status) {
            window.location = "<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Exhibitor/MeetingListReceive?status=" + status + "&page=1";
        }

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

    <style type="text/css">
        .tdMenuWidth
        {
        }
        .selectDiv
        {
            width: 120px;
            padding: 5px;
          border:1px solid #4EB0AE;
            cursor: pointer;
        }
        .selectDivSelected
        {
            width: 120px;
            padding: 5px;
            cursor: pointer;
            color: #ffffff;
            background-color: #4EB0AE;
        }
    </style>
</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">
                <tr>
                    <td align="left">
                        <% 
                            System.Data.DataRow drCount = ViewData["CountDataRow"] as System.Data.DataRow;
                        %>
                        <table border='0' cellpadding="0" cellspacing="0" width="100%" align="left">
                            <tr>
                                <td id="statusmenu0" class="selectDiv" onclick="GoToStatus(0)">
                                    新预约(<%=drCount["count0"] %>)
                                </td>
                                <td class="tdMenuWidth">&nbsp;</td>
                                <td id="statusmenu1" class="selectDiv" onclick="GoToStatus(1)">
                                    建议新时间(<%=drCount["count1"] %>)
                                </td>
                                <td class="tdMenuWidth">&nbsp;</td>
                                <td id="statusmenu2" class="selectDiv" onclick="GoToStatus(2)">
                                    已确认(<%=drCount["count2"] %>)
                                </td>
                                <td class="tdMenuWidth">&nbsp;</td>
                                <td id="statusmenu3" class="selectDiv" onclick="GoToStatus(3)">
                                    已拒绝(<%=drCount["count3"] %>)
                                </td>
                                <td>&nbsp;</td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="left">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td class="td01" width="10%" align="center" style="line-height:35px">观众姓名</td>
                                <td class="td01" width="20%" align="center">观众公司</td>
                                <td class="td01" width="10%" align="center">展商接待人</td>
                                <td class="td01" width="20%" align="center">预约时间</td>
                                <td class="td01" width="20%" align="center">状态</td>
                                <td class="td01" width="20%" align="center">操作</td>
                            </tr>
                    <%
                        int status = Convert.ToInt32(ViewData["Status"]);
                        string statusStr = "";
                        switch (status)
                        {
                            case 0:
                                statusStr = "请确认";
                                break;
                            case 1:
                                statusStr = "已申请，待确认";
                                break;
                            case 2:
                                statusStr = "已确认";
                                break;
                            case 3:
                                statusStr = "已拒绝";
                                break;
                        }
                        
                        System.Data.DataTable dt = ViewData["Data"] as System.Data.DataTable;
                        if (dt.Rows.Count > 0)
                        {
                            foreach (System.Data.DataRow dr in dt.Rows)
                            {
                                DateTime bTime;
                                if (dr["MmiReBegionTime"].ToString() == "")
                                {
                                    bTime = Convert.ToDateTime(dr["MmiBTime"]);
                                }
                                else
                                {
                                    bTime = Convert.ToDateTime(dr["MmiReBegionTime"]);
                                }
                    %>
                            <tr>
                                <td class="td03" align="center" style="line-height:35px">
                                    <a href="javascript:;" onclick="showInfo(<%=dr["PsnID"] %>)">
                                    <%=Server.HtmlEncode(dr["PsnName"].ToString())%>
                                    </a>
                                </td>
                                <td class="td03" align="left"><%=Server.HtmlEncode(dr["PsnComName"].ToString()) %></td>
                                <td class="td03" align="center"><%=Server.HtmlEncode(dr["TktName"].ToString() == "" ? "待确定" : dr["TktName"].ToString())%></td>
                                <td class="td03" align="left"><%=Server.HtmlEncode(bTime.ToString())%><br /><%=Server.HtmlEncode(dr["MmiInviteArea"].ToString()) %></td>
                                <td class="td03" align="center"><%=statusStr %></td>
                                <td class="td03" align="center">
                                    <a href="<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Exhibitor/MeetingReceiveShow/<%=dr["MmiID"] %>">查看</a>&nbsp;
                    <%
                                if (status == 0)
                                {
                                    Response.Write("<a href=\"javascript:Treat(" + dr["MmiID"] + ",'同意');\">同意</a>&nbsp;");
                                    Response.Write("<a href=\"javascript:Treat(" + dr["MmiID"] + ",'拒绝');\">拒绝</a>&nbsp;<br />");
                                    Response.Write("<a href=\"javascript:Treat(" + dr["MmiID"] + ",'建议新时间');\">建议新时间</a>");
                                }
                    %>
                                </td>
                            </tr>
                    <%
                            }
                    %>
                            <tr>
                                <td colspan="8">
                                    <script type="text/javascript">
                                        Pager.Display("<%=ViewData["Page"] %>","<%=ViewData["PageSize"] %>","<%=ViewData["TotalNum"] %>","<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Exhibitor/MeetingListReceive?status=<%=ViewData["Status"] %>");
                                    </script>
                                </td>
                            </tr>
                    <%
                        }
                        else
                        { 
                    %>
                            <tr>
                                <td colspan="8" class="td03" align="center" valign="middle" height="40" width="100%">暂无信息</td>
                            </tr>
                    <%    
                        }
                    %>
                        </table>
                    </td>
                </tr>
                <tr><td>&nbsp;</td></tr>
                <tr>
                    <td>
                        <input type="hidden" id="Status" name="Status" value="<%=ViewData["Status"] %>" />
                        
                        <input type="hidden" id="MmiID" name="MmiID" />
                        <input type="hidden" id="Type" name="Type" />

                        <input type="hidden" id="PsnID" name="PsnID" />
                    </td>
                </tr>
            </table>
            </form>
        </center>
    </div>
</asp:Content>
