var code = getQuery("code");
$(document).ready(function () {
    if (code)
        getFundType();
    else {
        closeLoading();
        $("#divMain").show();
    }
});
function getFundType() {
    ajax({
        loading: true,
        url: "TreasuryApi/GetFunderType",
        data: { code: getQuery("code") },
        success: function (result) {
            $("#txtName").val(result.Name);
            closeLoading();
            $("#divMain").show();
        }
    });
}
function save() {
    var exceptionText = checkValidation("");
    if (exceptionText === "") {
        var data = getJsonValue();
        if (code)
            data["Code"] = code;
        ajax({
            loading: true,
            url: "TreasuryApi/" + (code ? "UpdateFunderType" : "InsertFunderType"),
            data: data ,
            success: function (result) {
                showMsgModal(2, result.FinalMessage.join("<br />"));
                refreshParent("refresh()");
                closeTopModal();
            }
        });
    }
    else {
        showMsgModal(0, exceptionText);
    }
}
