<%@ Page Language="C#" EnableEventValidation="false"  MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin.Exam.Admin_ZGCardCreate" Title="生成准考证管理" Codebehind="KS.ZGCardCreate.aspx.cs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" Runat="Server">
   <KS:TopNav ID="TopNav1" runat="server" />
<div class="content-area">
    <asp:Panel ID="Panel1" runat="server" Width="100%" Visible="false">
    
<script type="text/javascript">
		 function searchUser()
		 {jQuery('#ajaxmsg',window.parent.document).fadeIn("slow");
					  var url = '../../plus/ajaxs.ashx'; 
					  jQuery.get(url,{a:"SearchUser",key:(jQuery("#key").val())},function(s){
					  jQuery('#ajaxmsg',window.parent.document).fadeOut("slow");
					   showResponse(s);
					  })    
		 }
		 function showResponse(s)
		  {
						  var result=s;
						  if (result!='')
						  {
							  var obj = jQuery('#user_search')[0];
							  obj.length = 0;
							  var rarr=result.split('|');
								for (var i = 0; i < rarr.length; i++)
								{
									 if (rarr[i]!=''){
									  var opt = document.createElement('OPTION');
									  opt.value = rarr[i];
									  opt.text  = rarr[i];
									  obj.options.add(opt);
									   }
								}
						  }
		 }
		function addUser()
				  {
					  var src = document.getElementById('user_search');
					  var dest = document.getElementById('user');
				
					  for (var i = 0; i < src.options.length; i++)
					  {
						  if (src.options[i].selected)
						  {
							  var exist = false;
							  for (var j = 0; j < dest.options.length; j++)
							  {
								  if (dest.options[j].value == src.options[i].value)
								  {
									  exist = true;
									  break;
								  }
							  }
							  if (!exist)
							  {
								  var opt = document.createElement('OPTION');
								  opt.value = src.options[i].value;
								  opt.text = src.options[i].text;
								  dest.options.add(opt);
							  }
						  }
					  }
				  }
				
				  function delUser()
				  {
					  var dest = document.getElementById('user');
				
					  for (var i = dest.options.length - 1; i >= 0 ; i--)
					  {
						  if (dest.options[i].selected)
						  {
							  dest.options[i] = null;
						  }
					  }
				  }
				function check()
				{
					var idArr = new Array();
					var dest = document.getElementById('user');
					for (var i = 0; i < dest.options.length; i++)
					{
						dest.options[i].selected = "true";
						idArr.push(dest.options[i].value);
					}
					if (idArr.length <= 0)
					{
						alert("你没有选择用户!");
						return false;
					}
					else
					{
						return true;
					}
				  
				}
				</script>    
        <table width="99%" align="center"  border="0" cellpadding="1" cellspacing="1" class="CTable"> 
          <tr>
           <td colspan="2" class="lefttd" style="color:Red;font-weight:bold">1、按部门生成准考证</td>
          </tr>
          <tr>
            <td class="lefttd" height="30" align="right" style="width: 99px"><strong>选择部门：</strong></td>
            <td class="righttd">
               <asp:ListBox ID="LstDepartID" SelectionMode="Multiple" runat="server" Width="250px" Height="140px">
               
               </asp:ListBox>
               <span class="tips">TIPS:按Ctrl或Shift可以多选。</span>
            </td>
          </tr>
          <tr>
            <td class="lefttd" height="30" align="right" style="width: 99px"><strong>生成位数：</strong></td>
            <td class="righttd">
             <span style="font-size:16px;font-weight:bold"> <%=CardPre%></span> 加 <asp:TextBox ID="TxtCardNum" runat="server" Text="3" CssClass="textbox" style="width:50px;text-align:center"/>位数字
            <br />
             <strong>后几位生成顺序：</strong><asp:RadioButtonList ID="RdbCreateRnd" runat="server">
              <asp:ListItem Value="0" Selected>顺序生成(如001,002,...,100等)</asp:ListItem>
              <asp:ListItem Value="1">随机数</asp:ListItem>
             </asp:RadioButtonList>
            </td>
          </tr>

          <tr>
          <td class="lefttd" height="30" style="width: 99px"></td>
           <td class="righttd">
           <asp:Button ID="Button1" runat="server" CssClass="button" Text="确定生成准考证" OnClick="Button1_Click" />
           </td>
          </tr>
         </table>
         <br />
        <table width="99%" align="center" border="0" cellpadding="1" cellspacing="1" class="CTable"> 
          <tr>
           <td colspan="3" class="lefttd" style="color:Red;font-weight:bold">2、按用户生成</td>
          </tr>
          <tr>
            <td class="righttd" colspan="3">
               <strong>关键字：</strong><input type="text" class="textbox" name="key" id="key" size="20"/>
               <input type="button" value="搜索用户" class="button" onclick="searchUser();"/>
            </td>
          </tr>
          <tr align='center'>
						<td height='25' class='clefttitle' style="text-align:center">会员列表</td>
						<td  class='clefttitle' style="text-align:center">操作</td>
						<td  class='clefttitle' style="text-align:center">给下列用户生成准考证</td>
		  </tr>
          <tr align='center'>
						<td height='25' class='righttd' style="text-align:center">
						<select name="user_search" id="user_search" size="15" style="width:260px" ondblclick="addUser()" multiple="true">
						  </select>
						</td>
						<td  class='righttd' style="text-align:center">
						<p><input type="button" value=" > " onclick="addUser()" class="button" /></p>
						<br />
						<p><input type="button" value=" < " onclick="delUser()" class="button" /></p>
						</td>
						<td  class='righttd' style="text-align:center">
						<select name="user" id="user" multiple="true" size="15" style="width:260px" ondblclick="delUser()">
						  </select>
						</td>
		  </tr>
  <tr>
            <td class="righttd" height="30" colspan="3"><strong>生成位数：</strong>
             <span style="font-size:16px;font-weight:bold"> <%=CardPre%></span> 加 <asp:TextBox ID="TxtNum1" runat="server" Text="3" CssClass="textbox" style="width:50px;text-align:center"/>位数字
             <strong>后几位生成顺序：</strong><asp:RadioButtonList ID="RdbCreateRnd1" runat="server" 
                    RepeatDirection="Horizontal" RepeatLayout="Flow">
              <asp:ListItem Value="0" Selected>顺序生成(如001,002,...,100等)</asp:ListItem>
              <asp:ListItem Value="1">随机数</asp:ListItem>
             </asp:RadioButtonList>
            </td>
          </tr>
          
          <tr>
           <td colspan="3" class="righttd" style="height:50px;text-align:center">
           
           <asp:Button ID="Button2" runat="server" CssClass="button" Text="确定生成准考证" OnClientClick="return(check())" OnClick="Button2_Click" />
           </td>
          </tr>
         </table>
         <br /><br />
     
    </asp:Panel>
    
    <asp:Panel ID="Panel2" runat="server" Width="100%" Visible="false">

       
    </asp:Panel>
</div>
</asp:Content>

