<%@ page language="C#" autoeventwireup="true" inherits="general_SystemManage_DeptUser_New, CrmCommand" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <script src="../../Javascript/formCheck.js" language=javascript></script>
    	<script>
function CheckForm()
{
	if(document.Form1.txtUserId.value == "")
   {
	 alert("用户名不能为空！");
	 document.Form1.txtUserId.focus();
	 return (false);
   }
   if(document.Form1.txtUserId.value != "")
   {
   if(!CheckUserName(document.Form1.txtUserId.value))
   {
     alert("用户名只能为数字和字母的组合！");
	 document.Form1.txtUserId.focus();
	 return (false);
   }
   }
   if(document.Form1.txtUserName.value == "")
   {
	 alert("真实姓名不能为空！");
	 document.Form1.txtUserName.focus();
	 return (false);
   }
   
  
     if(document.Form1.txtPassword.value == "")
   {   
	 alert("密码不能为空！");	
	 return (false);
   }
  
   
   if(document.Form1.txtPassword.value != document.Form1.txtPassword2.value)
   {   
	 alert("密码与确认密码不匹配！");	
	 return (false);
   }
   
  
   
   
    if((document.Form1.ddlPostPriv.value == "2") && (document.Form1.ToId.value == ""))
   {
	 alert("请选择管理范围（部门）！");	
	 return (false);
   }
   if(document.Form1.TxtEmail.value != "")
   {
        if(!isEMail(document.Form1.TxtEmail.value))
       {
	     alert("E-Mail格式不正确！");
	     document.Form1.TxtEmail.focus();
	     return (false);
       }
   }
   
  
   
   return true;
}

function select_dept()
{
   if (document.getElementById("ddlPostPriv").value=="2")
       document.getElementById("postdept_select").style.display='';
   else
       document.getElementById("postdept_select").style.display="none";
}
  function ShowDept()
   {
    
   
   var R=  window.showModalDialog("Dept_Select.aspx","newwindow","dialogWidth=200px;dialogHeight=500px");
   if(R != null)
   {
   if(R != "")
   {
  var S = R.split(',');
  var ids = "";
  var names ="";
 
  
  for(i=0;i<S.length;i=i+2)
  {
     names =names + S[i]+",";
  }
   for(i=1;i<S.length;i=i+2)
  {
     ids =ids + S[i]+",";
  }
  document.getElementById("ToName").value =names.substring(0,names.length-2);
  document.getElementById("ToId").value =ids.substring(0,ids.length-1);
  }
  
   }
   }
</script>
</head>
<body class="bodycolor" topmargin="5">
    <form id="Form1" runat="server">
   <TABLE class="small" cellSpacing="0" cellPadding="3" width="100%" border="0">
					<TR>
						<TD class="Big">
						<IMG height="18" src="../images/notify_new.gif" width="18" align="absMiddle"><SPAN class="big3">
								添加用户</SPAN>
						</TD>
					</TR>
				</TABLE>
				<TABLE class="small" cellSpacing="1" cellPadding="3" width="90%" align="center" bgColor="#000000"
					border="0">
					<TR>
						<TD class="TableHeader" noWrap colSpan="2">
						<IMG src="../images/green_arrow.gif" align="absMiddle" width="17" height="17">
							信息设置：</TD>
					</TR>
					<TR>
						<TD class="TableData" noWrap>用户名：</TD>
						<TD class="TableData" noWrap>
							<asp:TextBox id="txtUserId" runat="server" Columns="15" MaxLength="20" CssClass="BigInput"></asp:TextBox>&nbsp;</TD>
					</TR>
					<TR>
						<TD class="TableData" noWrap>真实姓名：</TD>
						<TD class="TableData" noWrap>
							<asp:TextBox id="txtUserName" runat="server" Columns="15" MaxLength="20" CssClass="BigInput"></asp:TextBox>
						</TD>
					</TR>
						<TR>
						<TD class="TableData" noWrap>性别：</TD>
						<TD class="TableData" noWrap>
							<asp:DropDownList id="ddlSex" runat="server" CssClass="BigSelect">
								<asp:ListItem Value="男">男</asp:ListItem>
								<asp:ListItem Value="女">女</asp:ListItem>
							</asp:DropDownList>
						</TD>
					</TR>
					<TR>
						<TD class="TableData" noWrap>密码：</TD>
						<TD class="TableData" noWrap>
							<asp:TextBox id="txtPassword" runat="server" Columns="15" MaxLength="20" CssClass="BigInput"
								TextMode="Password"></asp:TextBox>
						</TD>
					</TR>
					<TR>
						<TD class="TableData" noWrap>确认密码：</TD>
						<TD class="TableData" noWrap>
							<asp:TextBox id="txtPassword2" runat="server" Columns="15" MaxLength="20" CssClass="BigInput"
								TextMode="Password"></asp:TextBox>
						</TD>
					</TR>
					<TR>
						<TD class="TableData" noWrap>部门：</TD>
						<TD class="TableData" noWrap>
                          <font size=4> <b> <asp:Label ID="LblDept" runat="server" Text=""></asp:Label></b></font>
						
						</TD>
					</TR>
				
					<TR>
						<TD class="TableData" noWrap>角色：</TD>
						<TD class="TableData" noWrap>
							<asp:DropDownList id="ddlUserPriv" runat="server" CssClass="BigSelect"></asp:DropDownList><font color=red ><asp:Label ID="LblInfo" runat="server" Text=""></asp:Label></font></TD>
					</TR>
					<TR>
						<TD class="TableData" width="120">管理范围（如果有权限执行管理型模块）：</TD>
						<TD class="TableData" noWrap><SELECT class="BigSelect" id="ddlPostPriv" onchange="select_dept();" name="ddlPostPriv"
								runat="server">
								<OPTION value="-1" selected>无管理职责</OPTION>
								<OPTION value="0" >本部门</OPTION>
								<OPTION value="1">全体</OPTION>
								<OPTION value="2">指定部门</OPTION>
							</SELECT>
						</TD>
					</TR>
					<TR id="postdept_select" style="DISPLAY: none">
						<TD class="TableData" noWrap>管理范围（部门）：</TD>
						<TD class="TableData"><INPUT id="ToId" type="hidden"  name="ToId" runat="server"> <TEXTAREA class="BigStatic" id="ToName" name="ToName" rows="3" readOnly cols="40" runat="server"></TEXTAREA>&nbsp;<INPUT class="SmallButton" title="设置部门" onclick="ShowDept();"
								type="button" value="设 置" name="button">
						</TD>
					</TR>
					
					
				   <TR>
						<TD class="TableData" noWrap>E-mail：</TD>
						<TD class="TableData" noWrap>
							<asp:TextBox id="TxtEmail" runat="server" MaxLength="50" CssClass="BigInput" Width="200px"></asp:TextBox>
							
							</TD>
					</TR>
					
				
					<TR>
						<TD class="TableData" noWrap>手机：</TD>
						<TD class="TableData" noWrap>
							<asp:TextBox id="txtMobile" runat="server" MaxLength="50" CssClass="BigInput" Width="200px"></asp:TextBox>
							
							</TD>
					</TR>
					<TR>
						<TD class="TableControl" noWrap align="center" colSpan="2">
                            <asp:Button  class="BigButton" OnClientClick="return CheckForm();" ID="BtnAdd" runat="server" Text="添加" OnClick="BtnAdd_Click" />&nbsp;&nbsp;<INPUT class="BigButton" title="返回" onclick="history.back();" type="button" value="返回">
						</TD>
					</TR>
				</TABLE>
        <input id="HidValue" runat=server  type="hidden" />
    </form>
</body>
</html>
