<%@ Control Language="c#" AutoEventWireup="false" Codebehind="Organize.ascx.cs" Inherits="WebUI.MMS.Organize" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<script language="javascript" type="text/javascript">
<!--
function checkFormAll(chk)
{
	myform = document.forms[0];
	for( var i = 0; i < myform.elements.length; i++ )
	{
		if ( myform.elements[i].type=="checkbox" )
		{
			myform.elements[i].checked = chk;
		}
	}
}

function go(i)
{
	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
		theform = document.forms["myform2"];
	}
	else {
		theform = document.myform2;
	}
	theform.PageIndex.value = i;
	theform.submit();		
}

function SelectDate(DivID)
{
     var fullPath="calendar/PopDate.Htm";
     var strDate;	//Chinese date formate
     var intDate;	//Integer date formate
     var objEffectDate=eval("myform2." + DivID);
     intDate=showModalDialog(fullPath,window,"dialogWidth=360px;dialogHeight=310px;center=yes;border=this;help=no");
     if (intDate!=null)
     {
         objEffectDate.value=intDate.substr(0,4)+"-"+intDate.substr(5,2)+"-"+intDate.substr(8,2);
         if (objEffectDate.value!="undefined")
         {
             strDate=intDate.substr(0,4)+"-"+intDate.substr(5,2)+"-"+intDate.substr(8,2);
             objEffectDate.value=strDate;
         }
         else
         {
             objEffectDate.value="";
         }
     }
     event.returnValue =false;     
}
//-->
</script>
<input type="hidden" name="PageIndex" id="PageIndex" value="<%= this.PageIndex%>">
	<TABLE cellSpacing="0" cellPadding="0" width="98%" align="center">
		<TR>
			<TD class="mframe-t-left"></TD>
			<TD class="mframe-t-mid"><SPAN class="mframe-t-text"><%=this.PageTitle%></SPAN></TD>
			<TD class="mframe-t-right"></TD>
		</TR>
	</TABLE>
<table class="awidth" align="center" cellspacing="0" cellpadding="0">
<tr>
<td class="mframe-m-left" width=1> </td>
<td class="mframe-m-mid">	

<!--信息编辑 Start-->
<asp:Panel id="pnlAdd" runat="server">		
  <TABLE id="Table1" cellSpacing="1" cellPadding="3" width="98%" align="center">
    <TR> 
      <TD align="right"><font face="宋体">部门代号</font>：</TD>
      <TD> <asp:TextBox id="txtOrganNumber" runat="server"></asp:TextBox> <font color="red">*</font></TD>
    </TR>
    <TR> 
      <TD align="right"><font face="宋体">部门名称</font>：</TD>
      <TD> <asp:TextBox id="txtName" runat="server"></asp:TextBox> <font color="red">*</font></TD>
    </TR>
    <TR> 
      <TD align="right"><font face="宋体">上级部门</font>：</TD>
      <TD>
       <asp:DropDownList id="ddlParent" runat="server"> 
       <asp:ListItem Value="0">作为一级部门</asp:ListItem>
       </asp:DropDownList>
      </TD>
    </TR>
    <TR> 
      <TD align="right">备 注：</TD>
      <TD> <asp:TextBox id="txtNote" runat="server" TextMode="MultiLine" Height="120px" Width="250px"></asp:TextBox></TD>
    </TR>
    <TR> 
      <TD align="right"><font face="宋体">部门状态</font>：</TD>
      <TD> 
      <asp:DropDownList id="ddlState" runat="server"> 
          <asp:ListItem Value="0">正常</asp:ListItem>
          <asp:ListItem Value="1">停用</asp:ListItem>
          <asp:ListItem Value="2">已删除</asp:ListItem>
      </asp:DropDownList></TD>
    </TR>
    <TR> 
      <TD align="right"></TD>
      <TD> <asp:Button id="Submit" runat="server" Text="提  交"></asp:Button></TD>
    </TR>
  </TABLE>
</asp:Panel>
<!--信息编辑 End-->
	
<!--信息列表 Start-->	
<asp:Panel id="pnlList" runat="server">
				<asp:Label id="label" style="TEXT-ALIGN: center" runat="server" Visible="False" width="100%"></asp:Label>
				<ASP:DataGrid id="DataGrid1" runat="server" Width="100%" OnItemCreated="DataGrid1_ItemCreated"
					OnItemDataBound="DataGrid1_ItemDataBound" CellPadding="0" CellSpacing="0" ItemStyle-CssClass="tdbg"
					DataKeyField="ID" AutoGenerateColumns="false" ShowFooter="false"
					ShowHeader="True" Align="center" AllowPaging="True">
					<PagerStyle Visible="False"/>
					<HeaderStyle HorizontalAlign="center" CssClass="summary-title" Height="25" />
					<ItemStyle Height="22" />
					<EditItemStyle CssClass="tdbg-dark" />
					<Columns>
						<asp:TemplateColumn ItemStyle-Width="10%" ItemStyle-HorizontalAlign="center">
							<ItemTemplate>
								<a href="?mms=<%#Request["mms"].ToString()%>&action=edit&id=<%# DataBinder.Eval(Container.DataItem, "ID")%>">修改</a>
							</ItemTemplate>
						</asp:TemplateColumn>
						<asp:BoundColumn HeaderText="部门代号" DataField="OrganNumber" ReadOnly="true">
							<ItemStyle HorizontalAlign="Center" Width="10%" />
						</asp:BoundColumn>
						<asp:BoundColumn HeaderText="部门名称" DataField="Name" ReadOnly="true">
							<ItemStyle Width="25%" />
						</asp:BoundColumn>
						<asp:BoundColumn  HeaderText="上级部门" DataField="ParentID" ReadOnly="true">
							<ItemStyle HorizontalAlign="Center" Width="20%" />
						</asp:BoundColumn>
						<asp:BoundColumn  HeaderText="人数" DataField="UserCount" ReadOnly="true">
							<ItemStyle HorizontalAlign="Center" Width="10%" />
						</asp:BoundColumn>
						<asp:TemplateColumn ItemStyle-Width="20%" ItemStyle-HorizontalAlign="center" HeaderText="状态">
							<ItemTemplate>
								<%# (DataBinder.Eval(Container.DataItem, "State").ToString() == "0") ? "正常" : (DataBinder.Eval(Container.DataItem, "State").ToString() == "1") ? "停用" : "已删除"%>
							</ItemTemplate>
						</asp:TemplateColumn>						
						<asp:TemplateColumn ItemStyle-Width="10%" ItemStyle-HorizontalAlign="center" HeaderText="<input type='checkbox' onclick='checkFormAll(this.checked)'>">
							<ItemTemplate>
								<input type="checkbox" name="chk" value='<%# DataBinder.Eval(Container.DataItem, "ID")%>' />
							</ItemTemplate>
						</asp:TemplateColumn>
					</Columns>
				</ASP:DataGrid>
				<table width="100%"><tr><td height="25" align="center"><%= this.PageNavigation%></td></tr></table>
	<table align="center" width="100%" height="30">
	<tr><td>代号：<asp:TextBox ID="txtOrganNumber2" Width="100px" Runat="server"/> &nbsp; 名称：<asp:TextBox ID="txtName2" Width="100px" Runat="server"/> <asp:Button ID="btnSearch" Text="查 询" OnClick="Search_OnClick" Runat="server"/></td><td align="right"><input type="button" value="添 加" onclick="location.href='?mms=<%=Request["mms"]%>&action=add'">&nbsp;&nbsp;<asp:Button ID="btnDelete" Runat="server" OnClick="Delete_OnClick" Text="删 除" /></td></tr></table>
</asp:Panel>
<!--信息列表 End-->

</td>
<td class="mframe-m-right" width=1> </td>
</tr>
</table>
<TABLE cellSpacing="0" cellPadding="0" width="98%" align="center">
	<TR>
		<TD class="mframe-b-left"></TD>
		<TD class="mframe-b-mid">&nbsp;</TD>
		<TD class="mframe-b-right"></TD>
	</TR>
</TABLE>

