<%@ Page Title="公告管理" Language="C#" StylesheetTheme="AdminSkin" MasterPageFile="~/Others/AdminMasterPage.Master" AutoEventWireup="true" CodeBehind="AnnouncementManage.aspx.cs" Inherits="Web.Admin.Contents.AnnouncementManage" %>
<%@ Register Assembly="BX.Common" Namespace="Common" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="AdminContentHead" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="AdminContentCenter" runat="server">
  <form id="form1" runat="server">
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" EnablePaging="True"
            SelectMethod="List" TypeName="Logic.Announcement" SelectCountMethod="Count" DeleteMethod="Delete">
           <DeleteParameters>
               <asp:Parameter DbType="Int32" Name="id" />
           </DeleteParameters>
             <SelectParameters>
                <asp:QueryStringParameter DefaultValue="0" Name="category" QueryStringField="category"
                    Type="String" />
                <asp:QueryStringParameter DefaultValue="0" Name="keywords" QueryStringField="keywords"
                    Type="String" />
                <asp:QueryStringParameter DefaultValue="0" Name="conditional" QueryStringField="conditional"
                    Type="string" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <div class="DivRightCenter">
            <div class="listdiv">
                <div class="grid-title">
                    <div class="grid-title-text">
                        <h4>
                            <span>公告管理</span>
                        </h4>
                    </div>
                    <div class="grid-title-menu">
                        <ul>
                            <li><a href="AnnouncementManage.aspx">所有公告</a></li>
                            <li><a href="AnnouncementManage.aspx?conditional=equare&category=Recommend&keywords=1"><span>置顶公告</span></a></li>
                        </ul>
                    </div>
                </div>
                <div class="grid-search">
                    Search:
                       <div class="grid-searchcontent">
                           <div class="userddl">
                               <ul>
                                   <li class="userddl-li">
                                       <input style="width: 40px;" class="ddltext" value="" id="ddlSearchOption" type="text" /><a href="javascript:" class="ddlarrow"></a></li>
                               </ul>
                           </div>
                           <input class="searchtext" id="txtKeywords" onkeypress="if(event.keyCode==13){ListSearch();}" type="text" /><input class="searchbutton" id="Button6" type="button" value="" onclick="ListSearch();" />
                       </div>
                </div>
                <div class="grid-list">
                    <cc1:ExtendedGridView ID="ExtendedGridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                        CssClass="grid" PageSize="20" DataSourceID="ObjectDataSource1" EnableTheming="False" ItemName="公告管理" CheckBox="False" CheckBoxDataIndex="0" DisableShortcuts="False" DataKeyNames="ID">
<AlternatingRowStyle CssClass="tr2"></AlternatingRowStyle>
                        <Columns>
                            <asp:BoundField DataField="ID" HeaderText="ID" />
                            <asp:BoundField DataField="Title" HeaderText="标题" />
                            <asp:TemplateField HeaderText="推荐">
                                <ItemTemplate>
                                    <%# DataBinder.Eval(Container.DataItem, "Recommend").Equals(1)?"推荐":""%>
                                </ItemTemplate>
                                <ItemStyle Width="50px" Wrap="False" />
                            </asp:TemplateField>

                            <asp:BoundField DataField="StartDate" HeaderText="起始日期">
                            <ItemStyle Width="100px" Wrap="False" />
                            </asp:BoundField>
                            <asp:BoundField DataField="EndDate" HeaderText="结束日期">
                            <ItemStyle Width="100px" Wrap="False" />
                            </asp:BoundField>
                            <asp:BoundField DataField="CreateDate" HeaderText="创建时间">
                            <ItemStyle Width="100px" Wrap="False" />
                            </asp:BoundField>
                            <asp:BoundField DataField="Sequence" HeaderText="排序">
                            <ItemStyle Width="50px" Wrap="False" />
                            </asp:BoundField>

                            <asp:TemplateField HeaderText="操作">
                                <ItemTemplate>
                                     <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Delete" OnClientClick='javascript:return confirm("确定删除？")' Text="删除" CausesValidation="false"></asp:LinkButton>
                                     &nbsp;<a href='<%#"AnnouncementEdit.aspx?id="+DataBinder.Eval(Container.DataItem,"ID") %>'>修改</a>
                                </ItemTemplate>
                                <ItemStyle Width="100px" Wrap="False" />
                            </asp:TemplateField>
                        </Columns>

<HeaderStyle HorizontalAlign="Center" Wrap="False" CssClass="gridhead"></HeaderStyle>

<RowStyle HorizontalAlign="Center" CssClass="tr1"></RowStyle>
                    </cc1:ExtendedGridView>
                </div>
            </div>
            <br />
            <div class="FormButtonArea">
                <asp:Button ID="Button1" runat="server" UseSubmitBehavior="false" OnClientClick="document.location.href='AnnouncementEdit.aspx';return false;"
                    Text="添加公告" />&nbsp;&nbsp;
                </div>
            <script type="text/javascript">
                var searchOption = new DropDownList("ddlSearchOption");
                searchOption.initial({ "标题": "Title" }, { "extend": true });
                function ListSearch() {
                    var keywords = document.getElementById("txtKeywords").value;
                    if (keywords != "") {
                        window.location.href = "AnnouncementManage.aspx?category=" + searchOption.get() + "&keywords=" + encodeURI(keywords);
                    } else {
                        window.location.href = "AnnouncementManage.aspx";
                    }
                }

            </script>
               
        </div>  
        <br />
        <br />
    </form>
</asp:Content>
