<%@ Page Title="广告管理" StylesheetTheme="AdminSkin" Language="C#" MasterPageFile="~/Others/AdminMasterPage.Master"
    AutoEventWireup="true" CodeBehind="AdvertisementManage.aspx.cs" Inherits="Solution.Admin.Contents.AdvertisementManage" %>
<%@ Register Assembly="BX.Common" Namespace="Common" TagPrefix="My" %>
<asp:Content ID="Content1" ContentPlaceHolderID="AdminContentHead" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="AdminContentCenter" runat="server">
    <form id="form1" name="ListForm" runat="server">
        <asp:ObjectDataSource ID="MyObjectDataSource" runat="server" SelectMethod="List"
            TypeName="Logic.Advertsing" EnablePaging="True" SelectCountMethod="Count">
            <SelectParameters>
                <asp:QueryStringParameter DefaultValue="0" Name="conditional" QueryStringField="conditional"
                    Type="string" />
                <asp:QueryStringParameter DefaultValue="0" Name="category" QueryStringField="category"
                    Type="String" />
                <asp:QueryStringParameter DefaultValue="0" Name="keywords" QueryStringField="keywords"
                    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="AdvertisementManage.aspx"><span>所有内容</span></a></li>
                            <li><a href="AdvertisementManage.aspx?conditional=equals&category=ADType&keywords=1"><span>图片类型</span></a></li>
                            <li><a href="AdvertisementManage.aspx?conditional=equals&category=ADType&keywords=2"><span>代码类型</span></a></li>
                            <li><a href="AdvertisementManage.aspx?conditional=equals&category=ADType&keywords=6"><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">
                    <My:ExtendedGridView ID="ExtendedGridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                        DataSourceID="MyObjectDataSource" CssClass="grid" TotalRows="0" EnableTheming="False"
                        PageSize="20" ItemName="广告管理" CheckBox="False" CheckBoxDataIndex="0" DisableShortcuts="False">
<AlternatingRowStyle CssClass="tr2"></AlternatingRowStyle>
                        <Columns>
                            <asp:BoundField DataField="ADID" HeaderText="ID">
                                <HeaderStyle Wrap="False" />
                                <ItemStyle Width="50px" Wrap="False" />
                            </asp:BoundField>
                            <asp:TemplateField HeaderText="类型">
                                <HeaderStyle Wrap="False" />
                                <ItemTemplate>
                                    <%#GetADType(Convert.ToInt32(DataBinder.Eval(Container.DataItem, "ADType")))%>
                                </ItemTemplate>
                                <ItemStyle Width="50px" Wrap="False" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="广告名称">
                                <HeaderStyle Wrap="False" />
                                <ItemTemplate>
                                    <%# DataBinder.Eval(Container.DataItem,"ADName") %>
                                </ItemTemplate>
                                <ItemStyle Wrap="False" HorizontalAlign="Left" />
                            </asp:TemplateField>
                            <asp:BoundField DataField="ADEngListhName" HeaderText="别名" />
                            <asp:BoundField DataField="ClickCount" HeaderText="点击数">
                                <HeaderStyle Wrap="False" />
                                <ItemStyle Width="50px" Wrap="False" />
                            </asp:BoundField>
                            <asp:TemplateField HeaderText="状态">
                                <HeaderStyle Wrap="False" />
                                <ItemTemplate>
                                    <%# DataBinder.Eval(Container.DataItem, "Status").Equals(1) ? "√" : "×"%>
                                </ItemTemplate>
                                <ItemStyle Width="50px" Wrap="False" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="操作">
                                <ItemTemplate>
                                    <a href='<%# "AdvertisementManage.aspx?cmd=delete&id="+DataBinder.Eval(Container.DataItem, "ADID")%>'
                                        onclick="return confirm('确定删除')">删除</a> <a href="<%# "AdvertisementEdit.aspx?cmd=modify&id="+DataBinder.Eval(Container.DataItem, "ADID")%>">修改</a>
                                </ItemTemplate>
                                <HeaderStyle Wrap="False" />
                                <ItemStyle Width="150px" Wrap="False" />
                            </asp:TemplateField>
                        </Columns>

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

<RowStyle HorizontalAlign="Center" CssClass="tr1"></RowStyle>
                    </My:ExtendedGridView>
                </div>
            </div>
            <div class="FormButtonArea">
                <asp:Button ID="btnNewAD" runat="server" Text="添加广告位" OnClientClick="window.location.href='AdvertisementEdit.aspx';return false;" />

            </div>
            <br />
            <script type="text/javascript">
                var searchOption = new DropDownList("ddlSearchOption");
                searchOption.initial({ "名称": "ADName" }, { "extend": true });
                function ListSearch() {
                    var keywords = document.getElementById("txtKeywords").value;
                    if (keywords != "") {
                        window.location.href = "AdvertisementManage.aspx?category=" + searchOption.get() + "&keywords=" + encodeURI(keywords);
                    } else {
                        window.location.href = "AdvertisementManage.aspx";
                    }
                }
            </script>
        </div>
    </form>
</asp:Content>
