department.aspx
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:21k
源码类别:

OA系统

开发平台:

ASP/ASPX

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="department.aspx.cs" Inherits="web_department_department" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" >
  4. <head runat="server">
  5.     <title>无标题页</title>
  6.     <link href="../../../css/style.css" rel="stylesheet" type="text/css" />
  7.     <script type="text/javascript"language = "javascript">
  8.     function selectDepartment()
  9.     {
  10.         var url = "department_select_tree.aspx";
  11.         var features = "width=400,height=500,top=200,left=250,location=no,toolbar=no,status=no,resizable=yes,scrollbars=yes";
  12.         var selectDepartment = open(url, 'selectDepartment', features);
  13.         selectDepartment.focus();
  14.     }
  15.     function setDepartment(deptId, deptName)
  16.     {
  17.         document.all.lastDepartment_id.value=deptId;
  18.         document.all.txtLastDepartment2.value=deptName;
  19.     }
  20.     </script>
  21. </head>
  22. <body>
  23. <center>
  24.     <form id="form1" runat="server">
  25.         <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
  26.             <asp:View ID="View1" runat="server">
  27.     <asp:Label BorderStyle="None" ID="lblTitle" runat="server" Font-Bold="True" Font-Size="Medium"></asp:Label>
  28.         <asp:GridView ID="Department_list" runat="server" AutoGenerateColumns="False" BackColor="White"
  29.             BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataKeyNames="id"
  30.             DataSourceID="SqlDataSource1"
  31.             Width="800px" AllowPaging="True" OnRowDataBound="Department_list_RowDataBound" OnRowUpdating="Department_list_RowUpdating" OnRowCommand="Department_list_RowCommand" PageSize="5">
  32.             <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
  33.             <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
  34.             <Columns>
  35.                 <asp:BoundField DataField="id" HeaderText="id" ReadOnly="True" SortExpression="id" Visible="False" />
  36.                 <asp:BoundField DataField="name" HeaderText="部門名稱" SortExpression="name" />
  37.                 <asp:BoundField DataField="last_id" HeaderText="last_id" SortExpression="last_id" Visible="False" />
  38.                 <asp:BoundField DataField="code" HeaderText="部門代號" SortExpression="code" />
  39.                 <asp:BoundField DataField="tel" HeaderText="電話" SortExpression="tel" />
  40.                 <asp:BoundField DataField="fax" HeaderText="傳真" SortExpression="fax" />
  41.                 <asp:BoundField DataField="function" HeaderText="部門職能" SortExpression="function" />
  42.                 <asp:CommandField ShowEditButton="True" />
  43.                 <asp:TemplateField ShowHeader="False">
  44.                     <ItemTemplate>
  45.                         <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandArgument='<%# Eval("id") %>'
  46.                             CommandName="Delete" OnClientClick='javascript:return confirm("資料刪除后將無法恢復, 確定要刪除嗎?");'
  47.                             Text="删除"></asp:LinkButton>
  48.                     </ItemTemplate>
  49.                 </asp:TemplateField>
  50.             </Columns>
  51.             <PagerStyle BackColor="Gray" ForeColor="Black" HorizontalAlign="Center" />
  52.             <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
  53.             <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
  54.             <AlternatingRowStyle BackColor="Gainsboro" />
  55.             <EmptyDataTemplate>
  56.                 <asp:Label BorderStyle="None" ID="Label1" runat="server" Style="position: relative" Text="沒有該部門的下級部門資料"></asp:Label>
  57.             </EmptyDataTemplate>
  58.         </asp:GridView>
  59.         <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
  60.             ConnectionString="<%$ ConnectionStrings:oaConnection %>" DeleteCommand="DELETE FROM [OA_DEPARTMENT] WHERE [id] = @original_id AND [name] = @original_name AND [last_id] = @original_last_id AND [code] = @original_code AND [upd_user] = @original_upd_user AND [cre_date] = @original_cre_date AND [cre_user] = @original_cre_user AND [function] = @original_function AND [fax] = @original_fax AND [tel] = @original_tel AND [upd_date] = @original_upd_date"
  61.             InsertCommand="INSERT INTO [OA_DEPARTMENT] ([id], [name], [last_id], [code], [upd_user], [cre_date], [cre_user], [function], [fax], [tel], [upd_date]) VALUES (@id, @name, @last_id, @code, @upd_user, @cre_date, @cre_user, @function, @fax, @tel, @upd_date)"
  62.             OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [id], [name], [last_id], [code], [upd_user], [cre_date], [cre_user], [function], [fax], [tel], [upd_date] FROM [OA_DEPARTMENT] WHERE ([last_id] = @last_id) ORDER BY [sequence], [name]"
  63.             UpdateCommand="UPDATE [OA_DEPARTMENT] SET [name] = @name, [last_id] = @last_id, [code] = @code, [upd_user] = @upd_user, [cre_date] = @cre_date, [cre_user] = @cre_user, [function] = @function, [fax] = @fax, [tel] = @tel, [upd_date] = @upd_date WHERE [id] = @original_id AND [name] = @original_name AND [last_id] = @original_last_id AND [code] = @original_code AND [upd_user] = @original_upd_user AND [cre_date] = @original_cre_date AND [cre_user] = @original_cre_user AND [function] = @original_function AND [fax] = @original_fax AND [tel] = @original_tel AND [upd_date] = @original_upd_date">
  64.             <SelectParameters>
  65.                 <asp:QueryStringParameter DefaultValue="1" Name="last_id" QueryStringField="last_id"
  66.                     Type="Int32" />
  67.             </SelectParameters>
  68.             <DeleteParameters>
  69.                 <asp:Parameter Name="original_id" Type="Int32" />
  70.                 <asp:Parameter Name="original_name" Type="String" />
  71.                 <asp:Parameter Name="original_last_id" Type="Int32" />
  72.                 <asp:Parameter Name="original_code" Type="String" />
  73.                 <asp:Parameter Name="original_upd_user" Type="String" />
  74.                 <asp:Parameter Name="original_cre_date" Type="String" />
  75.                 <asp:Parameter Name="original_cre_user" Type="String" />
  76.                 <asp:Parameter Name="original_function" Type="String" />
  77.                 <asp:Parameter Name="original_fax" Type="String" />
  78.                 <asp:Parameter Name="original_tel" Type="String" />
  79.                 <asp:Parameter Name="original_upd_date" Type="String" />
  80.             </DeleteParameters>
  81.             <UpdateParameters>
  82.                 <asp:Parameter Name="name" Type="String" />
  83.                 <asp:Parameter Name="last_id" Type="Int32" />
  84.                 <asp:Parameter Name="code" Type="String" />
  85.                 <asp:Parameter Name="upd_user" Type="String" />
  86.                 <asp:Parameter Name="cre_date" Type="String" />
  87.                 <asp:Parameter Name="cre_user" Type="String" />
  88.                 <asp:Parameter Name="function" Type="String" />
  89.                 <asp:Parameter Name="fax" Type="String" />
  90.                 <asp:Parameter Name="tel" Type="String" />
  91.                 <asp:Parameter Name="upd_date" Type="String" />
  92.                 <asp:Parameter Name="original_id" Type="Int32" />
  93.                 <asp:Parameter Name="original_name" Type="String" />
  94.                 <asp:Parameter Name="original_last_id" Type="Int32" />
  95.                 <asp:Parameter Name="original_code" Type="String" />
  96.                 <asp:Parameter Name="original_upd_user" Type="String" />
  97.                 <asp:Parameter Name="original_cre_date" Type="String" />
  98.                 <asp:Parameter Name="original_cre_user" Type="String" />
  99.                 <asp:Parameter Name="original_function" Type="String" />
  100.                 <asp:Parameter Name="original_fax" Type="String" />
  101.                 <asp:Parameter Name="original_tel" Type="String" />
  102.                 <asp:Parameter Name="original_upd_date" Type="String" />
  103.             </UpdateParameters>
  104.             <InsertParameters>
  105.                 <asp:Parameter Name="id" Type="Int32" />
  106.                 <asp:Parameter Name="name" Type="String" />
  107.                 <asp:Parameter Name="last_id" Type="Int32" />
  108.                 <asp:Parameter Name="code" Type="String" />
  109.                 <asp:Parameter Name="upd_user" Type="String" />
  110.                 <asp:Parameter Name="cre_date" Type="String" />
  111.                 <asp:Parameter Name="cre_user" Type="String" />
  112.                 <asp:Parameter Name="function" Type="String" />
  113.                 <asp:Parameter Name="fax" Type="String" />
  114.                 <asp:Parameter Name="tel" Type="String" />
  115.                 <asp:Parameter Name="upd_date" Type="String" />
  116.             </InsertParameters>
  117.         </asp:SqlDataSource>
  118.             </asp:View>
  119.         </asp:MultiView>
  120.         <asp:MultiView ID="MultiView2" runat="server" ActiveViewIndex="0">
  121.             <asp:View ID="View2" runat="server">
  122.         <hr />
  123.         <asp:Button ID="btnAddNew" runat="server" Text="添加下級部門" OnClick="btnAddNew_Click" />
  124.         <asp:Button ID="btnEditDepartment" runat="server" Text="編輯本部門信息" OnClick="btnEditDepartment_Click" />
  125.         <asp:Button ID="btnShow" runat="server" Text="查看本部門信息" OnClick="btnShow_Click" />
  126.             <asp:Button ID="btnShowEmployee" runat="server" Text="本部門員工" OnClick="btnShowEmployee_Click" Visible="False" />
  127.             <asp:Panel ID="Panel1" runat="server" Width="562px">
  128.                 <br />
  129.         <asp:Label BorderStyle="None" ID="lblAdd" runat="server" Text="添加下級部門" Font-Bold="True" Font-Size="Medium"></asp:Label>
  130.         <table border="1">
  131.             <tr>
  132.                 <td align="center" style="width: 122px">上級部門:</td>
  133.                 <td style="width: 322px" align="left">
  134.                     <asp:Label BorderStyle="None" ID="lblLast_department" runat="server" Text=""></asp:Label>
  135.                 </td>
  136.             </tr>
  137.             <tr>
  138.                 <td align="center" style="width: 122px">部門名稱:</td>
  139.                 <td style="width: 322px" align="left">
  140.                     <asp:TextBox ID="txtName" runat="server" Width="200px"></asp:TextBox>
  141.                     <asp:Label BorderStyle="None" ID="Label3" runat="server" ForeColor="Red" Style="position: relative"
  142.                         Text="*"></asp:Label>
  143.                     <asp:Label BorderStyle="None" ID="lblName" runat="server" ForeColor="Red" Style="position: relative"></asp:Label></td>
  144.             </tr>
  145.             <tr>
  146.                 <td align="center" style="width: 122px">部門代號:</td>
  147.                 <td style="width: 322px" align="left">
  148.                     <asp:TextBox ID="txtCode" runat="server" Width="200px"></asp:TextBox>&nbsp;
  149.                 </td>
  150.             </tr>
  151.             <tr>
  152.                 <td align="center" style="width: 122px">電話:</td>
  153.                 <td style="width: 322px" align="left">
  154.                     <asp:TextBox ID="txtTel" runat="server" Width="200px"></asp:TextBox>
  155.                 </td>
  156.             </tr>
  157.             <tr>
  158.                 <td align="center" style="width: 122px">傳真:</td>
  159.                 <td style="width: 322px" align="left">
  160.                     <asp:TextBox ID="txtFax" runat="server" Width="200px"></asp:TextBox>
  161.                 </td>
  162.             </tr>
  163.             <tr>
  164.                 <td align="center" style="width: 122px">層數:</td>
  165.                 <td style="width: 322px" align="left">
  166.                     <asp:TextBox ID="textCeng" runat="server" Width="200px"></asp:TextBox>
  167.                 </td>
  168.             </tr>
  169.             <tr>
  170.                 <td align="center" style="width: 122px; height: 28px;">部門職能:</td>
  171.                 <td style="width: 322px; height: 28px;" align="left">
  172.                     <asp:TextBox ID="txtFunction" runat="server" Width="200px"></asp:TextBox>
  173.                 </td>
  174.             </tr>
  175.             <tr>
  176.                 <td align="center" style="width: 122px">所属公司</td>
  177.                 <td style="width: 322px" align="left">
  178.                     <asp:DropDownList ID="DropDownList1" runat="server" Width="200px">
  179.                     <asp:ListItem Value="0">85度C</asp:ListItem> 
  180.                     <asp:ListItem Value="1">津味</asp:ListItem> 
  181.                      <asp:ListItem Value="2">和夏</asp:ListItem> 
  182.                     </asp:DropDownList>
  183.                 </td>
  184.             </tr>
  185.             <tr>
  186.                 <td colspan="3" align="center" style="height: 28px">
  187.                     <asp:Button ID="btnOk" runat="server" Text="儲存" OnClick="btnOk_Click" />
  188.                 </td>
  189.             </tr>
  190.         </table>
  191.             </asp:Panel>
  192.             <asp:Panel ID="Panel2" runat="server" Height="229px"
  193.                 Width="564px">
  194.                 <br />
  195.                 <asp:Label BorderStyle="None" ID="lblEdit" runat="server" Font-Bold="True" Font-Size="Medium"
  196.                     Text="編輯本部門信息"></asp:Label>
  197.                 s<table border="1">
  198.                         <tr>
  199.                             <td align="center" style="width: 122px">
  200.                                 上級部門:</td>
  201.                             <td style="width: 322px" align="left">
  202.                                 <asp:TextBox ID="txtLastDepartment2" runat="server" Width="200px" Enabled="false"></asp:TextBox>
  203.                                 <asp:Button ID="btnSelect" runat="server" Style="position: relative" Text="選擇部門" />
  204.                                 <input id="lastDepartment_id" type="hidden" runat="server" /></td>
  205.                         </tr>
  206.                         <tr>
  207.                             <td align="center" style="width: 122px">
  208.                                 部門名稱:</td>
  209.                             <td style="width: 322px" align="left">
  210.                                 <asp:TextBox ID="txtName2" runat="server" Width="200px"></asp:TextBox>
  211.                                 <asp:Label BorderStyle="None" ID="Label11" runat="server" ForeColor="Red" Style="position: relative"
  212.                                     Text="*"></asp:Label>
  213.                                 <asp:Label BorderStyle="None" ID="lblName2" runat="server" ForeColor="Red" Style="position: relative"></asp:Label></td>
  214.                         </tr>
  215.                         <tr>
  216.                             <td align="center" style="width: 122px">
  217.                                 部門代號:</td>
  218.                             <td style="width: 322px" align="left">
  219.                                 <asp:TextBox ID="txtCode2" runat="server" Width="200px"></asp:TextBox>&nbsp;
  220.                             </td>
  221.                         </tr>
  222.                         <tr>
  223.                             <td align="center" style="width: 122px; height: 28px;">
  224.                                 電話:</td>
  225.                             <td style="width: 322px; height: 28px;" align="left">
  226.                                 <asp:TextBox ID="txtTel2" runat="server" Width="200px"></asp:TextBox>
  227.                             </td>
  228.                         </tr>
  229.                         <tr>
  230.                             <td align="center" style="width: 122px">
  231.                                 傳真:</td>
  232.                             <td style="width: 322px" align="left">
  233.                                 <asp:TextBox ID="txtFax2" runat="server" Width="200px"></asp:TextBox>
  234.                             </td>
  235.                         </tr>
  236.                          <tr>
  237.                                 <td align="center" style="width: 122px; height: 28px;">層數:</td>
  238.                                 <td style="width: 322px; height: 28px;" align="left">
  239.                     <asp:TextBox ID="textCeng2" runat="server" Width="200px"></asp:TextBox>
  240.                 </td>
  241.             </tr>
  242.                         <tr>
  243.                             <td align="center" style="width: 122px; height: 28px;">
  244.                                 部門職能:</td>
  245.                             <td style="width: 322px; height: 28px;" align="left">
  246.                                 <asp:TextBox ID="txtFunction2" runat="server" Width="200px"></asp:TextBox>
  247.                             </td>
  248.                         </tr>
  249.                                     <tr>
  250.                 <td align="center" style="width: 122px">所属公司</td>
  251.                 <td style="width: 322px" align="left">
  252.                     <asp:DropDownList ID="DropDownList2" runat="server" Width="200px">
  253.                     <asp:ListItem Value="0">85度C</asp:ListItem> 
  254.                     <asp:ListItem Value="1">津味</asp:ListItem> 
  255.                      <asp:ListItem Value="2">和夏</asp:ListItem> 
  256.                     </asp:DropDownList>
  257.                 </td>
  258.             </tr>
  259.                         <tr>
  260.                             <td colspan="3" align="center">
  261.                                 <asp:Button ID="btnEdit" runat="server" Text="儲存" OnClick="btnEdit_Click" />
  262.                             </td>
  263.                         </tr>
  264.                     </table>
  265.             </asp:Panel>
  266.             <asp:Panel ID="Panel3" runat="server" Height="204px" Width="564px"><br />
  267.                 <asp:Label BorderStyle="None" ID="Label4" runat="server" Font-Bold="True" Font-Size="Medium"
  268.                     Text="本部門詳細信息"></asp:Label>
  269.                     <table style="width: 456px;" border="1">
  270.                         <tr>
  271.                             <td align="center" style="width: 205px">
  272.                                 上級部門:</td>
  273.                             <td style="width: 321px" align="left">
  274.                                 <asp:Label BorderStyle="None" ID="lblLastDepartment" runat="server" Text=""></asp:Label>
  275.                             </td>
  276.                         </tr>
  277.                         <tr>
  278.                             <td align="center" style="width: 205px; height: 23px;">
  279.                                 部門名稱:</td>
  280.                             <td style="width: 321px; height: 23px;" align="left">
  281.                                 <asp:Label BorderStyle="None" ID="lblDepartmentName" runat="server" Text=""></asp:Label>
  282.                             </td>
  283.                         </tr>
  284.                         <tr>
  285.                             <td align="center" style="width: 205px">
  286.                                 部門代號:</td>
  287.                             <td style="width: 321px" align="left">
  288.                                 <asp:Label BorderStyle="None" ID="lblDepartmentCode" runat="server" Text=""></asp:Label>
  289.                             </td>
  290.                         </tr>
  291.                         <tr>
  292.                             <td align="center" style="width: 205px">
  293.                                 電話:</td>
  294.                             <td style="width: 321px" align="left">
  295.                                 <asp:Label BorderStyle="None" ID="lblTel" runat="server" Text=""></asp:Label>
  296.                             </td>
  297.                         </tr>
  298.                         <tr>
  299.                             <td align="center" style="width: 205px">
  300.                                 傳真:</td>
  301.                             <td style="width: 321px" align="left">
  302.                                 <asp:Label BorderStyle="None" ID="lblFax" runat="server" Text=""></asp:Label>
  303.                             </td>
  304.                         </tr>
  305.                         <tr>
  306.                                 <td align="center" style="width: 122px">層數:</td>
  307.                                <td style="width: 321px" align="left">
  308.                                 <asp:Label BorderStyle="None" ID="lblCeng" runat="server" Text=""></asp:Label>
  309.                             </td>
  310.             </tr>
  311.                     
  312.                         <tr>
  313.                             <td align="center" style="width: 205px; height: 23px;">
  314.                                 部門職能:</td>
  315.                             <td style="width: 321px; height: 23px;" align="left">
  316.                                 <asp:Label BorderStyle="None" ID="lblFunction" runat="server" Text=""></asp:Label>                                
  317.                             </td>
  318.                         </tr>
  319.                                     <tr>
  320.                 <td align="center" style="width: 122px">所属公司</td>
  321.                 <td style="width: 322px" align="left">
  322.                     <asp:Label ID="lblcompany" runat="server" BorderStyle="None" Text=""></asp:Label></td>
  323.             </tr>
  324.                     </table>
  325.             </asp:Panel>
  326.             </asp:View>
  327.         </asp:MultiView>
  328.     </form>
  329.     </center>
  330. </body>
  331. </html>