<%@ Page Language="C#" MasterPageFile="~/RegisterMasterPage.master" AutoEventWireup="true" CodeFile="RegisterManage.aspx.cs" Inherits="Register_RegisterManage" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    &nbsp;<asp:FormView ID="FormView1" runat="server" DataKeyNames="bloger_name" DataSourceID="SqlDataSource1"
        OnDataBound="FormView1_DataBound" OnPageIndexChanging="FormView1_PageIndexChanging">
        <EditItemTemplate>
            <table style="width: 554px; height: 127px">
                <tr>
                    <td align="left" colspan="2" style="height: 39px">
                        <asp:Label ID="Label1" runat="server" Text="编辑我的博客信息"></asp:Label></td>
                    <td align="left" colspan="2" style="height: 39px">
                        <asp:Label ID="Label2" runat="server" Font-Size="Small" Width="290px">(等待管理员审核)</asp:Label></td>
                </tr>
                <tr>
                    <td align="left" colspan="4" style="height: 3px">
                        <hr />
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 35px">
                    </td>
                    <td align="right" style="width: 94px">
                        博客名称：</td>
                    <td align="left" colspan="2">
            <asp:TextBox ID="bloger_titleTextBox" runat="server" Text='<%# Bind("bloger_title") %>'>
            </asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="bloger_titleTextBox"
                            ErrorMessage="博客名称不能为空" ValidationGroup="reg"></asp:RequiredFieldValidator></td>
                </tr>
                <tr>
                    <td align="right" style="width: 35px; height: 27px">
                    </td>
                    <td align="right" style="width: 94px; height: 27px">
                        博客描述：
                    </td>
                    <td align="left" colspan="2" style="height: 27px">
            <asp:TextBox ID="descriptionTextBox" runat="server" Text='<%# Bind("description") %>'>
            </asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="descriptionTextBox"
                            ErrorMessage="博客描述不能为空" ValidationGroup="reg"></asp:RequiredFieldValidator></td>
                </tr>
                <tr>
                    <td align="right" style="width: 35px; height: 53px" valign="top">
                    </td>
                    <td align="right" style="width: 94px; height: 53px" valign="top">
                        所在院系：</td>
                    <td align="left" colspan="2" style="height: 53px" valign="top">
            <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlDataSource3"
                DataTextField="college_name" DataValueField="college_id" SelectedValue='<%# Bind("college_id") %>'>
            </asp:DropDownList></td>
                </tr>
                <tr>
                    <td align="right" style="width: 35px">
                    </td>
                    <td align="right" style="width: 94px">
                    </td>
                    <td align="left" style="width: 72px">
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                Text="更新信息" ValidationGroup="reg"></asp:LinkButton>
                    </td>
                    <td align="left" style="width: 100px">
            <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                Text="重置"></asp:LinkButton></td>
                </tr>
            </table>
            <br />
            &nbsp;
            <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConflictDetection="CompareAllValues"
                ConnectionString="<%$ ConnectionStrings:DesertEagleConnectionString %>" DeleteCommand="DELETE FROM [DE_college] WHERE [college_id] = @original_college_id AND [college_name] = @original_college_name"
                InsertCommand="INSERT INTO [DE_college] ([college_name]) VALUES (@college_name)"
                OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [college_id], [college_name] FROM [DE_college]"
                UpdateCommand="UPDATE [DE_college] SET [college_name] = @college_name WHERE [college_id] = @original_college_id AND [college_name] = @original_college_name">
                <DeleteParameters>
                    <asp:Parameter Name="original_college_id" Type="Int32" />
                    <asp:Parameter Name="original_college_name" Type="String" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter Name="college_name" Type="String" />
                    <asp:Parameter Name="original_college_id" Type="Int32" />
                    <asp:Parameter Name="original_college_name" Type="String" />
                </UpdateParameters>
                <InsertParameters>
                    <asp:Parameter Name="college_name" Type="String" />
                </InsertParameters>
            </asp:SqlDataSource>
        </EditItemTemplate>
        <InsertItemTemplate>
            <table style="width: 560px; height: 117px">
                <tr>
                    <td align="left" style="width: 24px">
                        <asp:Label ID="Label3" runat="server" Text="填写博客信息：" Width="112px"></asp:Label></td>
                    <td align="center" colspan="2">
                        <asp:Label ID="Label4" runat="server" Width="398px"></asp:Label></td>
                </tr>
                <tr>
                    <td colspan="3" style="height: 10px">
                        <hr />
                    </td>
                </tr>
                <tr>
                    <td style="width: 24px">
                    </td>
                    <td align="center" style="width: 90px">
                        博客名称：</td>
                    <td align="left" style="width: 100px">
            <asp:TextBox ID="bloger_titleTextBox" runat="server" Text='<%# Bind("bloger_title") %>' Width="151px" ValidationGroup="A"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="bloger_titleTextBox"
                            ErrorMessage="博客名称不能为空" Width="131px" ValidationGroup="A"></asp:RequiredFieldValidator></td>
                </tr>
                <tr>
                    <td style="width: 24px">
                    </td>
                    <td align="center" style="width: 90px">
                        &nbsp;博客描述：</td>
                    <td align="left" style="width: 100px">
            <asp:TextBox ID="descriptionTextBox" runat="server" Text='<%# Bind("description") %>' ValidationGroup="A"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="descriptionTextBox"
                            ErrorMessage="博客描述不能为空" Width="138px" ValidationGroup="A"></asp:RequiredFieldValidator></td>
                </tr>
                <tr>
                    <td style="width: 24px; height: 49px" valign="top">
                    </td>
                    <td align="center" style="width: 90px; height: 49px" valign="top">
                        &nbsp;所在院系：</td>
                    <td align="left" style="width: 100px; height: 49px" valign="top">
            <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource2"
                DataTextField="college_name" DataValueField="college_id">
            </asp:DropDownList></td>
                </tr>
                <tr>
                    <td style="width: 24px">
                    </td>
                    <td align="center" style="width: 90px">
            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                 Text="确认" OnClick="InsertButton_Click1" ValidationGroup="A"></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;&nbsp;<br />
            <br />
            <br />
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:DesertEagleConnectionString %>"
                SelectCommand="SELECT [college_id], [college_name] FROM [DE_college]"></asp:SqlDataSource>
        </InsertItemTemplate>
        <ItemTemplate>
            bloger_name:
            <asp:Label ID="bloger_nameLabel" runat="server" Text='<%# Eval("bloger_name") %>'></asp:Label><br />
            college_id:
            <asp:Label ID="college_idLabel" runat="server" Text='<%# Bind("college_id") %>'></asp:Label><br />
            bloger_title:
            <asp:Label ID="bloger_titleLabel" runat="server" Text='<%# Bind("bloger_title") %>'></asp:Label><br />
            description:
            <asp:Label ID="descriptionLabel" runat="server" Text='<%# Bind("description") %>'></asp:Label><br />
            pub_date:
            <asp:Label ID="pub_dateLabel" runat="server" Text='<%# Bind("pub_date") %>'></asp:Label><br />
            click_count:
            <asp:Label ID="click_countLabel" runat="server" Text='<%# Bind("click_count") %>'></asp:Label><br />
            bloger_enable:
            <asp:CheckBox ID="bloger_enableCheckBox" runat="server" Checked='<%# Bind("bloger_enable") %>'
                Enabled="false" /><br />
            is_top:
            <asp:CheckBox ID="is_topCheckBox" runat="server" Checked='<%# Bind("is_top") %>'
                Enabled="false" /><br />
            is_forbid:
            <asp:CheckBox ID="is_forbidCheckBox" runat="server" Checked='<%# Bind("is_forbid") %>'
                Enabled="false" /><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>
    &nbsp; &nbsp;<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
        ConnectionString="<%$ ConnectionStrings:DesertEagleConnectionString %>" DeleteCommand="DELETE FROM [DE_bloger] WHERE [bloger_name] = @original_bloger_name AND [college_id] = @original_college_id AND [bloger_title] = @original_bloger_title AND [description] = @original_description AND [pub_date] = @original_pub_date AND [click_count] = @original_click_count AND [bloger_enable] = @original_bloger_enable AND [is_top] = @original_is_top AND [is_forbid] = @original_is_forbid"
        InsertCommand="INSERT INTO [DE_bloger] ([bloger_name], [college_id], [bloger_title], [description], [pub_date], [click_count], [bloger_enable], [is_top], [is_forbid]) VALUES (@bloger_name, @college_id, @bloger_title, @description, default, default,default,default,default)"
        OldValuesParameterFormatString="original_{0}" OnSelecting="SqlDataSource1_Selecting"
        SelectCommand="SELECT * FROM [DE_bloger] WHERE ([bloger_name] = @bloger_name)"
        UpdateCommand="UPDATE [DE_bloger] SET [college_id] = @college_id, [bloger_title] = @bloger_title, [description] = @description WHERE [bloger_name] = @original_bloger_name" OnInserting="SqlDataSource1_Inserting" OnUpdating="SqlDataSource1_Updating">
        <DeleteParameters>
            <asp:Parameter Name="original_bloger_name" Type="String" />
            <asp:Parameter Name="original_college_id" Type="Int32" />
            <asp:Parameter Name="original_bloger_title" Type="String" />
            <asp:Parameter Name="original_description" Type="String" />
            <asp:Parameter Name="original_pub_date" Type="DateTime" />
            <asp:Parameter Name="original_click_count" Type="Int32" />
            <asp:Parameter Name="original_bloger_enable" Type="Boolean" />
            <asp:Parameter Name="original_is_top" Type="Boolean" />
            <asp:Parameter Name="original_is_forbid" Type="Boolean" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="college_id" Type="Int32" />
            <asp:Parameter Name="bloger_title" Type="String" />
            <asp:Parameter Name="description" Type="String" />
            <asp:Parameter Name="original_bloger_name" Type="String" />
        </UpdateParameters>
        <SelectParameters>
            <asp:Parameter Name="bloger_name" Type="String" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="bloger_name" Type="String" />
            <asp:Parameter Name="college_id" Type="Int32" />
            <asp:Parameter Name="bloger_title" Type="String" />
            <asp:Parameter Name="description" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
</asp:Content>

