<%@ Page Title="" Language="C#" MasterPageFile="~/Dialog/DialogMaster.Master" AutoEventWireup="true"
    CodeBehind="RoleEdit.aspx.cs" Inherits="OAWeb.Role.RoleEdit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="form" style="width: 600px; padding: 10px;">
        <table cellpadding="0" cellspacing="0" border="0" class="table_form">
            <tr>
                <td class="right">
                    编号：
                </td>
                <td>
                    <asp:TextBox ID="txtCode" runat="server" CssClass="text width200"></asp:TextBox>
                    <asp:CheckBox ID="chkEnabled" runat="server" Checked="True" Text="启用" />
                </td>
            </tr>
            <tr>
                <td class="right">
                    角色名称：
                </td>
                <td>
                    <asp:TextBox ID="txtRoleName" runat="server" CssClass="text width200"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="right">
                    排序号：
                </td>
                <td>
                    <asp:TextBox ID="txtSortCode" runat="server" CssClass="text width40" Text="0"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="right">
                    备注:
                </td>
                <td>
                    <asp:TextBox ID="txtRemark" runat="server" CssClass="text" Width="99%" Height="75px"
                        TextMode="MultiLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>                    
                    <input id="btnSave" type="button" value=" 保 存 " class="btn_77px" />
                    <input id="btnClose" type="button" value=" 返 回 " onclick="art.dialog.close();return false;"
                        class="btn_77px" />
                </td>
            </tr>
        </table>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            jQuery.validator.addMethod("CodeIsExist", function (value, element) {
                return AjaxChecked("RoleEdit.aspx", "op=CodeIsExist&code=" + value + "&Id=<%=Id %>&r=" + Math.random()); alert(b);
            }, "您输入的编码已经存在");
            jQuery.validator.addMethod("RoleNameIsExist", function (value, element) {
                return AjaxChecked("RoleEdit.aspx", "op=RoleNameIsExist&name=" + value + "&Id=<%=Id %>&r=" + Math.random());
            }, "您输入的角色已经存在");
            rulesValue = { '<%=txtCode.UniqueID %>': { required: true, CodeIsExist: true }, '<%=txtRoleName.UniqueID %>': { required: true, RoleNameIsExist: true} };
            messagesValue = { '<%=txtCode.UniqueID %>': { required: "请输入编码" }, '<%=txtRoleName.UniqueID %>': { required: "请输入角色名称"} }
            var form = jQuery.validator.ValidateForm($("#aspnetForm"), rulesValue, messagesValue);
            $("#btnSave").click(function () {
                if (form.form()) {
                    $("#aspnetForm").ajaxSubmit({
                        url: "/Role/RoleEdit.aspx?op=Save&Id=<%=Id %>",
                        success: function (result) {
                            if (result == "ok") {
                                alert("保存成功");
                                CloseReload();
                            } else {
                                alert(result);
                            }
                        }
                    });
                }
                return false;
            })
        });
    </script>
</asp:Content>
