<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="login_departmentandpost.aspx.cs" Inherits="Web.admin.login_departmentandpost" %>

<!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>
    <link href="../css/admincss/skin.css" rel="stylesheet" type="text/css" />
    </head>
<body>
    <form id="form1" runat="server" defaultfocus ="tbAddDepartment">

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class ="top_bg_left "></td>
    <td  class ="top_bg_center " >
    <table style ="width :100%; height :31"  border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
      
<!--这里写页标题 -->
        <td style ="height :31px"><div class="titlebt">系统设置</div></td>
      </tr>
    </table>
    </td> 
    <td class ="top_bg_right "></td>
  </tr>
  <tr>
    <td style ="background :url(../css/admincss/images/mail_leftbg.gif); vertical-align :middle " >&nbsp;</td>
    <td style ="background-color :#F7F8F9; vertical-align :top " >
    
           <!--  一组内容模块开始   --> 
    <table class ="tablezong"   border="0"  cellpadding="0" cellspacing="0">
      <tr>
        <td style ="height :40px" >
        <table class="tablebiaoti"  border="0" cellpadding="0" cellspacing="0" >
          <tr>
            <td><div class ="biaotileft ">  
                主管部门设置</div> </td>
          </tr>
        </table>
        </td>
      </tr>
      <tr>
        <td>
        
<div>
<asp:GridView ID="gvIndustry" runat="server" Width="50%" CssClass="gv" 
            cellspacing="1" BorderWidth="1px" 
                AutoGenerateColumns="False" 
        onrowcancelingedit="gvIndustry_RowCancelingEdit" 
        onrowdatabound="gvIndustry_RowDataBound" onrowdeleting="gvIndustry_RowDeleting" 
        onrowediting="gvIndustry_RowEditing" 
        onrowupdating="gvIndustry_RowUpdating" >
            <RowStyle  CssClass="gvrow" BorderWidth="1px" />
                <Columns>
         
                    
                    <asp:TemplateField HeaderText="主管部门名称">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("industry") %>'></asp:TextBox> <asp:Label ID="Label1" runat="server" Visible ="false"  Text='<%# Bind("industry") %>'></asp:Label>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" 
                                ControlToValidate="TextBox1" ErrorMessage="主管部门名称不能为空" ValidationGroup="EditIndustry"   ForeColor ="Red" ></asp:RequiredFieldValidator>
                                           <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                    ControlToValidate="TextBox1" Display="Dynamic" 
                    ErrorMessage="请输入少于50个字符。" 
                    ValidationExpression="^[^%&gt;&lt;&amp;=\s]{1,50}$" 
                    ValidationGroup="EditIndustry" ForeColor="Red"></asp:RegularExpressionValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                    ControlToValidate="TextBox1" Display="Dynamic" 
                    ErrorMessage="请用汉字或字母开头。" ValidationExpression="^(?!\d)[a-zA-Z0-9\u4e00-\u9fa5]+$" 
                                                    ValidationGroup="EditIndustry"  ForeColor="Red"></asp:RegularExpressionValidator>     
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("industry") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                     <asp:TemplateField HeaderText="修改" ShowHeader="False">
                         <EditItemTemplate>
                             <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" ValidationGroup="EditIndustry" 
                                 CommandName="Update" Text="提交修改"></asp:LinkButton>
                             &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                 CommandName="Cancel" Text="取消"></asp:LinkButton>&nbsp; 
                         </EditItemTemplate>
                         <ItemTemplate>
                             <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                 CommandName="Edit" Text="修改"></asp:LinkButton>&nbsp; 
                         </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="删除" ShowHeader="False">
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False" 
                                CommandName="Delete" Text="删除"></asp:LinkButton>&nbsp; 
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                </Columns>
            <HeaderStyle  CssClass="gvhead"  />
                    </asp:GridView><div style =" margin-top :10px; margin-bottom :10px">添加主管部门： 名称：<asp:TextBox ID="tbIndustry" runat="server" Width ="200px"></asp:TextBox>

                <asp:Button ID="AddIndustry" runat="server" Text="添加" 
                    ValidationGroup="AddIndustry" onclick="AddIndustry_Click" />
                      <asp:Label ID="lbMessageIndustry" runat="server" ForeColor="Red"></asp:Label>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ControlToValidate="tbIndustry" Display="Dynamic" 
                    ErrorMessage="名称不能为空。" ValidationGroup="AddIndustry" ForeColor="Red"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                    ControlToValidate="tbIndustry" Display="Dynamic" 
                    ErrorMessage="请输入少于50个字符。" 
                    ValidationExpression="^[^%&gt;&lt;&amp;=\s]{1,50}$" 
                    ValidationGroup="AddIndustry" ForeColor="Red"></asp:RegularExpressionValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                    ControlToValidate="tbIndustry" Display="Dynamic" 
                    ErrorMessage="请用汉字或字母开头。" ValidationExpression="^(?!\d)[a-zA-Z0-9\u4e00-\u9fa5]+$" 
                                                    ValidationGroup="AddIndustry" ForeColor="Red"></asp:RegularExpressionValidator>
                                          </div> 
      </div>
        </td>
      </tr>
    </table>
<!-- 一组内容模块结束 -->
    
       <!--  一组内容模块开始   --> 
    <table class ="tablezong"   border="0"  cellpadding="0" cellspacing="0">
      <tr>
        <td style ="height :40px" >
        <table class="tablebiaoti"  border="0" cellpadding="0" cellspacing="0" >
          <tr>
            <td><div class ="biaotileft ">  
                下属单位设置</div> </td>
          </tr>
        </table>
        </td>
      </tr>
      <tr>
        <td>
        

<div style ="padding-left :10px">选择主管部门：
<asp:DropDownList 
                        ID="ddlViewIndustry" runat="server" AutoPostBack="True" 
        onselectedindexchanged="ddlViewIndustry_SelectedIndexChanged">
                    </asp:DropDownList>
</div>
                
<asp:GridView ID="gvDepartment" runat="server" Width="50%" CssClass="gv" 
            cellspacing="1" BorderWidth="1px" 
                AutoGenerateColumns="False" 
        onrowdatabound="gvDepartment_RowDataBound" 
        onrowdeleting="gvDepartment_RowDeleting" 
        onselectedindexchanging="gvDepartment_SelectedIndexChanging" 
        onrowcreated="gvDepartment_RowCreated" >
            <RowStyle  CssClass="gvrow" BorderWidth="1px" />
                <Columns>
                    <asp:BoundField DataField="id" HeaderText="序号" ReadOnly="True" />
                    <asp:BoundField DataField="industry" HeaderText="主管部门" ReadOnly="True" />
                      <asp:BoundField DataField="department" HeaderText="单位" ReadOnly="True" />
                         <asp:CommandField HeaderText="修改" SelectText="修改" ShowSelectButton="True" />
                    <asp:CommandField HeaderText="删除" ShowDeleteButton="True" />

                    


                    
                </Columns>
            <HeaderStyle  CssClass="gvhead"  />
        </asp:GridView>
        <div style =" margin-top :10px; margin-bottom :10px">
<asp:Label ID="lbProject" runat="server" Text="添加单位："></asp:Label>
      
                    <asp:Label ID="lbId" runat="server" Visible ="false" ></asp:Label>

                   单位名称：<asp:TextBox ID="tbDepartment" runat="server" Width ="200px"></asp:TextBox>

                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 主管部门：<asp:DropDownList 
                        ID="ddlIndustry" runat="server">
                    </asp:DropDownList>

                <asp:Button ID="btAddDepartment" runat="server" Text="添加" 
                    ValidationGroup="AddDepartment" onclick="btAddDepartment_Click" />
                      <asp:Button ID="btEditDepartment" runat="server" 
                        onclick="btEditDepartment_Click" Text="修改" Visible="False" 
                ValidationGroup="editDepartment" />
                    <asp:Button ID="btDelDepartment" runat="server" onclick="btDelDepartment_Click" 
                        Text="删除" Visible="False" />
                      <asp:Label ID="lbMessageDepartment" runat="server" ForeColor="Red"></asp:Label>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                    ControlToValidate="tbDepartment" Display="Dynamic" 
                    ErrorMessage="名称不能为空。" ValidationGroup="AddDepartment" ForeColor="Red"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" 
                    ControlToValidate="tbDepartment" Display="Dynamic" 
                    ErrorMessage="请输入少于50个字符。" 
                    ValidationExpression="^[^%&gt;&lt;&amp;=\s]{1,50}$" 
                    ValidationGroup="AddDepartment" ForeColor="Red"></asp:RegularExpressionValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator7" runat="server" 
                    ControlToValidate="tbDepartment" Display="Dynamic" 
                    ErrorMessage="请用汉字或字母开头。" ValidationExpression="^(?!\d)[a-zA-Z0-9\u4e00-\u9fa5]+$" 
                                                    ValidationGroup="AddDepartment" 
                        ForeColor="Red"></asp:RegularExpressionValidator>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" 
                    ControlToValidate="tbDepartment" Display="Dynamic" 
                    ErrorMessage="名称不能为空。" ValidationGroup="editDepartment" 
                ForeColor="Red"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator8" runat="server" 
                    ControlToValidate="tbDepartment" Display="Dynamic" 
                    ErrorMessage="请输入少于50个字符。" 
                    ValidationExpression="^[^%&gt;&lt;&amp;=\s]{1,50}$" 
                    ValidationGroup="editDepartment" ForeColor="Red"></asp:RegularExpressionValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator9" runat="server" 
                    ControlToValidate="tbDepartment" Display="Dynamic" 
                    ErrorMessage="请用汉字或字母开头。" ValidationExpression="^(?!\d)[a-zA-Z0-9\u4e00-\u9fa5]+$" 
                                                    ValidationGroup="editDepartment" 
                        ForeColor="Red"></asp:RegularExpressionValidator>
                                             </div> 
  

            <div style ="padding-top :10px">说明：删除主管部门的同时将删除其下属单位的员工；删除下属单位的同时将删除此单位所有员工。修改主管部门或下属单位，所包含的员工信息将同步更新。</div>
        </td>
      </tr>
    </table>
<!-- 一组内容模块结束 -->



    </td>
    <td  style =" background-image:url(../css/admincss/images/mail_rightbg.gif )" >
    </td>
  </tr>
  <tr>
    <td  class ="buttom_bg_left "></td>
    <td class ="buttom_bg_center " ></td>
    <td  class ="buttom_bg_right " ></td>
  </tr>
</table>

    </form>
</body>
</html>
