<%@Page Language="C#" Inherits="IWMS.Admin.GatherUserRuleAdd" EnableViewState="true" MasterPageFile="admin.master"%>
<asp:Content ContentPlaceHolderId="cphHead" runat="server">
	<script type="text/javascript">
	<!--
	function Export(){
		var id = parseInt("<%=Request.QueryString["id"]%>");
		var ifm = document.getElementById("ifm_export");
		if (id>0){
			ifm.src = "admin_export.aspx?id="+id+"&w=userrule";
		}
		return false;
	}
	-->
	</script>

</asp:Content>
<asp:Content ContentPlaceHolderId="cphMain" runat="server">

	<form id="MyForm" runat="server">
		<asp:ValidationSummary 
			 DisplayMode="BulletList" 
			 EnableClientScript="true"
			 ShowSummary="false"
			 ShowMessageBox="true"                        
			 HeaderText="请正确填写以下内容"
			 runat="server"/>
	
	<div class="mframe">
	<div class="tl"></div>
	<div class="rt"></div>
	<div class="tm">
		<span class="tt"><asp:Literal id="titleAct" runat="server"/>会员数据采集规则</span>
	</div>
	<div class="wrapper">
	<div class="ml"></div>
	<div class="mr"></div>
	<div class="mm">
		<asp:Label id="myLabel" class="msgBar" EnableViewState="false" runat="server"/>
		<input type="hidden" id="hdStep" runat="server"/>
		 <table cellpadding="3" width="95%" align="center" style="table-layout:fixed;">
		 <asp:PlaceHolder id="step1" runat="server">
		 	<tr><th width="160">
		 		规则名：
		 	</th><td>
				<asp:TextBox Columns="20" MaxLength="100" id="name" runat="server"/>
				<asp:RequiredFieldValidator
					ControlToValidate="name"
					ErrorMessage="采集名必须填写"
					Display="None"
					runat="server"/>
			</td></tr>
			<tr><th>
		 		数据库类型：
		 	</th><td>
		 		<asp:RadioButtonList id="dbType" RepeatLayout="flow" runat="server">
		 			<asp:ListItem value="access" Selected="true">Access</asp:ListItem>
		 			<asp:ListItem value="sql">Sql Server</asp:ListItem>
		 		</asp:RadioButtonList>
	
		 	</td></tr>
			<tr><td height="30" align="center" colspan="2">
				<asp:Button text="下一步" onclick="Next_OnClick" runat="server"/> &nbsp;
			</td></tr>
		 </asp:PlaceHolder>
		 
		 <asp:PlaceHolder id="step2_1" Visible="false" runat="server">
		 	<tr><th width="160">
		 		Access数据库路径：
		 	</th><td>
		 		<asp:TextBox id="mdbPath" size="30" MaxLength="200" runat="server"/>
				<asp:RequiredFieldValidator
					ControlToValidate="mdbPath"
					ErrorMessage="数据库路径必须填写"
					Display="None"
					runat="server"/>
		 	</td></tr>
			<tr><td height="30" align="center" colspan="2">
				<asp:Button text="上一步" onclick="Prev_OnClick" CausesValidation="false" runat="server"/> &nbsp;
				<asp:Button text="下一步" onclick="Next_OnClick" runat="server"/> &nbsp;
			</td></tr>
		 </asp:PlaceHolder>
		 
		 <asp:PlaceHolder id="step2_2" Visible="false" runat="server">
		 	<tr><th width="160">
		 		sql服务器ip：
		 	</th><td>
		 		<asp:TextBox id="sqlIp" size="20" MaxLength="50" runat="server"/>
				<asp:RequiredFieldValidator
					ControlToValidate="sqlIp"
					ErrorMessage="sql服务器ip必须填写"
					Display="None"
					runat="server"/>
		 	</td></tr>
		 	<tr><th>
		 		sql数据库名：
		 	</th><td>
		 		<asp:TextBox id="sqlDb" size="20" MaxLength="50" runat="server"/>
				<asp:RequiredFieldValidator
					ControlToValidate="sqlIp"
					ErrorMessage="sql数据库名必须填写"
					Display="None"
					runat="server"/>
		 	</td></tr>
		 	<tr><th>
		 		用户名：
		 	</th><td>
		 		<asp:TextBox id="sqlUname" size="20" MaxLength="50" runat="server"/>
				<asp:RequiredFieldValidator
					ControlToValidate="sqlIp"
					ErrorMessage="sql用户名必须填写"
					Display="None"
					runat="server"/>
		 	</td></tr>
		 	<tr><th>
		 		密码：
		 	</th><td>
		 		<asp:TextBox id="sqlUpass" size="20" MaxLength="50" runat="server"/>
				<asp:RequiredFieldValidator
					ControlToValidate="sqlIp"
					ErrorMessage="sql密码必须填写"
					Display="None"
					runat="server"/>
		 	</td></tr>
			<tr><td height="30" align="center" colspan="2">
				<asp:Button text="上一步" onclick="Prev_OnClick" CausesValidation="false" runat="server"/> &nbsp;
				<asp:Button text="下一步" onclick="Next_OnClick" runat="server"/> &nbsp;
			</td></tr>
		 </asp:PlaceHolder>
		 
		 <asp:PlaceHolder id="step3" Visible="false" runat="server">
		 	<tr><th width="160">
		 		选择用户数据所在表：
		 	</th><td>
		 		<asp:DropDownList id="tableName" runat="server"/>
				<asp:RequiredFieldValidator
					ControlToValidate="tableName"
					ErrorMessage="用户数据所在表必须选择"
					Display="None"
					runat="server"/>
		 	</td></tr>
			<tr><td height="30" align="center" colspan="2">
				<asp:Button text="上一步" onclick="Prev_OnClick" CausesValidation="false" runat="server"/> &nbsp;
				<asp:Button text="下一步" onclick="Next_OnClick" runat="server"/> &nbsp;
			</td></tr>
		 </asp:PlaceHolder>
		 
		 <asp:PlaceHolder id="step4" Visible="false" runat="server">
		 	<tr><th width="160">
		 		用户名字段：
		 	</th><td>
		 		<asp:TextBox id="nameColumn" size="15" runat="server"/>
				<asp:RequiredFieldValidator
					ControlToValidate="nameColumn"
					ErrorMessage="用户名字段必须填写"
					Display="None"
					runat="server"/>
				 <select id="selName" onchange="SelChange(this,'<%=nameColumn.ClientID%>');"><option value="">选择</option></select>
				 *
		 	</td></tr>
		 	<tr><th>
		 		用户密码字段：
		 	</th><td>
		 		<asp:TextBox id="passwordColumn" size="15" runat="server"/>
				<asp:RequiredFieldValidator
					ControlToValidate="passwordColumn"
					ErrorMessage="密码字段必须填写"
					Display="None"
					runat="server"/>
				 <select id="selPassword" onchange="SelChange(this,'<%=passwordColumn.ClientID%>');"><option value="">选择</option></select>
				 *
		 	</td></tr>
		 	<tr><th>
		 		真实姓名：
		 	</th><td>
		 		<asp:TextBox id="realnameColumn" size="15" runat="server"/>
				 <select id="selRealname" onchange="SelChange(this,'<%=realnameColumn.ClientID%>');"><option value="">选择</option></select>
		 	</td></tr>
		 	<tr><th>
		 		注册日期字段：
		 	</th><td>
		 		<asp:TextBox id="addDateColumn" size="15" runat="server"/>
				 <select id="selAddDate" onchange="SelChange(this,'<%=addDateColumn.ClientID%>');"><option value="">选择</option></select>
		 	</td></tr>
		 	<tr><th>
		 		生日字段：
		 	</th><td>
		 		<asp:TextBox id="birthdayColumn" size="15" runat="server"/>
				 <select id="selBirthday" onchange="SelChange(this,'<%=birthdayColumn.ClientID%>');"><option value="">选择</option></select>
		 	</td></tr>
		 	<tr><th>
		 		性别字段：
		 	</th><td>
		 		<asp:TextBox id="maleColumn" size="15" runat="server"/>
				 <select id="selMale" onchange="SelChange(this,'<%=maleColumn.ClientID%>');"><option value="">选择</option></select>
		 	</td></tr>
		 	<tr><th>
		 		email字段：
		 	</th><td>
		 		<asp:TextBox id="emailColumn" size="15" runat="server"/>
				 <select id="selEmail" onchange="SelChange(this,'<%=emailColumn.ClientID%>');"><option value="">选择</option></select>
		 	</td></tr>
		 	<tr><th>
		 		qq字段：
		 	</th><td>
		 		<asp:TextBox id="qqColumn" size="15" runat="server"/>
				 <select id="selQQ" onchange="SelChange(this,'<%=qqColumn.ClientID%>');"><option value="">选择</option></select>
		 	</td></tr>
		 	<tr><th>
		 		电话字段：
		 	</th><td>
		 		<asp:TextBox id="phoneColumn" size="15" runat="server"/>
				 <select id="selPhone" onchange="SelChange(this,'<%=phoneColumn.ClientID%>');"><option value="">选择</option></select>
		 	</td></tr>
		 	<tr><th>
		 		省份字段：
		 	</th><td>
		 		<asp:TextBox id="provinceColumn" size="15" runat="server"/>
				 <select id="selProvince" onchange="SelChange(this,'<%=provinceColumn.ClientID%>');"><option value="">选择</option></select>
		 	</td></tr>
		 	<tr><th>
		 		城市字段：
		 	</th><td>
		 		<asp:TextBox id="cityColumn" size="15" runat="server"/>
				 <select id="selCity" onchange="SelChange(this,'<%=cityColumn.ClientID%>');"><option value="">选择</option></select>
		 	</td></tr>
		 	<tr><th>
		 		排序字段：
		 	</th><td>
		 		<asp:TextBox id="orderColumn" size="15" runat="server"/>
				<asp:RequiredFieldValidator
					ControlToValidate="orderColumn"
					ErrorMessage="排序字段必须填写"
					Display="None"
					runat="server"/>
				 <select id="selOrder" onchange="SelChange(this,'<%=orderColumn.ClientID%>');"><option value="">选择</option></select>
				 <asp:DropDownList id="orderAsc" runat="server">
				 	<asp:ListItem value="1">正序</asp:ListItem>
				 	<asp:ListItem value="0">倒序</asp:ListItem>
				 </asp:DropDownList><br/>
		 		<span class="explain">排序在前的先添加</span>
		 	</td></tr>
		 	<tr><th>
		 		原密码未加密：
		 	</th><td>
		 		<asp:RadioButtonList id="passMd5" RepeatLayout="flow" RepeatDirection="Horizontal" runat="server">
		 			<asp:ListItem value="1" Selected="true">是</asp:ListItem>
		 			<asp:ListItem value="0">否</asp:ListItem>
		 		</asp:RadioButtonList>
		 	</td></tr>
		 	<tr><th valign="top">
		 		sql过滤条件：<br/>
		 		<span class="explain">sql语句where后内容，不了解sql请勿填写</span>
		 	</th><td>
		 		<asp:TextBox TextMode="MultiLine" id="filter" Cols="40" Rows="4" runat="server"/>
		 	</td></tr>
			<tr><td height="30" align="center" colspan="2">
				<asp:Button text="上一步" onclick="Prev_OnClick" CausesValidation="false" runat="server"/> &nbsp;
				<asp:Button id="Submit" text="添 加" onclick="Submit_OnClick" runat="server"/> &nbsp;
				<script type="text/javascript">
					var colArr = new Array();
					<asp:Literal id="ltCols" runat="server"/>
					
					function BindSel()
					{
						var oArr = new Array("selName","selPassword","selRealname","selAddDate","selBirthday","selMale","selEmail","selQQ","selPhone","selProvince","selCity","selOrder");
						var typeArr = new Array("String","String","String","DateTime","DateTime","Bool","String","String","String","String","String","Int32");
						for(var i=0; i<oArr.length; i++){
							var o = document.getElementById(oArr[i]);
							for (var j=0; j<colArr.length; j++){
								if (typeArr[i].length>0 && typeArr[i]!=colArr[j][1]){
									continue;
								}
								var oOpt = document.createElement("OPTION");
								o.options.add(oOpt);
								oOpt.innerText = colArr[j][0];
								oOpt.value = colArr[j][0];
							}
						}
					}
					
					function SelChange(oSel, tbId)
					{
						var o_tb = document.getElementById(tbId);
						o_tb.value = oSel.value;
					}
					
					BindSel();
				</script>
			</td></tr>
		 </asp:PlaceHolder>
	
		<tr><td height="30" align="center" colspan="2">
		</td></tr>
		<tr><td colspan="2">
			导入采集规则 <input type="file" id="upRule" size="15" runat="server"/>
			<asp:Button id="import" text="导入" onclick="import_Onclick" CausesValidation="false" runat="server"/>
			&nbsp; &nbsp; <asp:Button id="export" text="导出规则" CausesValidation="false" runat="server"/><br/>
			<b>注</b>：只有原数据库中用户密码没有加密或采集md5 32加密的情况下可转换
		</td></tr>
		</table>
		
	</div>
	</div>
	<div class="bl"></div>
	<div class="br"></div>
	<div class="bm"></div>
	</div>
	</form>
	
	<iframe id="ifm_export" src="about:blank" height="0" width="0" style="visibility: hidden"></iframe>

</asp:Content>