function ClearIdPool() {

    $.ajax({
        url: "/OverView/ClearIdPool",
        type: 'POST',
        cache: false,
        data: {},
        success: function (result) {
            if (result.code == 0) {
                alert("清理成功！");
            }
            else {
                alert('清理失败！');
            }

        },
        error: function (e) {
            alert('清理失败！');
        }
    });

    return false;
}


function sendMessage() {
    $("#Message").removeClass("redBorder");

    if (!$("#Message").val()) {
        $("#Message").addClass("redBorder");
        return;
    }
    $.ajax({
        url: "/OverView/SendMessage",
        type: 'POST',
        cache: false,
        data: {Message:$("#Message").val(),Url:$("#Url").val()},
        success: function (result) {
            if (result.code == 0) {
                location.reload();
            }
            else {
                alert('推送失败！');
            }
        },
        error: function (e) {
            alert('推送失败！');
        }
    });
}

function cancelMessage() {
    $.ajax({
        url: "/OverView/CancelMessage",
        type: 'POST',
        cache: false,        
        success: function (result) {
            if (result.code == 0) {
                location.reload();
            }
            else {
                alert('取消推送失败！');
            }

        },
        error: function (e) {
            alert('取消推送失败！');
        }
    });
}

$(function () {

    $('#btnIdClear').click(function () {
        if (confirm("确定清理Id Pool？")) {
            ClearIdPool();
        }
    });

    $('#btnSend').click(function () {        
        sendMessage();        
    });

    $('#btnCancel').click(function () {
        cancelMessage();
    });     
});

