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

<!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>
    <meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
    <meta content="C#" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="../Css/GXSFW.CSS" rel="stylesheet" type="text/css" />
    <style type="text/css">
        #AddContainer th
        {
            /*background-color:#507cd1;*/
            width: 100px;
            text-align: right;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table class="sysnav" cellspacing="0" cellpadding="0" width="100%" border="0">
            <tr>
                <td>
                    <uc1:menuBack ID="MenuBack1" runat="server"></uc1:menuBack>
                </td>
            </tr>
        </table>
        <br />
        <table id="table1" width="98%" border="0" cellpadding="0" cellspacing="0" class="table_border" style="margin-left: 1%">
            <tr>
                <td class="table_title" style="width: 100%">
                    <asp:DataList ID="menuNav" runat="server" RepeatDirection="Horizontal">
                        <ItemTemplate>
                            <asp:Label ID="menuName" runat="server" ForeColor="white">Label</asp:Label>
                        </ItemTemplate>
                        <SeparatorTemplate>
                            --&gt;
                        </SeparatorTemplate>
                    </asp:DataList>
                </td>
            </tr>
            <tr id="ListContainer" runat="server" visible="false">
                <td>
                    <table cellpadding="5" cellspacing="0" border="1" style="border-collapse: collapse; width: 100%">
                        <tr>
                            <th>
                                编号
                            </th>
                            <th>
                                标题
                            </th>
                            <th>
                                备注
                            </th>
                            <th>
                                发布时间
                            </th>
                            <th>
                                是否结束
                            </th>
                            <th>
                                操作
                            </th>
                        </tr>
                        <%
                            for (int i = 0; list != null && i < list.Count; i++) {
                        %>
                        <tr>
                            <td align="center">
                                <%= list[i].ID %>
                            </td>
                            <td>
                                <a title="<% = list[i].Title %>"><%= Common.StringHelper.SubString(list[i].Title, 50, "...") %></a>
                            </td>
                            <td>
                                <a title="<%= list[i].Memo %>"><%= Common.StringHelper.SubString(list[i].Memo, 50, "...") %></a>
                            </td>
                            <td align="center">
                                <%= list[i].JoinTime.ToString("yyyy-MM-dd") %>
                            </td>
                            <td align="center">
                                <%= list[i].IsOver %>
                            </td>
                            <td align="center">
                                <a href="?ac=delete&id=<%= list[i].ID %>&currentPageIndex=<%=PageIndex %>&bigClassID=<%= BigClassID %>&menuID=<%= MenuID %>" onclick="if(!confirm('真的要删除吗？')){return false;}">
                                    删除</a>
                                &nbsp;
                                <%
                                    if (list[i].IsOver == DataAccess.Model.GuangXiSFWIsOver.未结束) {
                                %>
                                <a href="?ac=over&id=<%= list[i].ID %>&currentPageIndex=<%=PageIndex %>&bigClassID=<%= BigClassID %>&menuID=<%= MenuID %>">
                                    设置为已结束
                                </a>
                                <%
                                    }
                                    else {
                                %>
                                <a href="?ac=unover&id=<%= list[i].ID %>&currentPageIndex=<%=PageIndex %>&bigClassID=<%= BigClassID %>&menuID=<%= MenuID %>">
                                    设置为未结束
                                </a>
                                <%
                                    }
                                %>
                                &nbsp;
                                <a href="?ac=stat&orderby=issubmit&id=<%= list[i].ID %>&currentPageIndex=<%=PageIndex %>&bigClassID=<%= BigClassID %>&menuID=<%= MenuID %>">
                                    统计
                                </a>
                            </td>
                        </tr>
                        <%
                            }
                        %>
                        <tr>
                            <td colspan="6">
                                <asp:Label ID="showPage" runat="server" Style="float: left;"></asp:Label>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr id="AddContainer" runat="server" visible="false">
                <td>
                    <table cellpadding="5" cellspacing="0" border="0">
                        <tr>
                            <th>
                                标题
                            </th>
                            <td>
                                <asp:TextBox ID="AddTitle" runat="server" Width="400"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <th>
                                文件
                            </th>
                            <td>
                                <asp:FileUpload ID="AddFile" runat="server" Width="406" /><span style="color:Red">仅限word(.doc)或excel(.xls)文件</span>
                            </td>
                        </tr>
                        <tr>
                            <th valign="top">
                                备注
                            </th>
                            <td>
                                <asp:TextBox TextMode="MultiLine" Rows="5" runat="server" ID="AddMemo" Width="600"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <th valign="top">
                                现有帐号
                            </th>
                            <td>
                                <asp:GridView ID="userNameList" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None">
                                    <RowStyle BackColor="#EFF3FB" />
                                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                    <EditRowStyle BackColor="#2461BF" />
                                    <AlternatingRowStyle BackColor="White" />
                                </asp:GridView>
                                <asp:CheckBox ID="ReloadUsers" runat="server" Text="重新上传帐号" onclick="document.getElementById('ReUploadUserName').style.display = (this.checked ? '': 'none');" />
                            </td>
                        </tr>
                        <tr id="ReUploadUserName" style="display: none;">
                            <th>
                                重新上传帐号
                            </th>
                            <td>
                                <asp:FileUpload ID="AddUserNames" runat="server" Width="406" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <br />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center">
                                <asp:Button ID="AddSave" runat="server" Text="保 存" OnClick="AddSave_Click" />&nbsp;&nbsp;
                                <input type="button" onclick="history.go(-1);" value="取 消" />
                                
                                <script language="javascript" type="text/javascript">
                                    setTimeout(function() {
                                        document.getElementById('ReUploadUserName').style.display = (document.getElementById('ReloadUsers').checked ? '' : 'none');
                                    }, 500);
                                </script>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <br />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr id="ListButtonContainer" runat="server" visible="false">
                <td align="center" class="table_title" style="height: 40px">
                    <input type="button" onclick="location.href='?ac=add&bigclassid=<%= BigClassID %>&menuId=<%= MenuID %>';" value="添 加" />
                </td>
            </tr>
            <tr id="StatisticsContainer" runat="server" visible="false">
                <td>
                    <table width="100%" cellpadding="5" cellspacing="0" border="1" style="border-collapse: collapse">
                        <tr>
                            <th>
                                <a href="?ac=stat&orderby=username&id=<%= detail.ID %>&currentPageIndex=<%=PageIndex %>&bigClassID=<%= BigClassID %>&menuID=<%= MenuID %>">
                                    用户帐号
                                </a>
                            </th>
                            <th>
                                学校名称
                            </th>
                            <th>
                                所属地市
                            </th>
                            <th>
                                <a href="?ac=stat&orderby=issubmit&id=<%= detail.ID %>&currentPageIndex=<%=PageIndex %>&bigClassID=<%= BigClassID %>&menuID=<%= MenuID %>">
                                    是否已上传
                                </a>
                            </th>
                        </tr>
                        <%
                            int j = 0, k = 0;
                            for (int i = 0; detail != null && detail.Users != null && i < detail.Users.Count; i++) {
                        %>
                        <tr <%if (detail.Users[i].IsSubmit){Response.Write("bgcolor='#88dd88'");} %>>
                            <td>
                                <%= detail.Users[i].UserName %>
                            </td>
                            <td>
                                <%
                                    if (detail.Users[i].IsSubmit) {
                                        Response.Write("<a href='../images/guangxisfw/" + detail.ID.ToString() + "/" + detail.Users[i].SchoolName + "." + detail.FileExtension + "'>" + detail.Users[i].SchoolName + "</a>");
                                    }
                                    else {
                                        Response.Write(detail.Users[i].SchoolName);
                                    }
                                %>
                            </td>
                            <td>
                                <%= detail.Users[i].Region %>
                            </td>
                            <td>
                                <%
                                    if (detail.Users[i].IsSubmit) {
                                        Response.Write("√");
                                        j++;
                                    }
                                    else {
                                        Response.Write("×");
                                        k++;
                                    }
                                    
                                %>
                            </td>
                        </tr>
                        <%
                            }
                        %>
                        <tr>
                            <td colspan="4">
                                已经上传文件学校数量:<span style="color: #ff0000"><%= j %>个</span>, 未上传文件学校数量:<span style="color: #ff0000"><%= k %>个</span>&nbsp;&nbsp;
                                <a href="?ac=download&id=<%= detail.ID %>&currentPageIndex=<%=PageIndex %>&bigClassID=<%= BigClassID %>&menuID=<%= MenuID %>">
                                    打包下载所有已经上传的文件</a>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4" align="center">
                                <input type="button" value="返 回" onclick="location.href='ManageGuangXiSFW.aspx?ac=list&currentPageIndex=<%=PageIndex %>&bigClassID=<%= BigClassID %>&menuID=<%= MenuID %>';" />                                
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
