<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="member_change_cardno.aspx.cs" Inherits="VA.Modules.JDingMember.member.member_change_cardno" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <!--#include virtual="/include/css/edit.aspx"-->
    <!--#include virtual="/include/js/edit.aspx"-->     
    <script type="text/javascript">
    function save() {

        //调用asp.net验证控件自带的js数据验证脚本对控件进行验证；
        var validationResult = Page_ClientValidate('');
        if (!validationResult) {
            return;
        }

        JTongAlertConfirm("确定要补卡吗？", function () {

            var requestType = "POST";
            var url = pageName + "?act=save";  //pageName在BasePage中注册到的客户端；
            var dataType = "html";
            var data = $("form").eq(0).serialize();
            var successFN = function (data, textStatus) {
                var logID = "";
                if (data.substring(0, 2) == "ok") {
                    logID = data.split("|")[1];
                    showActResult("补卡成功！", true, logID);
                } else if (data.indexOf("01|") != -1) {
                    showActResult(data.substring(3), false, logID);
                }
                else {
                    showActResult("补卡失败：" + data, false, logID);
                }
            };
            ajaxRequest(requestType,
            url,
            dataType,
            data,
            successFN,
            errorFN
            );         
     
        });        
    }

    //显示操作结果；
    function showActResult(sMsg,actResult, logID) {
        if (actResult) {
            JTongAlert('操作结果', sMsg, 'info', function () {

                if ($("#ckbNotify")[0].checked == true) {
                    var memberID = $("#hfMemberID").val();
                    ajaxExecute("get", "../notification/biztransaction_notify.aspx", { "biztype": "membermanage", "bizno": logID, "act": "changecard" });
                }

                resetPage();
            });

        } else {
            JTongAlert('操作结果', sMsg, 'error');
        }
    }

    function resetPage() {

        clearMemberInfo();

        $("#txtNewCardNo").attr("disabled", "disabled");
        $("#btnSubmit").attr("disabled", "disabled");

        $("#txtNewCardNo").val("");

        //清除错误提示样式；
        clearInputValidatorError();
    }

    //会员信息加载成功时调用的方法；            
    function doWhenMemberInfoLoadSuc() {
        $("#txtNewCardNo").removeAttr("disabled");
        $("#btnSubmit").removeAttr("disabled");

        $("#txtNewCardNo").focus();
    }

    //会员信息加载失败时调用的方法；
    function doWhenMemberInfoLoadFail() {
        $("#txtNewCardNo").focus();
    }
    
    $(function () {        
        if ($("#hfMemberID").val() == "") {
            $("#txtNewCardNo").attr("disabled", "disabled");
            $("#btnSubmit").attr("disabled", "disabled");
        }
    });

    </script>
</head>
<body>
<form id="Form1" method="post" runat="server">

<div class="editPageWrapper" style="width:700px;">

<div class="centerFormTitle">
   <h1>会员补卡</h1>
</div>

<!--#include file="../include/memberinfo.aspx"-->     

<table cellspacing="0" cellpadding="3" class="editTable" style="margin-top:-1px;">
<tr>
<td class="th" colspan="2" style="font-weight:bold;text-align:left;">补卡信息</td>
</tr>
<tr>
<td class="th">当前日期：</td>
<td>    
	<% = DateTime.Now %>
</td>
</tr>
<tr>
<td class="th">操作员：</td>
<td>    
	<% = base.EmployeeName %>
</td>
</tr>
<tr>
<td class="th">(<span class="note mustfill">*</span>)新卡号：</td>
<td>
    <VACTL:TextBox runat="server" ID="txtNewCardNo" 
            CssClass="input" 
            Width="150px" 
            CanBeNull="No"           
            FieldName="新卡号"
            />
</td>
</tr>
<tr>
<td colspan="2" class="footer">

    <asp:CheckBox ID="ckbNotify" runat="server"
             Text="短信通知" />    
    <input type="button" id="btnSubmit" class="btn" style="width:80px" onclick="save()" value="保存" />
    <input type="button" id="btnClear" class="btn" style="width:80px" onclick="resetPage()" value="重置" />
    
    <VACTL:Hint ID="Hint1" runat="server" HintImageUrl="/app_themes/default/images/textbox" />
    <VACTL:ValidationSummary ID="ValidationSummary1" runat="server"
            DisplayMode="List"
            EnableClientScript="true" />
    
    <!--注意：这个文件一定要放到页面底部，以便覆盖asp.net验证脚本中的同名函数-->
    <script type="text/javascript" src="/scripts/utils/aspnet_validator_extend.js"></script>

</td>
</tr>
</table>

</div><!--editPageWrapper.END-->

</form>
</body>
</html>

