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


<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
    <link href="<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Content/Site.css" rel="stylesheet"
        type="text/css" />
    <script src="<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Scripts/jquery-1.4.1-vsdoc.js"
        type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#CurrentPosition").html("接待人日程表");
            $("#mainmenu8").css("visibility", "visible");

            var TktID = $("#TktIDCheck").val();
            if (TktID != "") {
                $("input[name='TktID'][value='" + TktID + "']").attr("checked", true);
            }
        });

        function GoTo(str) {
            window.location = "<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Exhibitor/" + str;
        }

        function Show(id) {
            $("#f1").submit();
        }

        function printBadge(id_s) {
            var head = "<html><head><title></title></head><body><table width=100% bgcolor=#FFFFFF height=600><tr><Td>";
            var foot = "</td></tr></table></body></html>";
            var newstr = $("#" + id_s).html();
            var oldstr = $("body").html();
            document.body.innerHTML = head + newstr + foot;
            window.print();
            document.body.innerHTML = oldstr;
        }

        function showInfo(id) {
            $("#PsnID").val(id);
            $("#f1").attr("action", "<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Exhibitor/ShowVisitorInfo");
            $("#f1").submit();
        }
    </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">
                <tr style="display:none">
                    <td align="left">
                        <table border='0' cellpadding="0" cellspacing="0" width="100%" align="left">
                            <tr>
                                <td class="tdMenu" onclick="GoTo('ScheduleActor')">
                                    展商日程
                                </td>
                                <td class="tdMenuWidth">&nbsp;</td>
                                <td class="tdMenuSelect" onclick="GoTo('ScheduleReceiver')">
                                    接待人日程
                                </td>
                                <td>&nbsp;</td>
                            </tr>
                            <tr>
                                <td class="tdMenuLine" colspan="4"></td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <strong>展商接待人员展会预约日程表</strong>
                        <br /><br />
                    </td>
                </tr>
                <tr>
                    <td align="left">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td align="left">接待人员：
                        <%
                            FamousFurnitureExpo.Models.Person p = ViewData["Person"] as FamousFurnitureExpo.Models.Person;
                            
                            Dictionary<int, string> diR = ViewData["ReceptionDi"] as Dictionary<int, string>;
                            if (diR.Count > 0)
                            {
                                foreach (int TktID in diR.Keys)
                                {
                        %>
                                    <input type="radio" onclick="Show(this.value)" name="TktID" value="<%=TktID %>" /><%=diR[TktID]%>&nbsp;
                        <%
                                }
                            }
                            else
                            { 
                        %>
                                    <font color="red">请先在接待人员管理中设置接待人员。</font>
                                    <a href="<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Exhibitor/Reception">点击这里</a>
                        <%    
                            }
                        %>
                                </td>
                            </tr>
                        <% 
                            if (diR.Count > 0)
                            {    
                        %>
                            <tr><td>&nbsp;</td></tr>
                            <tr>
                                <td>
                                    <div id="ShowDiv">
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                        <tr>
                                            <td colspan="2">以下是 <%=diR[Convert.ToInt32(ViewData["TktID"])]%> 的日程安排：</td>
                                        </tr>
                                        <tr>
                                            <td class="td01" width="15%" align="center">
                                                日期
                                            </td>
                                            <td class="td01" width="85%" align="center">
                                                安排
                                            </td>
                                        </tr>
                                    <%
                                        Dictionary<DateTime, List<System.Data.DataRow>> di = ViewData["Dict"] as Dictionary<DateTime, List<System.Data.DataRow>>;
                                        foreach (DateTime dt in di.Keys)
                                        {   
                                    %>
                                        <tr>
                                            <td class="td03" align="center" valign="top">
                                                <%=dt.ToShortDateString()%>
                                            </td>
                                            <td class="td03" align="left" style="padding-left:10px; padding-right:10px;">
                                                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                    <%
                                            List<System.Data.DataRow> li = di[dt];
                                            if (li.Count > 0)
                                            {
                                                foreach (System.Data.DataRow dr in li)
                                                {
                                                    string type = dr["Type"].ToString();
                                                    string mmiSysState = dr["MmiSysState"].ToString();
                                                    string message = "";
                                                    if (type == "预约")
                                                    {
                                                        message = "与来自 " + Server.HtmlEncode(dr["PsnComName"].ToString()) + " 的 <a href='javascript:;' onclick='showInfo("+dr["PsnID"] +")'>" + Server.HtmlEncode(dr["PsnName"].ToString()) + "</a> 有预约";
                                                        //message += " 见面地点：" + Server.HtmlEncode(dr["MmiInviteArea"].ToString());
                                                        message += " <a href='" + FamousFurnitureExpo.Models.Helper.VRoot + "/Exhibitor/MeetingInitiateShow/" + dr["MmiID"] + "'>查看</a>";
                                                    }
                                                    if (type == "被预约")
                                                    {
                                                        message = "接受了来自 " + Server.HtmlEncode(dr["PsnComName"].ToString()) + " 的 <a href='javascript:;' onclick='showInfo("+dr["PsnID"] +")'>" + Server.HtmlEncode(dr["PsnName"].ToString()) + "</a> 的预约";
                                                        //message += " 见面地点：" + Server.HtmlEncode(dr["MmiInviteArea"].ToString());
                                                        message += " <a href='" + FamousFurnitureExpo.Models.Helper.VRoot + "/Exhibitor/MeetingReceiveShow/" + dr["MmiID"] + "'>查看</a>";
                                                    }

                                                    string bTime = dr["BTime"].ToString();
                                                    bTime = bTime.Length > 5 ? bTime.Substring(0, 5) : bTime;
                                    %>
                                                    <tr>
                                                        <td width="10%" align="left">
                                                            <%=bTime %>
                                                        </td>
                                                        <td width="90%" align="left">
                                                            <%=message %>
                                                        </td>
                                                    </tr>
                                    <%     
                                                }
                                            }
                                            else
                                            {
                                                Response.Write("<tr><td>没有日程安排</td></tr>");
                                            }
                                    %>              
                                                </table>
                                            </td>
                                        </tr>
                                    <%
                                        }
                                    %>
                                    </table>
                                    </div>
                                </td>
                            </tr>  
                        <%
                            } 
                        %>
                        </table>
                    </td>
                </tr>
                <tr><td>&nbsp;</td></tr>
                <tr>
                    <td>
                        <div class="button" onclick="printBadge('ShowDiv')">打印</div>
                        <input type="hidden" id="TktIDCheck" name="TktIDCheck" value="<%=ViewData["TktID"] %>" />

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