function PlugInit(type) {
    $("#BtnDef").click(function () { BtnPlugClick(); });
    $("#BtnInit").click(function () { BtnInitClick() });    
}

function BtnPlugClick() {
    CreateOninit();
    var sql = $("#TSQL").val();    
    if (sql != "") {
        $.ajax({
            type: "post",
            url: "dataajax.aspx?type=tsql&r=" + Math.random(),
            data: { TSQL: sql },
            beforeSend: function (XMLHttpRequest) {
                CmsData.Common.BtnDisabled(true);
            },
            success: function (data) {
                $("#TSQLState").html(data);
                CmsData.Common.BtnDisabled(false);
            }
        });
    }
}

function BtnInitClick() {
    if (confirm("确定初始化数据库?此操作不可恢复!非技术人员请勿操作")) {
        CreateOninit();
        $.ajax({
            type: "get",
            url: "dataajax.aspx?type=tsqlinit&r=" + Math.random(),
            beforeSend: function (XMLHttpRequest) {
                CmsData.Common.BtnDisabled(true);
            },
            success: function (data) {
                $("#TSQLState").html(data);
                CmsData.Common.BtnDisabled(false);
            }
        });
    }
}

function CreateOninit() {
    $("#TSQLState").html("");
}