<%@ 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("相关联系人信息");
            $("#menu24").css("visibility", "visible");

            //称谓
            var gender = $("#Gender").val();
            $("input[name='rdoGender'][value='" + gender + "']").attr("checked", true);
            //电话
            var tel = $("#Tel").val();
            var telStr = tel.split('-');
            for (var i = 0; i < 4; i++) {
                $("#tel" + i).val(telStr[i]);
            }
            //传真
            var fax = $("#Fax").val();
            var faxStr = fax.split('-');
            for (var i = 0; i < 4; i++) {
                $("#fax" + i).val(faxStr[i]);
            }
            //主联系人
            var ifMain = $("#IfMain").val();
            if (ifMain == "1") {
                $("#ckbIfMain").attr("checked", true);
            }
        });

        function Save() {
            $("#Gender").val($("input[name='rdoGender']:checked").val());
            //姓名
            var name = $.trim($("#Name").val());
            if (name == "") {
                $("#Name").focus();
                MsgTip.show({ msg: "请输入姓名！", ico: "warning", top: 340 });
                return;
            } else {
                if (!checkChEn(name)) {
                    $("#Name").focus();
                    MsgTip.show({ msg: "姓名只能输入中文或英文！", ico: "warning", top: 340 });
                    return;
                }
            }
            //部门
            var dept = $.trim($("#Dept").val());
            if (dept != "") {
                if (!checkChEn(dept)) {
                    $("#Dept").focus();
                    MsgTip.show({ msg: "部门只能输入中文或英文！", ico: "warning", top: 340 });
                    return;
                }
            }
            //职务
            var rank = $.trim($("#Rank").val());
            if (rank != "") {
                if (!checkChEn(rank)) {
                    $("#Rank").focus();
                    MsgTip.show({ msg: "职务只能输入中文或英文！", ico: "warning", top: 340 });
                    return;
                }
            }
            //邮编
            var zipcode = $.trim($("#ZipCode").val());
            if (zipcode != "") {
                if (!checkNum(zipcode)) {
                    $("#ZipCode").focus();
                    MsgTip.show({ msg: "邮编只能输入数字！", ico: "warning", top: 340 });
                    return;
                }
            }
            //电话
            var tel0 = $.trim($("#tel0").val());
            var tel1 = $.trim($("#tel1").val());
            var tel2 = $.trim($("#tel2").val());
            var tel3 = $.trim($("#tel3").val());
            if (!checkNum(tel0)) {
                $("#tel0").focus();
                MsgTip.show({ msg: "请输入国家号！须为数字", ico: "warning", top: 340 });
                return;
            }
            if (!checkNum(tel1)) {
                $("#tel1").focus();
                MsgTip.show({ msg: "请输入区号！须为数字", ico: "warning", top: 340 });
                return;
            }
            if (!checkNum(tel2)) {
                $("#tel2").focus();
                MsgTip.show({ msg: "请输入电话号码！须为数字", ico: "warning", top: 340 });
                return;
            } else {
                if (tel2.length < 7) {
                    $("#tel2").focus();
                    MsgTip.show({ msg: "电话号码至少7位数字！", ico: "warning", top: 340 });
                    return;
                }
            }
            if (tel3 != "") {
                if (!checkNum(tel3)) {
                    $("#tel3").focus();
                    MsgTip.show({ msg: "请输入分机号码！须为数字", ico: "warning", top: 340 });
                    return;
                }
            }
            //传真
            var fax0 = $.trim($("#fax0").val());
            var fax1 = $.trim($("#fax1").val());
            var fax2 = $.trim($("#fax2").val());
            var fax3 = $.trim($("#fax3").val());
            if (fax0 != "" || fax1 != "" || fax2 != "" || fax3 != "") {
                if (!checkNum(fax0)) {
                    $("#fax0").focus();
                    MsgTip.show({ msg: "请输入国家号！须为数字", ico: "warning", top: 340 });
                    return;
                }
                if (!checkNum(fax1)) {
                    $("#fax1").focus();
                    MsgTip.show({ msg: "请输入区号！须为数字", ico: "warning", top: 340 });
                    return;
                }
                if (!checkNum(fax2)) {
                    $("#fax2").focus();
                    MsgTip.show({ msg: "请输入传真号码！须为数字", ico: "warning", top: 340 });
                    return;
                } else {
                    if (fax2.length < 7) {
                        $("#fax2").focus();
                        MsgTip.show({ msg: "传真号码至少7为数字！", ico: "warning", top: 340 });
                        return;
                    }
                }
                if (fax3 != "") {
                    if (!checkNum(fax3)) {
                        $("#fax3").focus();
                        MsgTip.show({ msg: "请输入分机号码！须为数字", ico: "warning", top: 340 });
                        return;
                    }
                }
            }
            //手机
            var mobile = $.trim($("#Mobile").val());
            if (mobile != "") {
                if (!checkNum(mobile)) {
                    $("#Mobile").focus();
                    MsgTip.show({ msg: "手机只能输入数字！", ico: "warning", top: 340 });
                    return;
                }
            }
            //Email
            var email = $.trim($("#Email").val());
            if (email != "") {
                if (!checkEmail(email)) {
                    $("#Email").focus();
                    MsgTip.show({ msg: "Email格式不正确！例：aaa@sina.com", ico: "warning", top: 340 });
                    return;
                }
            }

            $("#Tel").val(tel0 + "-" + tel1 + "-" + tel2 + "-" + tel3);
            $("#Fax").val(fax0 + "-" + fax1 + "-" + fax2 + "-" + fax3);
            $("#IfMain").val($("#ckbIfMain").attr("checked") ? 1 : 0);

            if ($("#IfMain").val() == "1") {
                if ($("#HaveMain").val()=="1") {
                    if (confirm("已经存在主联系人，是否要把当前人员设置为主联系人？")) {

                    } else {
                        return;
                    }
                }
            }
            $("#f1").submit();
        }

        function Back() {
            window.location = "<%=FamousFurnitureExpo.Models.Helper.VRoot %>/Exhibitor/LinkPersonList";
        }
    </script>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <center>
            <form id="f1" action="" method="post">
            <table width="100%" border="0" cellpadding="3" cellspacing="0">
            <% 
                FamousFurnitureExpo.Models.PersonJoin psj = ViewData["Data"] as FamousFurnitureExpo.Models.PersonJoin;
                
            %>
                <tr>
                    <td align="right" width="20%">姓名：</td>
                    <td align="left" width="80%"><input type="text" id="Name" name="Name" class="text" value="<%=Server.HtmlEncode(psj.PsjName) %>" /><font color="red">*</font></td>
                </tr>
                <tr>
                    <td align="right">称谓：</td>
                    <td align="left">
                        <input type="radio" id="rdoGender1" name="rdoGender" value="先生" checked="checked" />先生
                        <input type="radio" id="rdoGender2" name="rdoGender" value="女士" />女士
                        <input type="hidden" id="Gender" name="Gender" value="<%=Server.HtmlEncode(psj.PsjGender) %>" />
                    </td>
                </tr>
                <tr>
                    <td align="right">部门：</td>
                    <td align="left"><input type="text" id="Dept" name="Dept" class="text" value="<%=Server.HtmlEncode(psj.PsjDept) %>" /></td>
                </tr>
                <tr>
                    <td align="right">职务：</td>
                    <td align="left"><input type="text" id="Rank" name="Rank" class="text" value="<%=Server.HtmlEncode(psj.PsjRank) %>" /></td>
                </tr>
                <tr>
                    <td align="right">地址：</td>
                    <td align="left"><input type="text" id="Address" name="Address" class="text" value="<%=Server.HtmlEncode(psj.PsjAddress) %>" /></td>
                </tr>
                <tr>
                    <td align="right">邮编：</td>
                    <td align="left"><input type="text" id="ZipCode" name="ZipCode" class="text" value="<%=Server.HtmlEncode(psj.PsjZipCode) %>" onkeyup="value=value.replace(/[^\d]/g,'')" /></td>
                </tr>
                <tr>
                    <td align="right">电话：</td>
                    <td align="left">
                        <input type="text" id="tel0" name="tel0" class="text" style="width:30px" onkeyup="value=value.replace(/[^\d]/g,'')" /> -
                        <input type="text" id="tel1" name="tel1" class="text" style="width:30px" onkeyup="value=value.replace(/[^\d]/g,'')" /> -
                        <input type="text" id="tel2" name="tel2" class="text" style="width:90px" onkeyup="value=value.replace(/[^\d]/g,'')" /> -
                        <input type="text" id="tel3" name="tel3" class="text" style="width:30px" onkeyup="value=value.replace(/[^\d]/g,'')" />
                        <input type="hidden" id="Tel" name="Tel" value="<%=Server.HtmlEncode(psj.PsjTel1) %>" /><font color="red">*</font><font color="red">国家号-区号-电话号码-分机号</font>
                    </td>
                </tr>
                <tr>
                    <td align="right">传真：</td>
                    <td align="left">
                        <input type="text" id="fax0" name="fax0" class="text" style="width:30px" onkeyup="value=value.replace(/[^\d]/g,'')" /> -
                        <input type="text" id="fax1" name="fax1" class="text" style="width:30px" onkeyup="value=value.replace(/[^\d]/g,'')" /> -
                        <input type="text" id="fax2" name="fax2" class="text" style="width:90px" onkeyup="value=value.replace(/[^\d]/g,'')" /> -
                        <input type="text" id="fax3" name="fax3" class="text" style="width:30px" onkeyup="value=value.replace(/[^\d]/g,'')" />
                        <input type="hidden" id="Fax" name="Fax" value="<%=Server.HtmlEncode(psj.PsjFax1) %>" />
                    </td>
                </tr>
                <tr>
                    <td align="right">手机：</td>
                    <td align="left"><input type="text" id="Mobile" name="Mobile" class="text" value="<%=Server.HtmlEncode(psj.PsjMobile) %>" onkeyup="value=value.replace(/[^\d]/g,'')" /></td>
                </tr>
                <tr>
                    <td align="right">Email：</td>
                    <td align="left"><input type="text" id="Email" name="Email" class="text" value="<%=Server.HtmlEncode(psj.PsjEmail) %>" /></td>
                </tr>
                <tr>
                    <td align="right">是否主联系人：</td>
                    <td align="left">
                        <input type="checkbox" id="ckbIfMain" name="ckbIfMain" value="1" />
                        <input type="hidden" id="IfMain" name="IfMain" value="<%=psj.IfMain %>" />
                    </td>
                </tr>
                <tr>
                    <td align="right">备注：</td>
                    <td align="left"><textarea id="Remark" name="Remark" rows="5" cols="30"><%=Server.HtmlEncode(psj.PsjRemark) %></textarea></td>
                </tr>
                <tr><td>&nbsp;</td></tr>
                <tr>
                    <td colspan="2">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td><div class="button" onclick="Save()">保存</div></td>
                                <td><div class="button" onclick="Back()">取消</div></td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <script type="text/javascript">
                            var message = "<%=ViewData["Message"] %>";
                            if (message != "") {
                                MsgTip.show({ msg: message, ico: "warning", top: 340 });
                            }
                        </script>
                        <input type="hidden" id="ID" name="ID" value="<%=psj.PsjID %>" />
                        <input type="hidden" id="Type" name="Type" value="<%=ViewData["Type"] %>" />
                        <input type="hidden" id="HaveMain" name="HaveMain" value="<%=ViewData["HaveMain"] %>" />
                    </td>
                </tr>
            </table>
            </form>
        </center>
    </div>
</asp:Content>
