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

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

   <div>
        <form id="f1" action="" method="post">
        <table width="100%" cellspacing="0" cellpadding="0" class="table" border="0">
            <thead>
                <tr>
                    <th colspan="5">
                        <br />
                        <h3>
                            <span><b>电子版参观邀请函</b></span></h3>
                    </th>
                </tr>
                <tr>
                    <th colspan="5">
                        <div class="dnnTooltip">
                            <label>
                                <span style="font-weight: normal">您可以在此页面向您的客户发出参观邀请，贵公司名称和展台号将自动包含在邮件中。现在就发送邮件邀请您的客户吧。</span>
                            </label>
                        </div>
                    </th>
                </tr>
                <tr>
                    <td colspan="5">
                        <input type="button" name="btnAdd" value="添加邀请人" style=" background-color:#4EB0AE;" onclick="return add();" id="btnAdd"
                            class="btn btn-success" />
                        <span>您还可以</span><a id="Template" href="<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Content/Template/EmailInvitaions.xls" target="_blank">下载模板</a>，<a
                            href="javascript:MultiAddEmailInvitation();">批量添加客户名单</a>
                    </td>
                </tr>
            </thead>
            <thead>
                <tr>
                    <th colspan="5">
                        <div class="dnnTooltip">
                            <label>
                                <span>搜索条件</span>
                            </label>
                        </div>
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td width="15%">
                        <div class="dnnTooltip">
                            <label>
                                <span>姓名:</span>
                            </label>
                        </div>
                    </td>
                    <td width="35%">
                        <input type="text" name="txtName" id="txtName" value="<%=ViewData["ImeName"] %>" />
                    </td>
                    <td width="15%">
                        <div class="dnnTooltip">
                            <label>
                                <span>发送状态:</span>
                            </label>
                        </div>
                    </td>
                    <td width="35%">
                        <select name="ddlSendStatus" id="ddlSendStatus">
                            <option value="-1" selected="selected">
                                <div class="dnnTooltip">
                                    <label>
                                        <span>所有</span>
                                    </label>
                                </div>
                            </option>
                            <option value="1">
                                <div class="dnnTooltip">
                                    <label>
                                        <span>已发送</span>
                                    </label>
                                </div>
                            </option>
                            <option value="0">
                                <div class="dnnTooltip">
                                    <label>
                                        <span>未发送</span>
                                    </label>
                                </div>
                            </option>
                        </select>
                        <input type="hidden" id="SendStatus" name="SendStatus" value="<%=ViewData["SendStatus"] %>" />
                    </td>
                    <td>
                        <input type="button" name="btnSearch" value="检索" style=" background-color:#4EB0AE;" onclick="return Search();" id="btnSearch"
                            class="btn btn-success" />
                    </td>
                </tr>
            </tbody>
            <tfoot>
                
                <tr>
                    <td colspan="5"> 
                        <input type="button" name="btnSend" style=" background-color:#4EB0AE;" value="发送" onclick="return Send();" id="btnSend"
                            class="btn btn-success" />
                        <%--<a href="<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Content/Template/pre-reg_cn.htm" target="_blank"
                            class="btn btn-success">中文电子邀请函</a> <a href="<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Content/Template/pre-reg_en.htm"
                                target="_blank" class="btn btn-success">英文电子邀请函</a>--%>
                        <input type="hidden" id="ImeID" name="ImeID" />
                        <input type="hidden" id="Type" name="Type" />
                        <input type="hidden" id="ImeIDs" name="ImeIDs" />
                    </td>
                </tr>
            </tfoot>
        </table>
        <table width="100%" cellspacing="0" cellpadding="0" class="table table-condensed">
            <thead>
                <tr>
                    <th>
                        <input id="chkAll" type="checkbox" name="chkall" onclick="javascript:cbkAll(this);" />
                    </th>
                    <th>
                        <div class="dnnTooltip">
                            <label>
                                <span>姓名</span>
                            </label>
                        </div>
                    </th>
                    <th>
                        <div class="dnnTooltip">
                            <label>
                                <span>公司名称</span>
                            </label>
                        </div>
                    </th>
                    <th>
                        <div class="dnnTooltip">
                            <label>
                                <span>Email</span>
                            </label>
                        </div>
                    </th>
                    <th>
                        <div class="dnnTooltip">
                            <label>
                                <span>发送次数</span>
                            </label>
                        </div>
                    </th>
                    <th>
                        <div class="dnnTooltip">
                            <label>
                                <span>发送时间</span>
                            </label>
                        </div>
                    </th>
                    <th>
                        <div class="dnnTooltip">
                            <label>
                                <span>预登记状态</span>
                            </label>
                        </div>
                    </th>
                    <th width="60">
                        &nbsp;
                    </th>
                </tr>
            </thead>
            <tbody>
                <% 
                    System.Data.DataTable dt = ViewData["Data"] as System.Data.DataTable;
                    if (dt.Rows.Count > 0)
                    {
                        foreach (System.Data.DataRow dr in dt.Rows)
                        {
                            string ImeID = dr["ImeID"].ToString();
                            string ImeName = dr["ImeName"].ToString();
                            string ImeComName = dr["ImeComName"].ToString();
                            string ImeEmail = dr["ImeEmail"].ToString();
                            string ImeSendCount = dr["ImeSendCount"].ToString();
                            string ImeLastSendTime = dr["ImeLastSendTime"].ToString();
                            string RegCount = dr["RegCount"].ToString();
                            if (RegCount == "0")
                            {
                                RegCount = "未注册";
                            }
                            else
                            {
                                RegCount = "已注册";
                            }
                             
                %>
                <tr>
                    <td>
                        <input type="checkbox" name="chkItem" value="<%=ImeID %>" />
                    </td>
                    <td>
                        <%=ImeName%>
                    </td>
                    <td>
                        <%=ImeComName%>
                    </td>
                    <td>
                        <%=ImeEmail%>
                    </td>
                    <td>
                        <%=ImeSendCount%>
                    </td>
                    <td>
                        <%=ImeLastSendTime%>
                    </td>
                    <td>
                        <%=RegCount %>
                    </td>
                    <td>
                        <a class="btn btn-mini" href="javascript:Edit(<%=ImeID%>);" title="详情"><i class="icon-edit">
                        </i></a>
                    </td>
                </tr>
                <%}
                    }
                    else
                    { %>
                <tr>
                    <td colspan="8" align="center" valign="middle" height="40" width="100%" style="width: 100%;
                        padding-left: 320px">
                        您还未添加电子版参观邀请函。
                    </td>
                </tr>
                <%} %>
                <%
                    if (dt.Rows.Count > 0)
                    {
                %>
                <%--<tr>
                    <th colspan="8">
                    <div>--%>
                        <script type="text/javascript">
                            PagerPost.Display("<%=ViewData["Page"] %>", "<%=ViewData["PageSize"] %>", "<%=ViewData["TotalNum"] %>", "f1");
                        </script>
                      <%--  </div>
                </th>
                </tr>--%>
                <%} %>
            </tbody>
        </table>
         <input type="hidden" id="Message" name="Message" value="<%=ViewData["Message"] %>" />
        <script type="text/javascript">
            $(function () {
                var message = $("#Message").val();
                if (message != "") {
                    showMsg(message);
                }
            });
        </script>
       
        </form>
    </div>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
<link href="<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Scripts/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
    $(document).ready(function () {
        var message = $("#Message").val();
        if (message != "") {
            showMsg(message);
        }
        $("#CurrentPosition").html("电子版参观邀请函");
        MenuActive(7);
        $("#ddlSendStatus option[value='" + $("#SendStatus").val() + "']").attr("selected", true);
     
        iframeAutoFit();
    });

    function add() {
        window.location = "<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Invitation/EmailInvitationEdit?Type=Add";
    }

    function Edit(id) {
        $("#ImeID").val(id);
        $("#Type").val("Edit");
        $("#f1").submit();
    }

    function Send() {
        if (confirm("确定要发送邀请函？")) {

            var ImeIDs = GetchkItemValue();
            if (ImeIDs == "") {
                alert("请选择需要发送的观众！");
                return;
            }

            $("#ImeIDs").val(ImeIDs);
            $("#Type").val("Send");
            $("#f1").submit();
        }
    }

    function GetchkItemValue() {
        var Result = "";
        var Cbk = document.getElementsByName("chkItem");
        for (var i = 0; i < Cbk.length; i++) {
            if (Cbk[i].checked) {
                Result = Result + Cbk[i].value + ",";
            }
        }
        if (Result.length > 0) {
            Result = Result.substring(0, Result.length - 1);
        }
        return Result;
    }

    function cbkAll(obj) {
        var Cbk = document.getElementsByName("chkItem");
        for (var i = 0; i < Cbk.length; i++) {
            if (obj.checked) {
                Cbk[i].checked = true;
            }
            else {
                Cbk[i].checked = false;
            }
        }
    }

    function MultiAddEmailInvitation() {
        window.location = "<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Invitation/EmailInvitationImport";
    }

    function Search() {
        $("#Type").val("Search");

        $("#SendStatus").val($("#ddlSendStatus").find("option:selected").text());


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

    </script>
     <style type="text/css">
        span, h3, table, select
        {
            font-family: Arial,微软雅黑,Helvetica,sans-serif;
        }
    </style>
    
</asp:Content>
