<%@ Page Language="C#" MasterPageFile="Admin.Master" AutoEventWireup="true" CodeBehind="Adminmanage.aspx.cs" Inherits="Mvcb2b.admin.Adminmanage" Title="管理员管理" %>
<%@ MasterType VirtualPath="Admin.Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script type="text/javascript" src="<%=Fun.Webdirectory %>Comja/md5.js"></script> 
<script type="text/javascript" src="../Comja/val_num.js"></script>
<script  type="text/javascript">                   
function check_Pass(source, args) { 
	        args.IsValid = true;
	        //密码强度正则，最少6位，包括至少1个大写字母，1个小写字母，1个数字，1个特殊字符
	        var pPattern = /^.*(?=.{6,12})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*? ]).*$/;
	        //输出 true
	        // console.log("=="+pPattern.test("iFat3#"));

	       // var ispass = pPattern.test(args.Value);
	        var ispass = true;
	        if (ispass == false)
	            args.IsValid = false;
                
                 
	     if (args.Value.length < 6)
	     {
	  //   alert("你输入的密码太短了，至少要 5 个字符...");	      
	      args.IsValid = false;
	     }
	     if (args.Value.length > 12)
	     {
    	// alert("你输入的密码太长，最长不可超过 15 个字符...");
    	  args.IsValid = false;
    	 }
    	}
    	 
    	 function check_PassI(source, args)
    	{
    	 args.IsValid = true;
    	 if (args.Value !=$('#<%=adminpass_txt.ClientID%>').val())
    	 {
    	// alert("「确认密码」与「密码」必须要完全相同..");
    	  args.IsValid = false;
    	 }
}


function check_Passedit(source, args) { 
    args.IsValid = true;
    var passvalue = args.Value;
    if (passvalue.length > 1) {
        //密码强度正则，最少6位，包括至少1个大写字母，1个小写字母，1个数字，1个特殊字符
        var pPattern = /^.*(?=.{6,12})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*? ]).*$/;
        //输出 true
        // console.log("=="+pPattern.test("iFat3#"));

        // var ispass = pPattern.test(args.Value);
        var ispass = true;
        if (ispass == false)
            args.IsValid = false;


        if (args.Value.length < 6) {
            //   alert("你输入的密码太短了，至少要 5 个字符...");	      
            args.IsValid = false;
        }
        if (args.Value.length > 12) {
            // alert("你输入的密码太长，最长不可超过 15 个字符...");
            args.IsValid = false;
        }
    }
}

function check_PassI(source, args) {
    args.IsValid = true;
    if (args.Value != $('#<%=adminpass_txt.ClientID%>').val()) {
        // alert("「确认密码」与「密码」必须要完全相同..");
        args.IsValid = false;
    }
}


$(function () {
    $("#ctl00_ContentPlaceHolder1_Edit").click(function (e) {
        var pass = $('#ctl00_ContentPlaceHolder1_adminpass_txt').val();
        if (pass != "") {
            pass = hex_md5(pass);
        }
        $('#ctl00_ContentPlaceHolder1_adminpass_txt').val(pass);
        var pass2 = $('#ctl00_ContentPlaceHolder1_adminpassI_txt').val();
        if (pass2 != "") {
            pass2 = hex_md5(pass2);
        }
        $('#ctl00_ContentPlaceHolder1_adminpassI_txt').val(pass2);
    });

    $("#ctl00_ContentPlaceHolder1_Add").click(function (e) {
        var pass = $('#ctl00_ContentPlaceHolder1_adminpass_txt').val();
        if (pass != "") {
            pass = hex_md5(pass);
        }
        $('#ctl00_ContentPlaceHolder1_adminpass_txt').val(pass);
        var pass2 = $('#ctl00_ContentPlaceHolder1_adminpassI_txt').val();
        if (pass != "") {
            pass2 = hex_md5(pass2);
        }
        $('#ctl00_ContentPlaceHolder1_adminpassI_txt').val(pass2);
    });
});
</script>
    
<div class="path">当前位置： 系统管理 >>  管理员管理</div>
<h3>管理员管理</h3>
        <asp:GridView ID="GridView1"  HorizontalAlign="Center" Width="98%" EnableViewState="False" 
                                runat="server" AllowPaging="True" AutoGenerateColumns="False" 
                                OnPageIndexChanging="haopage" AllowSorting="True" OnRowDeleting="Haodel" 
                                OnRowEditing="haoedit" GridLines="None" DataKeyNames="id" CellPadding="4" 
                                ForeColor="#333333" >
                <RowStyle BackColor="#FFFBD6" ForeColor="#333333" HorizontalAlign="Center" />
                <Columns >
                <asp:BoundField DataField="id" HeaderText="编号" SortExpression="id" />
                <asp:BoundField DataField="adminuser" HeaderText="管理员" />
                <asp:BoundField DataField="adminname" HeaderText="姓名" />
                    <asp:BoundField DataField="editdate" HeaderText="上次修改" />
                    <asp:CommandField HeaderText="编辑" ShowEditButton="True" ShowHeader="True" 
                        UpdateText="edit" />
                    <asp:CommandField HeaderText="删除"  ShowDeleteButton="True"  ShowHeader="True" 
                        DeleteText="&lt;div onclick=&quot;return confirm('确实要删除吗?');&quot;&gt;删除&lt;/div&gt;" />
            </Columns>        
                <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                <AlternatingRowStyle BackColor="White" />
        </asp:GridView>  
        <div class="pagemsg"><asp:label id="Message" runat="server" ></asp:label>
				 &nbsp; 直接进入 <asp:textbox  id="gopage" TabIndex="9" Width="30px" runat="server" > </asp:textbox> 
            页 <asp:button id ="Submithao"  Text="Go" runat="server" OnClick="Submithao_Click"></asp:button>  </div>
				 <br />
				 <br />
	<table border="0" class="tableadd"  align="center" >
    <tr>
        <td colspan="2" valign="middle" style="text-align:center;"><Label ID="Label1" runat="server">
            添加管理员</Label><Label ID="Label2" runat="server" >用户修改</Label></td>
    </tr>
     <tr>
        <td align="right">用户名：</td><td><asp:TextBox ID="adminuser_txt" TabIndex="1" runat="server" Text=""  ></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="用户名不能为空" Display="None" ControlToValidate="adminuser_txt"></asp:RequiredFieldValidator></td>
    </tr>
    <tr>
        <td align="right">
            姓 名：</td><td><asp:TextBox ID="adminname_txt" runat="server" TabIndex="2"  Text="" ></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="姓名不能为空" Display="None" ControlToValidate="adminname_txt"></asp:RequiredFieldValidator></td>
    </tr>
    <tr>
        <td align="right">
            管理级别：</td><td><asp:dropdownlist id="jbid_txt" TabIndex="3" runat="server" >	
									<asp:ListItem Value="">请选择</asp:ListItem>									
								</asp:dropdownlist></td>
    </tr>
    <tr>
        <td align="right">密 码：</td><td><asp:TextBox ID="adminpass_txt" TabIndex="4" TextMode="Password" runat="server"  Text=""  ></asp:TextBox>
           <asp:requiredfieldvalidator id="RequiredFieldValidator4" runat="server" ControlToValidate="adminpass_txt" Display="None"
								ErrorMessage="密码不能为空！">密码不能为空！</asp:requiredfieldvalidator>
                                
                                <asp:customvalidator id="CustomValidator2" runat="server" ControlToValidate="adminpass_txt" Display="None"
								ErrorMessage="密码格式不正确！6-12位的大小写英文字母+特殊符号+数字,如：User#123" ClientValidationFunction="check_Pass">密码格式不正确！</asp:customvalidator>
                                
                                
                                 <asp:customvalidator id="CustomValidatoredit" runat="server" ControlToValidate="adminpass_txt" Display="None"
								ErrorMessage="密码格式不正确！6-12位的大小写英文字母+特殊符号+数字,如：User#123" ClientValidationFunction="check_Passedit">密码格式不正确！</asp:customvalidator>
                                
                                </td>
    </tr>
    <tr>
        <td align="right">确 认：</td><td><asp:textbox id="adminpassI_txt" TabIndex="5" runat="server" TextMode="Password" Text="" ></asp:textbox> <asp:requiredfieldvalidator id="RequiredFieldValidator5" runat="server" ControlToValidate="adminpassI_txt" Display="None"
								ErrorMessage="确认密码不能为空！">确认密码不能为空！</asp:requiredfieldvalidator><asp:customvalidator id="Customvalidator4" runat="server" ControlToValidate="adminpassI_txt" Display="None"
								ErrorMessage="确认密码必须和密码相同！" ClientValidationFunction="check_PassI">确认密码必须和密码相同！</asp:customvalidator></td>
    </tr>
    <tr>
        <td  colspan="2"  style="text-align:center;">
            <asp:Button ID="Add" runat="server" Text="添加"  Width="80px" TabIndex="6" OnClick="Add_Click"></asp:Button>
            <asp:Button ID="Edit" runat="server"  Text="修改" Width="80px" TabIndex="7" onclick="Edit_Click"   /> 	  
            <asp:validationsummary id="ValidationSummary1" runat="server" ShowMessageBox="True" ShowSummary="False"></asp:validationsummary>  
        </td>
    </tr>
</table>
</asp:Content>
