<%@ Page Language="C#" enableEventValidation="false" AutoEventWireup="true" CodeFile="role_edit.aspx.cs" Inherits="general_role_role_edit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>角色编辑</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <link href="../../styles/1/style.css" rel="stylesheet" type="text/css" />

    <script language="JavaScript">
function CheckForm()
{
   if(document.getElementById("USER_PRIV").value=="1")
   { if(!window.confirm("本角色为内置的‘超级系统管理员’角色，确定要改其名称吗？"))
     return (false);
   }
   
   if(document.getElementById("PRIV_NO").value=="")
   { alert("角色序号不能为空！");
     return (false);
   }

   if(document.getElementById("PRIV_NAME").value=="")
   { alert("角色称谓不能为空！");
     return (false);
   }
}
    </script>

</head>
<body class="bodycolor" topmargin="5">
    <table border="0" width="100%" cellspacing="0" cellpadding="3" class="small">
        <tr>
            <td class="Big">
                <img src="~/images/edit.gif" width="22" height="20" align="absmiddle" id="IMG1" runat="server"><span
                    class="big3"> 编辑角色</span>
            </td>
        </tr>
    </table>
    <form runat="server" id="form1" class="center">
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" OnRowCommand="GridView1_RowCommand" BorderWidth="0px">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <table border="0" cellspacing="1" width="450" class="small" bgcolor="#000000" cellpadding="3"
                            align="center" style="text-align: left;">
                            <form action="update.php" method="post" name="form1" onsubmit="return CheckForm();">
                                <tr>
                                    <td nowrap class="TableData">
                                        角色排序号：</td>
                                    <td nowrap class="TableData">
                                        <input type="text" name="PRIV_NO" class="BigInput" size="3" maxlength="3" id="PRIV_NO"
                                            runat="server" value='<%#Eval("PRIV_NO") %>'>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td nowrap class="TableData">
                                        角色名称：</td>
                                    <td nowrap class="TableData">
                                        <input type="text" name="PRIV_NAME" class="BigInput" size="25" maxlength="100" id="PRIV_NAME"
                                            runat="server" value='<%#Eval("PRIV_NAME") %>'>&nbsp;
                                    </td>
                                </tr>
                                <tr>
                                </tr>
                                <tr>
                                </tr>
                                <td nowrap class="TableControl" colspan="2" align="center">
                                    <input type="hidden" name="USER_PRIV" id="USER_PRIV" runat="server" value='<%#Eval("USER_PRIV") %>'>
                                    <asp:Button ID="Button1" runat="server" CssClass="BigButton" Text="确定" CommandName="Update" />
                                    <input type="button" value="返回" class="BigButton" onclick="location='default.aspx'">
                                </td>
                            </form>
                            </TR></TBODY></table>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:hqglConnectionString %>" 
        SelectCommand="SELECT [USER_PRIV], [PRIV_NAME], [PRIV_NO] FROM [user_priv] WHERE ([USER_PRIV] = @USER_PRIV)" 
        UpdateCommand="UPDATE [user_priv] SET [PRIV_NAME] = @PRIV_NAME, [PRIV_NO] = @PRIV_NO WHERE [USER_PRIV] = @USER_PRIV">
            <UpdateParameters>
                <asp:Parameter Name="PRIV_NAME" Type="String" />
                <asp:Parameter Name="PRIV_NO" Type="Int32" />
                <asp:Parameter Name="USER_PRIV" Type="Int32" />
            </UpdateParameters>
            <SelectParameters>
                <asp:QueryStringParameter DefaultValue="0" Name="USER_PRIV" QueryStringField="id"
                    Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
    </form>
    
</body>
</html>
