<%@ page language="C#" masterpagefile="AdminIndexMaster.master" autoeventwireup="true" inherits="Admin_Announce, HoWaveIMSV5.0" title="网站公告管理" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript" src="Js/getdate.js"></script>
 <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"></asp:ScriptManager>


  <table class="adminheading">
   <tr>
      <th valign="middle" class="menus" align="left" width="70%"> 公告管理</th>
      <td valign="middle" style="text-align:right; width:15%">
       <asp:Image ImageUrl="~/Images/Manage/edit.png"  id="newAnounce"  runat="server" CssClass="Imagebutton"/><br />
          发布公告</td>
      <td style=" text-align:center;width:15%">
       <asp:ImageButton ImageUrl="~/Images/Manage/delete.png"  ID="EditAnnounce" runat="server" CssClass="Imagebutton" OnClick="EditAnnounce_Click"   /><br />
        批量删除</td>         
   </tr>                     
</table>
  <fieldset>
      <legend>公告管理</legend>
      <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Always" >
         <ContentTemplate>
               <asp:GridView id="GridView1" runat="server" CssClass="adminlist" DataSourceID="ObjectDataSource1" Width="100%" RowStyle-HorizontalAlign="Center" DataKeyNames="AnnounceID" AutoGenerateColumns="False" AllowPaging="True" __designer:wfdid="w2">
                   <Columns>
                       <asp:BoundField DataField="AnnounceID" HeaderText="公告编号" InsertVisible="False" ReadOnly="True"
                           SortExpression="AnnounceID"/>                       
                       <asp:BoundField DataField="AnnounceTitle" HeaderText="公告标题" SortExpression="AnnounceTitle" />                       
                       <asp:BoundField DataField="AnnounceType" HeaderText="公告类型" SortExpression="AnnounceType"/>                      
                       <asp:BoundField DataField="AnnounceImportant" HeaderText="公告等级" SortExpression="AnnounceImportant"/>                       
                       <asp:BoundField DataField="AnnounceOwner" HeaderText="发布人" SortExpression="AnnounceOwner"/>                      
                       <asp:BoundField DataField="AnnounceBegin" HeaderText="公告发布日期" SortExpression="AnnounceBegin" HtmlEncode="False" DataFormatString="{0:d}" />                     
                       <asp:BoundField DataField="AnnounceEnd" HeaderText="公告结束日期" SortExpression="AnnounceEnd" HtmlEncode="False" DataFormatString="{0:d}" />
                       <asp:BoundField DataField="AnnounceContent" HeaderText="内容" />
                       <asp:CommandField ButtonType="Button" HeaderText="操作" ShowDeleteButton="True" ShowHeader="True" NewText="新建公告" SelectText="查看" ShowEditButton="True" />
                   </Columns>
                   <RowStyle HorizontalAlign="Center" />
               </asp:GridView> 
         </ContentTemplate>        
      </asp:UpdatePanel>
      <asp:Panel ID="Panel1" runat="server" CssClass="popupControl">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
               <center>
                   <asp:FormView ID="FormView1" runat="server"  DefaultMode="Insert" DataKeyNames="AnnounceID" DataSourceID="ObjectDataSource1">
                       <InsertItemTemplate>
                           <table class="adminlist">
                              <tr>
                                  <td width="30%">标题</td>
                                  <td width="70%" align="left"><asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("AnnounceTitle") %>'/></td>
                              </tr>
                               <tr>
                                  <td width="30%">类型</td>
                                  <td width="70%" align="left">
                                     <asp:DropDownList ID="type" runat="server" SelectedValue='<%# Bind("AnnounceType") %>'>
                                         <asp:ListItem Text="滚动" Value="1"></asp:ListItem>
                                         <asp:ListItem Text="弹窗" Value="2"></asp:ListItem>
                                     </asp:DropDownList> 
                                </td>
                              </tr>
                               <tr>
                                  <td width="30%">等级</td>
                                  <td width="70%" align="left">
                                     <asp:DropDownList ID="Important" runat="server" SelectedValue='<%# Bind("AnnounceImportant") %>' >
                                        <asp:ListItem Text="普通" Value="0"></asp:ListItem>
                                        <asp:ListItem Text="重要" Value="1"></asp:ListItem>
                                        <asp:ListItem Text="紧急" Value="2"></asp:ListItem>
                                     </asp:DropDownList>
                                  </td>
                              </tr>
                               <tr>
                                  <td width="30%">发布人</td>
                                  <td width="70%" align="left"><asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("AnnounceOwner") %>'/></td>
                              </tr>
                               <tr>
                                  <td width="30%">开始日期</td>
                                  <td width="70%" align="left"><asp:TextBox ID="BeginDate" runat="server" Text='<%# Bind("AnnounceBegin") %>'/></td>
                              </tr>
                               <tr>
                                  <td width="30%">结束日期</td>
                                  <td width="70%" align="left"><asp:TextBox ID="EndDate" runat="server" Text='<%# Bind("AnnounceEnd") %>'/></td>
                              </tr>
                               <tr>
                                  <td width="30%">公告内容</td>
                                  <td width="70%">
                                      <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("AnnounceContent") %>' TextMode="MultiLine" Height="200px"/>
                                  </td>
                              </tr>
                              <tr>
                                  <td>&nbsp;</td>
                                  <td> 
                                  <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Insert"
                                      Text="插入" /> 
                                  <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                                      Text="取消" />
                                 </td>
                              </tr>
                           </table>   
                       </InsertItemTemplate>
                       <EditItemTemplate>
                           <table class="adminlist">
                              <tr>
                                  <td width="30%">标题</td>
                                  <td width="70%" align="left"><asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("AnnounceTitle") %>'/></td>
                              </tr>
                               <tr>
                                  <td width="30%">类型</td>
                                  <td width="70%" align="left">
                                     <asp:DropDownList ID="type" runat="server" SelectedValue='<%# Bind("AnnounceType") %>'>
                                         <asp:ListItem Text="滚动" Value="1"></asp:ListItem>
                                         <asp:ListItem Text="弹窗" Value="2"></asp:ListItem>
                                     </asp:DropDownList> 
                                </td>
                              </tr>
                               <tr>
                                  <td width="30%">等级</td>
                                  <td width="70%" align="left">
                                     <asp:DropDownList ID="Important" runat="server" SelectedValue='<%# Bind("AnnounceImportant") %>' >
                                        <asp:ListItem Text="普通" Value="0"></asp:ListItem>
                                        <asp:ListItem Text="重要" Value="1"></asp:ListItem>
                                        <asp:ListItem Text="紧急" Value="2"></asp:ListItem>
                                     </asp:DropDownList>
                                  </td>
                              </tr>
                               <tr>
                                  <td width="30%">发布人</td>
                                  <td width="70%" align="left"><asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("AnnounceOwner") %>'/></td>
                              </tr>
                               <tr>
                                  <td width="30%">开始日期</td>
                                  <td width="70%" align="left"><asp:TextBox ID="BeginDate" runat="server" Text='<%# Bind("AnnounceBegin") %>'/></td>
                              </tr>
                               <tr>
                                  <td width="30%">结束日期</td>
                                  <td width="70%" align="left"><asp:TextBox ID="EndDate" runat="server" Text='<%# Bind("AnnounceEnd") %>'/></td>
                              </tr>
                               <tr>
                                  <td width="30%">公告内容</td>
                                  <td width="70%">
                                      <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("AnnounceContent") %>' TextMode="MultiLine" Height="200px"/>
                                  </td>
                              </tr>
                              <tr>
                                  <td>&nbsp;</td>
                                  <td> 
                                  <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Insert"
                                      Text="插入" /> 
                                  <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                                      Text="取消" />
                                 </td>
                              </tr>
                           </table>   
                       </EditItemTemplate>
                   </asp:FormView>
                </center>
            </ContentTemplate>
        </asp:UpdatePanel>
    </asp:Panel>
       <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="DeleteAnnounce"
              InsertMethod="AddAnnounce" SelectMethod="GetAnnounces" TypeName="AnnounceBLL"
              UpdateMethod="UpdateAnnounce" >
              <DeleteParameters>
                  <asp:Parameter Name="AnnounceID" Type="Int32" />
              </DeleteParameters>
              <UpdateParameters>
                  <asp:Parameter Name="AnnounceID" Type="Int32" />
                  <asp:Parameter Name="AnnounceTitle" Type="String" />
                  <asp:Parameter Name="AnnounceType" Type="Int32" />
                  <asp:Parameter Name="AnnounceImportant" Type="Int32" />
                  <asp:Parameter Name="AnnounceContent" Type="String" />
                  <asp:Parameter Name="AnnounceOwner" Type="String" />
                  <asp:Parameter Name="AnnounceBegin" Type="DateTime" />
                  <asp:Parameter Name="AnnounceEnd" Type="DateTime" />
              </UpdateParameters>
              <InsertParameters>
                  <asp:Parameter Name="AnnounceTitle" Type="String" />
                  <asp:Parameter Name="AnnounceType" Type="Int32" />
                  <asp:Parameter Name="AnnounceImportant" Type="Int32" />
                  <asp:Parameter Name="AnnounceContent" Type="String" />
                  <asp:Parameter Name="AnnounceOwner" Type="String" />
                  <asp:Parameter Name="AnnounceBegin" Type="DateTime" />
                  <asp:Parameter Name="AnnounceEnd" Type="DateTime" />
              </InsertParameters>
          </asp:ObjectDataSource>
    <ajaxToolkit:PopupControlExtender ID="pce1" runat="server" TargetControlID="newAnounce" PopupControlID="Panel1" Position="Left" />
    <ajaxToolkit:PopupControlExtender ID="pce2" runat="server" TargetControlID="EditAnnounce" PopupControlID="Panel1" Position="Left" />  
    <ajaxToolkit:DropShadowExtender ID="DropShadowExtender1" runat="server" TargetControlID="Panel1" TrackPosition="true" />       
    
  </fieldset>
</asp:Content>

