<%@ page language="C#" masterpagefile="MyShopMasterPage.master" autoeventwireup="true" inherits="Member_Shop_ProductInStock, WebApp_deploy" title="仓库商品" %>

<%@ Import Namespace="HoWave.Web.Shop" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="pageTitle">
        仓库里的商品</div>
    <br />
    <table class="SearchTableStyle">
        <tr class="tdbg">
            <td class="tdbg5" style="width: 250px; text-align: left;">
                商品名称：<asp:TextBox ID="TxtProductName" Width="170px" runat="server" />
            </td>
            <td class="tdbg5" style="width: 250px; text-align: left;">
                商品类型：<asp:DropDownList ID="ProductType" Width="170px" runat="server">
                    <asp:ListItem Text="全部" Value="0" />
                    <asp:ListItem Text="一口价" Value="1" />
                    <asp:ListItem Text="拍卖" Value="2" />
                    <asp:ListItem Text="团购" Value="3" />
                    <asp:ListItem Text="秒杀" Value="4" />
                    <asp:ListItem Text="积分" Value="5" />
                </asp:DropDownList>
            </td>
            <td class="tdbg5">
                <asp:Button ID="Button1" runat="server" Text=" 查 询 " OnClick="Search_OnClick" />
            </td>
        </tr>
    </table>
    <br />
    <div style="clear: both;">
    </div>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AllowPaging="True"
        PageSize="20" CssClass="tableHead" DataKeyNames="ProductID" OnRowDataBound="GridView1_RowDataBound"
        Width="98%" EnableViewState="False">
        <Columns>
            <asp:TemplateField HeaderText="选择" ItemStyle-Width="4%" ItemStyle-HorizontalAlign="Center">
                <ItemTemplate>
                    <input id="productids" name="productids" value="<%#Eval("ProductID") %>" type="checkbox" />
                </ItemTemplate>
                <HeaderTemplate>
                    <input id="chkAll" onclick="SelectAllCheckboxes(this,'');" type="checkbox" />
                </HeaderTemplate>
                <ItemStyle HorizontalAlign="Center" Width="4%"></ItemStyle>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="图片">
                <HeaderStyle Width="110px" />
                <ItemTemplate>
                    <asp:HyperLink ID="ProductImgLink" runat="server" NavigateUrl='<%#"../ShowProduct.aspx?ProductID="+Eval("ProductID") %>'
                        Target="_blank">
                        <%--<asp:Image ID="Product_Image" runat="server" ImageUrl='<%# Eval("ProductSmallImageUrl") %>'
                            onerror="this.src='/Images/show_nopic.gif'" Height="100px" Width="100px" />--%>
                        <asp:Image ID="Product_Image" runat="server" ImageUrl='<%# (Convert.ToString(Eval("ProductSmallImageUrl"))==""?"../Images/show_nopic.gif":"../"+Eval("ProductSmallImageUrl").ToString()) %>'
                            Height="100px" Width="100px" />
                    </asp:HyperLink>
                </ItemTemplate>
                <HeaderStyle Width="14%" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="商品名称">
                <ItemTemplate>
                    <asp:HyperLink ID="ProductName" runat="server" Text='<%# Eval("ProductName") %>'
                        NavigateUrl='<%#"../ShowProduct.aspx?ProductID="+Eval("ProductID") %>' Target="_blank" /><br />
                    <asp:Label ID="ProductType" runat="server" Text='<%#TextFormat.GetProductType(Eval("ProductType").ToString())    %>'
                        ForeColor="orangered" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="销售时间">
                <ItemTemplate>
                    <asp:Literal ID="LitBeginDate" runat="server" Text='<%#Eval("BeginDate") %>' /><br />
                    <asp:Literal ID="LitEndDate" runat="server" Text='<%#Eval("EndDate") %>' />
                </ItemTemplate>
                <ItemStyle Width="14%" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="价格">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%#Eval("ProductType").ToString()=="2"?Eval("CurrentPrice"): Eval("StandPrice") %>'></asp:Label><br />
                     <asp:Label ID="Label2" runat="server" Text='<%#Eval("ProductType").ToString()=="5"?"(换购积分："+Eval("NeedPresentExp")+")": "" %>' ForeColor="orangered"></asp:Label>
                </ItemTemplate>
                <ItemStyle Width="8%" />
            </asp:TemplateField>
            <asp:BoundField DataField="Stocks" HeaderText="库存量">
                <ItemStyle Width="8%" />
            </asp:BoundField>
            <asp:HyperLinkField HeaderText="编辑" DataNavigateUrlFields="ProductID" DataTextFormatString="编辑"
                DataNavigateUrlFormatString="../Add_Products.aspx?ProductID={0}" Target="_blank"
                ItemStyle-Width="6%" DataTextField="ProductID">
                <ItemStyle Width="6%"></ItemStyle>
            </asp:HyperLinkField>
        </Columns>
        <EmptyDataTemplate>
            <table class="TableHeader" style="width: 98%">
                <tr>
                    <th>
                        <input id="Checkbox1" type="checkbox" />选择
                    </th>
                    <th>
                        图片
                    </th>
                    <th>
                        商品名称
                    </th>
                    <th>
                        销售时间
                    </th>
                    <th>
                        价格
                    </th>
                    <th>
                        库存量
                    </th>
                    <th>
                        编辑
                    </th>
                </tr>
                <tr>
                    <td colspan="7">
                        暂无任何商品
                    </td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <PagerStyle CssClass="productPageStyle" />
    </asp:GridView>
    <div style="text-align: center; width: 98%; margin-top: 10px;">
        <asp:Button ID="OnSale_Button" runat="server" Text="商品上架" CommandName="OnSale" OnCommand="StockPorityButton_Command" />&nbsp;
        <asp:Button ID="btn_editProducts" runat="server" OnClick="btn_editProducts_Click"
            Text="批量修改" />
        <asp:Button ID="Delete_Button" runat="server" Text="批量删除" CommandName="Delete" OnCommand="StockPorityButton_Command"
            OnClientClick="return confirm('确定将删除所选定的商品，确认吗？')" /></div>
    <div style="margin: auto; width: 95%; margin-top: 10px; margin-left:10px; color:Blue;">
        &nbsp;&nbsp;注：<%--系统默认不删除有订单的商品！--%>这里的删除是把商品放到回收站中。
    </div>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetInStockProductsBySalerID"
        TypeName="HoWave.Web.Shop_Product" OldValuesParameterFormatString="original_{0}">
        <SelectParameters>
            <asp:Parameter Name="SalerID" Type="Int32" />
            <asp:Parameter DefaultValue="NotSoldAll" Name="Type" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
</asp:Content>
