<%@ Page Language="C#" MasterPageFile="~/AdminMasterPage.master" AutoEventWireup="true" CodeFile="NoticeManage.aspx.cs" Inherits="Admin_NoticeManage" Title="Untitled Page" ValidateRequest="false"%>

<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    &nbsp;<table style="width: 576px; height: 217px">
        <tr>
            <td align="right" style="width: 8px; height: 27px">
                <asp:Label ID="Label1" runat="server" Text="现有公告" Width="51px"></asp:Label></td>
            <td align="left" style="width: 100px; height: 27px">
                <asp:Label ID="Label3" runat="server" Width="466px"></asp:Label></td>
        </tr>
        <tr>
            <td align="right" colspan="2" style="height: 8px">
                <hr />
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 8px">
            </td>
            <td align="left" style="width: 100px">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="notice_id"
        DataSourceID="SqlDataSource1" AllowPaging="True" Height="10px" PageSize="8" Width="425px">
        <Columns>
            <asp:BoundField DataField="notice_id" HeaderText="公告编号" InsertVisible="False" ReadOnly="True"
                SortExpression="notice_id" Visible="False" />
            <asp:TemplateField HeaderText="公告名称" SortExpression="title">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("title") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox1"
                        ErrorMessage="公告名称不能为空" Style="left: -159px; position: static; top: 25px" ValidationGroup="bb"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("title") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="公告内容" SortExpression="contents">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("contents") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TextBox2"
                        ErrorMessage="内容不能为空" Style="position: static" ValidationGroup="bb"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("contents") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="pubdate" HeaderText="公告日期" ReadOnly="True" SortExpression="pubdate" />
            <asp:TemplateField ShowHeader="False">
                <EditItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
                        Text="更新" ValidationGroup="bb"></asp:LinkButton>
                    <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                        Text="取消"></asp:LinkButton>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                        Text="编辑"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False" CommandName="Delete"
                        OnClientClick='return confirm("确认删除？")' Text="删除"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 8px; height: 37px">
            </td>
            <td align="left" style="width: 100px; height: 37px">
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 8px">
                <asp:Label ID="Label2" runat="server" Text="添加新公告" Width="88px"></asp:Label></td>
            <td align="left" style="width: 100px">
            </td>
        </tr>
        <tr>
            <td align="right" colspan="2" style="height: 7px">
                <hr />
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 8px">
            </td>
            <td align="left" style="width: 100px">
    <asp:FormView ID="FormView1" runat="server" DataKeyNames="notice_id" DataSourceID="SqlDataSource1"
        OnDataBound="FormView1_DataBound">
        <EditItemTemplate>
            notice_id:
            <asp:Label ID="notice_idLabel1" runat="server" Text='<%# Eval("notice_id") %>'></asp:Label><br />
            title:
            <asp:TextBox ID="titleTextBox" runat="server" Text='<%# Bind("title") %>'>
            </asp:TextBox><br />
            contents:
            <asp:TextBox ID="contentsTextBox" runat="server" Text='<%# Bind("contents") %>'>
            </asp:TextBox><br />
            pubdate:
            <asp:TextBox ID="pubdateTextBox" runat="server" Text='<%# Bind("pubdate") %>'>
            </asp:TextBox><br />
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                Text="更新">
            </asp:LinkButton>
            <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                Text="取消">
            </asp:LinkButton>
        </EditItemTemplate>
        <InsertItemTemplate>
            <table style="width: 406px; height: 123px">
                <tr>
                    <td align="right" style="width: 59px; height: 44px">
            公告名称:</td>
                    <td align="left" colspan="2" style="height: 44px">
            <asp:TextBox ID="titleTextBox" runat="server" Height="22px" Text='<%# Bind("title") %>'
                Width="189px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="titleTextBox"
                            ErrorMessage="公告名称不能为空" Style="left: 0px; position: static; top: 17px" ValidationGroup="aa"></asp:RequiredFieldValidator></td>
                </tr>
                <tr>
                    <td align="right" style="width: 59px; height: 174px" valign="top">
            公告内容:
            <br />
                    </td>
                    <td align="left" colspan="2" style="height: 174px">
                        <FCKeditorV2:FCKeditor ID="FCKeditor1" runat="server" Height="350px" Width="350px">
                        </FCKeditorV2:FCKeditor>
                        <br />
                        <br />
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 59px">
                    </td>
                    <td align="left" style="width: 40px">
            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                Text="添加新公告" Width="108px" ValidationGroup="aa"></asp:LinkButton></td>
                    <td align="left" style="width: 100px">
            <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                Text="重置"></asp:LinkButton></td>
                </tr>
            </table>
            &nbsp;<br />
            <br />
        </InsertItemTemplate>
        <ItemTemplate>
            notice_id:
            <asp:Label ID="notice_idLabel" runat="server" Text='<%# Eval("notice_id") %>'></asp:Label><br />
            title:
            <asp:Label ID="titleLabel" runat="server" Text='<%# Bind("title") %>'></asp:Label><br />
            contents:
            <asp:Label ID="contentsLabel" runat="server" Text='<%# Bind("contents") %>'></asp:Label><br />
            pubdate:
            <asp:Label ID="pubdateLabel" runat="server" Text='<%# Bind("pubdate") %>'></asp:Label><br />
            <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
                Text="编辑"></asp:LinkButton>
            <asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete"
                Text="删除"></asp:LinkButton>
            <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"
                Text="新建"></asp:LinkButton>
        </ItemTemplate>
    </asp:FormView>
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 8px">
            </td>
            <td align="left" style="width: 100px">
            </td>
        </tr>
    </table>
    <br />
    &nbsp;<br />
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
        ConnectionString="<%$ ConnectionStrings:DesertEagleConnectionString %>" DeleteCommand="DELETE FROM [DE_notice] WHERE [notice_id] = @original_notice_id"
        InsertCommand="INSERT INTO [DE_notice] ([title], [contents]) VALUES (@title, @contents)"
        OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [DE_notice] ORDER BY [notice_id] DESC"
        UpdateCommand="UPDATE [DE_notice] SET [title] = @title, [contents] = @contents WHERE [notice_id] = @original_notice_id" OnInserting="SqlDataSource1_Inserting">
        <DeleteParameters>
            <asp:Parameter Name="original_notice_id" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="title" Type="String" />
            <asp:Parameter Name="contents" Type="String" />
            <asp:Parameter Name="original_notice_id" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="title" Type="String" />
            <asp:Parameter Name="contents" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    &nbsp;<br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
</asp:Content>

