/// <reference path="jquery-1.10.2.min.js" />

$(function () {
    $("#Game_Cate_Add_Btn").click(function () {
        var GameCateName = $.trim($("#Game_Cate_Name").val());
        if (GameCateName == "") {
            alert("分类名称不能为空");
            return;
        } else {
            $.post("/ajax/Admin_GameBase.ashx", { "type": "CateAdd", "GameCateName": GameCateName }, function (data) {
                var data = eval('(' + data + ')');
                if (data.Success == true) {
                    alert("添加成功");
                    window.location.href = "./Admin_GameCateGoryList.aspx";
                } else {
                    alert("添加失败");
                }
            })
        }


    })
    $("#Game_Cate_Edit_Btn").click(function () {
        var gamecateeditid = $.trim($("#Game_Cate_Edit_Id").val());
        var gamecateeditname = $.trim($("#Game_Cate_Edit_Name").val());
        if (gamecateeditname == "") {
            alert("分类名称不能为空");
            return;

        } else {
            $.post("/ajax/Admin_GameBase.ashx", { "type": "CateEdit", "gamecateeditid": gamecateeditid, "gamecateeditname": gamecateeditname }, function (data) {
                var data = eval('(' + data + ')');
                if (data.Success == true) {
                    alert("修改成功");
                    window.location.href = "./Admin_GameCateGoryList.aspx";

                }else{
                    alert("修改失败");
                
                }
            })

        }

    })

})

function CataDel(id) {
    if (!confirm("确定要删除吗？") == true) {
        return true;

    } else {

        $.post("/ajax/Admin_GameBase.ashx", { "type": "CataDel", "id": id }, function (data) {
            var data = eval('(' + data + ')');
            if (data.Success == true) {
                alert("删除成功");
                window.location.href = "./Admin_GameCateGoryList.aspx";
            } else {
                alert("删除失败");

            } if (data.Success == false) {
                alert("该分类余下有手游数据,请清除数据再来删除");
            }


        })
    }


}