<%@ Page Language="C#" MasterPageFile="~/LogMasterPage.master" AutoEventWireup="true" CodeFile="LogList.aspx.cs" Inherits="LogList" Title="Untitled Page" %>
<%-- 在此处添加内容控件 --%>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <asp:DataList ID="DataList1" runat="server" DataKeyField="log_id" DataSourceID="SqlDataSource1">
        <ItemTemplate>
            <br />
            &nbsp;<asp:Label ID="log_titleLabel" runat="server" Text='<%# Eval("log_title") %>' style="left: -191px; position: relative; top: -8px" Font-Bold="True" Font-Italic="False" Font-Names="Arial" Font-Size="X-Large" ForeColor="Lime"></asp:Label><br />
            &nbsp;<br />
            发表日期：<asp:Label ID="pub_dateLabel" runat="server" Text='<%# Eval("pub_date") %>'></asp:Label>
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            &nbsp; &nbsp; 浏览量：
            <asp:Label ID="click_countLabel" runat="server" Text='<%# Eval("click_count") %>'></asp:Label><br />
            <br />
            &nbsp;<br />
            <asp:Label ID="contentsLabel" runat="server" Height="273px" Text='<%# Eval("contents") %>'
                Width="551px" BackColor="White"></asp:Label><br />
            <br />
        </ItemTemplate>
    </asp:DataList>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DesertEagleConnectionString2 %>"
        OnSelecting="SqlDataSource1_Selecting" SelectCommand="SELECT * FROM [DE_logs] WHERE ([log_id] = @log_id)">
        <SelectParameters>
            <asp:Parameter Name="log_id" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>
<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="ContentPlaceHolder2">
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
        CellPadding="4" DataKeyNames="comment_id" DataSourceID="SqlDataSource2" ForeColor="#333333"
        GridLines="None" Height="334px" Width="651px">
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <Columns>
            <asp:BoundField DataField="author" HeaderText="author" SortExpression="author" />
            <asp:BoundField DataField="pub_date" HeaderText="pub_date" SortExpression="pub_date" />
            <asp:BoundField DataField="contents" HeaderText="contents" SortExpression="contents" />
        </Columns>
        <RowStyle BackColor="#EFF3FB" />
        <EditRowStyle BackColor="#2461BF" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:DesertEagleConnectionString2 %>"
        OnSelecting="SqlDataSource2_Selecting" SelectCommand="SELECT * FROM [DE_comment] WHERE ([log_id] = @log_id)" ConflictDetection="CompareAllValues" DeleteCommand="DELETE FROM [DE_comment] WHERE [comment_id] = @original_comment_id AND [contents] = @original_contents AND [author] = @original_author AND [pub_date] = @original_pub_date AND [log_id] = @original_log_id" InsertCommand="INSERT INTO [DE_comment] ([contents], [author], [pub_date], [log_id]) VALUES (@contents, @author, @pub_date, @log_id)" OldValuesParameterFormatString="original_{0}" OnInserting="SqlDataSource2_Inserting" UpdateCommand="UPDATE [DE_comment] SET [contents] = @contents, [author] = @author, [pub_date] = @pub_date, [log_id] = @log_id WHERE [comment_id] = @original_comment_id AND [contents] = @original_contents AND [author] = @original_author AND [pub_date] = @original_pub_date AND [log_id] = @original_log_id">
        <SelectParameters>
            <asp:Parameter Name="log_id" Type="Int32" />
        </SelectParameters>
        <DeleteParameters>
            <asp:Parameter Name="original_comment_id" Type="Int32" />
            <asp:Parameter Name="original_contents" Type="String" />
            <asp:Parameter Name="original_author" Type="String" />
            <asp:Parameter Name="original_pub_date" Type="DateTime" />
            <asp:Parameter Name="original_log_id" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="contents" Type="String" />
            <asp:Parameter Name="author" Type="String" />
            <asp:Parameter Name="pub_date" Type="DateTime" />
            <asp:Parameter Name="log_id" Type="Int32" />
            <asp:Parameter Name="original_comment_id" Type="Int32" />
            <asp:Parameter Name="original_contents" Type="String" />
            <asp:Parameter Name="original_author" Type="String" />
            <asp:Parameter Name="original_pub_date" Type="DateTime" />
            <asp:Parameter Name="original_log_id" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="contents" Type="String" />
            <asp:Parameter Name="author" Type="String" />
            <asp:Parameter Name="pub_date" Type="DateTime" />
            <asp:Parameter Name="log_id" Type="Int32" />
        </InsertParameters>
    </asp:SqlDataSource>
</asp:Content>
<asp:Content ID="Content3" runat="server" ContentPlaceHolderID="ContentPlaceHolder3">
    <asp:Label ID="Label1" runat="server" Text="评论者姓名" Width="100px"></asp:Label>
    <asp:TextBox ID="TxtAu" runat="server" Style="left: 53px; position: relative; top: 0px"
        Width="165px" ValidationGroup="comment">4UBlog博友</asp:TextBox>
    <asp:Button ID="BtnPub" runat="server" OnClick="BtnPub_Click" Style="left: 160px;
        position: relative; top: 0px" Text="发表评论" Width="105px" ValidationGroup="comment" />
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TxtAu"
        ErrorMessage="*" ValidationGroup="comment"></asp:RequiredFieldValidator><br />
    <asp:TextBox ID="Txtcont" runat="server" Height="142px" Width="616px" ValidationGroup="comment"></asp:TextBox>
</asp:Content>
<asp:Content ID="Content4" runat="server" ContentPlaceHolderID="ContentPlaceHolder4">
    <asp:GridView ID="GridView2" runat="server" AllowPaging="True" AutoGenerateColumns="False"
        DataKeyNames="log_id" DataSourceID="SqlDataSource4" Height="218px" PageSize="5"
        Width="205px" CellPadding="4" ForeColor="#333333" GridLines="None">
        <Columns>
            <asp:HyperLinkField DataNavigateUrlFields="log_id" DataNavigateUrlFormatString="~/LogList.aspx?log_id={0}"
                DataTextField="log_title" HeaderText="日志题目" />
            <asp:BoundField DataField="click_count" HeaderText="点击" SortExpression="click_count" />
        </Columns>
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <RowStyle BackColor="#EFF3FB" />
        <EditRowStyle BackColor="#2461BF" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:DesertEagleConnectionString2 %>"
        OnSelected="SqlDataSource3_Selected" SelectCommand="SELECT [bloger_name] FROM [DE_logs] WHERE ([log_id] = @log_id)">
        <SelectParameters>
            <asp:QueryStringParameter Name="log_id" QueryStringField="log_id" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:DesertEagleConnectionString2 %>"
        OnSelecting="SqlDataSource4_Selecting" SelectCommand="SELECT * FROM [DE_logs] WHERE ([bloger_name] = @bloger_name)">
        <SelectParameters>
            <asp:Parameter Name="bloger_name" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>
