<%@ Page Language="C#" MasterPageFile="~/admins/Masteradmin.master" AutoEventWireup="true" CodeFile="BookManager.aspx.cs" Inherits="admins_BookManager" Title="Untitled Page" %>
<%-- 在此处添加内容控件 --%>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <div align="center">
        <div align="left">
            <div style="width: 549px; height: 10px">
            <asp:Label ID="Label1" runat="server" ForeColor="Blue" Text="选择图书类型查看图书"></asp:Label>
<asp:DropDownList ID="ddlSearch" runat="server" OnSelectedIndexChanged="ddlSearch_SelectedIndexChanged" AutoPostBack="True" BackColor="MistyRose" Width="118px">
</asp:DropDownList>
</div>
        </div>
        <div align="left">
        <asp:GridView ID="gvBook" runat="server" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" CellPadding="4" DataKeyNames="book_ID" DataSourceID="OleDbDataSource1"
            ForeColor="#333333" GridLines="None"
            PageSize="5" Height="35px" Width="619px">
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <Columns>
                
                <asp:BoundField DataField="book_ID" HeaderText="编号" InsertVisible="False" ReadOnly="True"
                    SortExpression="book_ID" />
                <asp:TemplateField HeaderText="图书名" SortExpression="book_name">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" CausesValidation=false Text='<%# Bind("book_name") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# "~/orderbook.aspx?id="+Eval("book_ID") %>' Text='<%# Bind("book_name") %>'></asp:HyperLink>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="oldprice" HeaderText="原价" SortExpression="oldprice" />
                <asp:BoundField DataField="nowprice" HeaderText="现价" SortExpression="nowprice" />
                <asp:BoundField DataField="inTime" HeaderText="上架时间" SortExpression="inTime" ReadOnly="True" />
                <asp:BoundField DataField="book_number" HeaderText="库存" SortExpression="book_number" />
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" CausesValidation=false />
            </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" />
            <EmptyDataTemplate>
                &nbsp;<div align="center" style="width: 519px; height: 16px">
                    <asp:Label ID="Label2" runat="server" ForeColor="Red" Text="没有此种类型的图书" Width="214px"></asp:Label></div>
            </EmptyDataTemplate>
        </asp:GridView>
        </div> 
        <asp:AccessDataSource ID="OleDbDataSource1" runat="server" DataFile="~/App_Data/database.mdb"
            DeleteCommand="DELETE FROM [book_info] WHERE [book_ID] = @book_ID" InsertCommand="INSERT INTO [book_info] ([typeID], [book_name], [book_introduce], [oldprice], [nowprice], [book_image], [isNew], [inTime], [book_number]) VALUES (@typeID, @book_name, @book_introduce, @oldprice, @nowprice, @book_image, @isNew, @inTime, @book_number)"
            SelectCommand="SELECT * FROM [book_info] WHERE [typeID]=@typeID " UpdateCommand="UPDATE [book_info] SET [typeID] = @typeID, [book_name] = @book_name, [book_introduce] = @book_introduce, [oldprice] = @oldprice, [nowprice] = @nowprice, [book_image] = @book_image, [isNew] = @isNew, [inTime] = @inTime, [book_number] = @book_number WHERE [book_ID] = @book_ID">
            <SelectParameters>
            <asp:Parameter Name="typeID" Type=Int32 />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="book_ID" Type="Int64" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="typeID" Type="Int32" />
                <asp:Parameter Name="book_name" Type="String" />
                <asp:Parameter Name="book_introduce" Type="String" />
                <asp:Parameter Name="oldprice" Type="Double" />
                <asp:Parameter Name="nowprice" Type="Double" />
                <asp:Parameter Name="book_image" Type="String" />
                <asp:Parameter Name="isNew" Type="String" />
                <asp:Parameter Name="inTime" Type="DateTime" />
                <asp:Parameter Name="book_number" Type="Int32" />
                <asp:Parameter Name="book_ID" Type="Int64" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="typeID" Type="Int32" />
                <asp:Parameter Name="book_name" Type="String" />
                <asp:Parameter Name="book_introduce" Type="String" />
                <asp:Parameter Name="oldprice" Type="Double" />
                <asp:Parameter Name="nowprice" Type="Double" />
                <asp:Parameter Name="book_image" Type="String" />
                <asp:Parameter Name="isNew" Type="String" />
                <asp:Parameter Name="inTime" Type="DateTime" />
                <asp:Parameter Name="book_number" Type="Int32" />
            </InsertParameters>
        </asp:AccessDataSource>
        <div style="width: 450px; height: 5px" align="left">
            <asp:TextBox ID="tbType" runat="server" BackColor="MistyRose" Width="156px"></asp:TextBox>&nbsp;
            <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="添加图书类型" Width="85px" CausesValidation="False" /></div>
        <div align="left" style="width: 452px; height: 22px">
            &nbsp;<asp:DropDownList ID="delType" runat="server" BackColor="MenuBar" Width="158px">
            </asp:DropDownList>
            &nbsp;<asp:Button ID="Button3" runat="server" OnClick="Button3_Click" Text="删除图书类型" Width="85px" CausesValidation="False" /></div>
    </div>
    <div>
   <table width="553" height="282" border="0" align="center">
  <tr>
    <td width="44" rowspan="6">&nbsp;</td>
    <td width="108" align="right">图书名：</td>
    <td width="332">&nbsp;<asp:TextBox ID="tbName" runat="server" BackColor="MistyRose"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="tbName"
            ErrorMessage="*"></asp:RequiredFieldValidator></td>
    <td width="47" rowspan="6">&nbsp;</td>
  </tr>
  <tr>
    <td align="right">图书类别：</td>
    <td>&nbsp;<asp:DropDownList ID="ddlType" runat="server" BackColor="MenuBar" DataTextField="typeName" DataValueField="typeID">
        </asp:DropDownList></td>
  </tr>
  <tr>
    <td align="right">
        图书数量：&nbsp;</td>
    <td>&nbsp;<asp:TextBox ID="tbNum" runat="server" BackColor="MistyRose" MaxLength="5"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="*"
            Width="1px" ControlToValidate="tbNum"></asp:RequiredFieldValidator>
        <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="tbNum"
            ErrorMessage="请输入数字" MaximumValue="10000" MinimumValue="0" Type="Integer"></asp:RangeValidator></td>
  </tr>
  <tr>
    <td align="right">原价：</td>
    <td>&nbsp;<asp:TextBox ID="tbOld" runat="server" BackColor="MistyRose"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="tbOld"
            ErrorMessage="*"></asp:RequiredFieldValidator></td>
  </tr>
  <tr>
    <td align="right" style="height: 13px">现价：</td>
    <td style="height: 13px">&nbsp;<asp:TextBox ID="tbNow" runat="server" BackColor="MistyRose"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="tbNow"
            ErrorMessage="*"></asp:RequiredFieldValidator></td>
  </tr>
  <tr>
    <td align="right" style="height: 10px">是否新书：</td>
    <td style="height: 10px">&nbsp;<asp:DropDownList ID="ddlIsnew" runat="server" BackColor="MistyRose">
        <asp:ListItem Value="y">是</asp:ListItem>
        <asp:ListItem Value="n">否</asp:ListItem>
        </asp:DropDownList></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td rowspan="2" align="right">图书封面：</td>
    <td rowspan="2">&nbsp;<asp:FileUpload ID="uoImg" runat="server" BackColor="MistyRose" /></td>
    <td width="47">&nbsp;</td>
  </tr>
  <tr>
    <td height="17">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="17">&nbsp;</td>
    <td align="right">图书简介：</td>
    <td rowspan="2">&nbsp;<asp:TextBox ID="tbTxt" runat="server" Columns="30"
            Rows="3" TextMode="MultiLine" BackColor="MistyRose"></asp:TextBox></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="19">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="17">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;<asp:Button ID="Button2" runat="server" Text="添加图书" Width="83px" OnClick="Button2_Click" />
        &nbsp; &nbsp; &nbsp;
    </td>
    <td>&nbsp;</td>
  </tr>
</table>
    </div>
</asp:Content>
