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

function Usersbtn(){
    var Usersid = $.trim($("#User_Id").val());
    var Usersname = $.trim($("#User_Name").val());
    var Userspwd = $.trim($("#User_Pwd").val());
    var UserImg = $.trim($("#imgSelf").attr("src"));
    var Userduce = $.trim($("#User_Duce").val());
    var Usersqq = $.trim($("#User_QQ").val());
    var Usersmail = $.trim($("#User_mail").val());
    var Usersmoney = $.trim($("#User_Money").val());
    var Usersjifen = $.trim($("#User_jifen").val());
    var Userstel = $.trim($("#User_tel").val());
    var Usersex = $('input[name=User_Sex]:checked').val();
    var Usertate = $('input[name=User_Tate]:checked').val();
    var UserGrous = $('input[name=User_Grous]:checked').val();
    var UserStatus = $('input[name=User_Status]:checked').val();
    var UserAuth = $('input[name=User_Auth]:checked').val();
    var UserNotes = $.trim($("#User_Notes").val());


    $.post("/ajax/Admin_UserEdit.ashx", { "Usersid": Usersid, "Usersname": Usersname, "Userspwd": Userspwd, "Usersqq": Usersqq, "Usersmail": Usersmail, "Usersmoney": Usersmoney, "Usersjifen": Usersjifen, "Userstel": Userstel, "Userduce": Userduce, "UserImg": UserImg, "Usersex": Usersex, "Usertate": Usertate, "UserGrous": UserGrous, "UserStatus": UserStatus, "UserNotes": UserNotes,"UserAuth":UserAuth }, function (data) {
        if (data == "ok") {
            alert("修改成功");
            window.location.href = "./Admin_UserList.aspx";
        } else {

            alert("修改失败");
        }


    

    }

)

};

$(function () {
    $("#UserStatus,#UserStatus").on("change", function () {
        if ($(this).val() == "0" || $(this).val() == "1" || $(this).val() == "3") {
            $("#Rtionst").hide();
        } else {
            $("#Rtionst").show();

        }

    })


})


$(function () {
    $("#Person_btn").click(function () {
        var id = $.trim($("#userid").val());
        var UserNames = $.trim($("#User_Names").val());
        var UserAddress = $.trim($("#User_Address").val());
        var UserCard = $.trim($("#User_Card").val());
        var UserWebSite = $.trim($("#User_WebSite").val());
        var imgSelf = $.trim($("#imgSelf").attr("src"));
        var imgSelfs = $.trim($("#imgSelf").attr("src"));
        var imgSelfz = $.trim($("#imgSelfz").attr("src"));
        $.post("/ajax/Admin_UserList.ashx", { "type": "Person","id":id, "UserNames": UserNames, "UserAddress": UserAddress, "UserCard": UserCard, "UserWebSite": UserWebSite, "imgSelf": imgSelf, "imgSelfs": imgSelfs, "imgSelfz": imgSelfz }, function (data) {
            var data = ('(' + data + ')');
            if (data.Success = true) {
                alert("修改成功");
                window.location.href = "./Admin_UserList.aspx";
            } else {
                alert("修改失败");
                return;

            }



        })

    })
 
    $("#Prise_btn").click(function () {
        var id = $.trim($("#userid").val());
        var UserPrise = $.trim($("#User_Prise").val());
        var UserCredit = $.trim($("#User_Credit").val());
        var UserAddress = $.trim($("#User_Address").val());
        var UserWebSite = $.trim($("#User_WebSite").val());
        var UserNames = $.trim($("#User_Names").val());
        var UserCard = $.trim($("#User_Card").val());
        var imgSelf = $.trim($("#imgSelf").attr("src"));
        $.post("/ajax/Admin_UserList.ashx", { "type": "Prise", "id": id, "UserPrise": UserPrise, "UserCredit": UserCredit, "UserAddress": UserAddress, "UserWebSite": UserWebSite, "UserNames": UserNames, "UserCard": UserCard, "imgSelf": imgSelf }, function (data) {
            var data = ('(' + data + ')');
            if (data.Success = true) {
                alert("修改成功");
                window.location.href = "./Admin_UserList.aspx";
            } else {
                alert("修改失败");
                return;
            }

        })

    })

    $("#Messbtn").click(function () {
        var id = $.trim($("#usersid").val());
        var Title = $.trim($("#MessTitle").val());
        var Notes = $.trim($("#MessNotes").val());
        if (Title == "") {
            alert("站内信标题不能为空");
            return;
        }
        if (Notes == "") {
            alert("站内信内容不能为空");
            return;
        } else {
            $.post("/ajax/Admin_UserList.ashx", { "type": "Mess", "id": id, "Title": Title, "Notes": Notes }, function (data) {
                var data = ('(' + data + ')');
                if (data.Success = true) {
                    alert("发送成功");
                    window.location.href = "./Admin_UserList.aspx";
                } else {
                    alert("发送失败");
                    return;
                }


            })

        }

    })

})