<%@ 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/CheckInfo.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#CurrentPosition").html("展商胸卡");
            $("#mainmenu3").css("visibility", "visible");
        });
        function GoTo(str) {
            window.location = "<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Exhibitor/" + str;
        }
        function checkName(i) {
            var name = $("#Name" + i).val();
            var error = Name_Check("姓名", name);
            if (error != "") {
                showCheckTag("checkName" + i, false, error);
                $("#Name" + i).focus();
                return false;
            }
            showCheckTag("checkName" + i, true, "");
            return true;
        }
        function checkRank(i) {
            var rank = $("#Rank" + i).val();
            var error = Rank_Check("职务", rank);
            if (error != "") {
                showCheckTag("checkRank" + i, false, error);
                $("#Rank" + i).focus();
                return false;
            }
            showCheckTag("checkRank" + i, true, "");
            return true;
        }
        function checkComName(i) {
            var comName = $("#ComName" + i).val();
            var error = CompanyName_Check("公司中文名称", comName);
            if (error != "") {
                showCheckTag("checkComName" + i, false, error);
                $("#ComName" + i).focus();
                return false;
            }
            showCheckTag("checkComName" + i, true, "");
            return true;
        }
        function showCheckTag(id, ispass, message) {
            if (ispass == true) {
                $("#" + id).html('<font color="green">√</font>');
            } else {
                if (message == null) {
                    message = "";
                }
                $("#" + id).html('<font color="red">※' + message + '</font>');
            }
        }
        function Save() {
            $("span[id^='check']").html('<font color="red">※</font>');

            var check = true;
            var num = 0;
            for (var i = 0; i < 4; i++) {
                var name = $.trim($("#Name" + i).val());
                var rank = $.trim($("#Rank" + i).val());
                var comName = $.trim($("#ComName" + i).val());
                if (name != "" || rank != "" || comName != "") {
                    if (checkName(i) && checkRank(i) && checkComName(i)) {

                    } else {
                        check = false;
                    }
                    num++;
                }
            }
            if (num == 0) {
                MsgTip.show({ msg: "请输入胸卡信息！", ico: "warning", top: 340 });
            }
            if (check && num > 0) {
                $("#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>
                    <td align="left">
                        <table border='0' cellpadding="0" cellspacing="0" width="100%" align="left">
                            <tr>
                                <td class="tdMenuSelect" onclick="GoTo('ExhiActorCard')">
                                    展商胸卡
                                </td>
                                <td class="tdMenuWidth">&nbsp;</td>
                                <td class="tdMenu" onclick="GoTo('ExhiVisitCard')">
                                    客户胸卡
                                </td>
                                <td class="tdMenuWidth">&nbsp;</td>
                    <% 
                        if (FamousFurnitureExpo.Models.Helper.IfShowTrafficCard(Convert.ToInt32(Session["ExhID"])))
                        {
                    %>
                                <td class="tdMenu" onclick="GoTo('ExhiTrafficCard')">
                                    货车证
                                </td>
                                <td class="tdMenuWidth">&nbsp;</td>
                    <% 
                        }    
                    %>
                                <td>&nbsp;</td>
                            </tr>
                            <tr>
                                <td class="tdMenuLine" colspan="7"></td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr><td>&nbsp;</td></tr>
                <%
                    for (int i = 0; i < 4; i++)
                    {
                %>
                <tr>
                    <td>
                            <table border="0" cellpadding="0" cellspacing="7" id="EditTable" style="border:1px solid #bfefff;">
                                <tr>
                                    <td width="100">姓名：</td>
                                    <td><input type="text" class="text" id="Name<%=i %>" name="Name<%=i %>" />
                                        <span id="checkName<%=i %>"><font color="red">※</font></span></td>
                                </tr>
                                <tr>
                                    <td>职务：</td>
                                    <td><input type="text" class="text" id="Rank<%=i %>" name="Rank<%=i %>" />
                                        <span id="checkRank<%=i %>"><font color="red">※</font></span></td>
                                </tr>
                                <tr>
                                    <td>公司名称：</td>
                                    <td><input type="text" class="text" id="ComName<%=i %>" name="ComName<%=i %>" />
                                        <span id="checkComName<%=i %>"><font color="red">※</font></span></td>
                                </tr>
                            </table>
                    </td>
                </tr>
                <tr><td>&nbsp;</td></tr>
                <%        
                    } 
                %>
                <tr>
                    <td>
                        <div class="button" onclick="Save()">保存</div>
                    </td>
                </tr>
            </table>
            </form>
        </center>
    </div>
</asp:Content>
