<%@ page language="C#" validaterequest="false" masterpagefile="MyShop.master" enableeventvalidation="false" autoeventwireup="true" inherits="Shop_Manage_shop_product_recommend, mallz" title="推荐商品" enableviewstate="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript" >
function switchUL(obj,col){
    obj.style.backgroundColor=col;
    }
</script>
<div class="pageTitle">推荐商品管理</div>
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"/>    
<div class="tips_onclick"><p>店长您好！请把您最好的商品拿出来推荐哦。在店铺明显位置，单个商品页面下方都会有这些商品的展示。</p></div>

<div class="SearchTableStyle" style="width:98%; padding-left:0;"><div class="title"><span>已推荐商品</span>(允许推荐位：<%=allownum%>)</div></div>

<div style="width:98%; margin:0 auto;">
<asp:UpdatePanel ID="UpdatePanel2" runat="server"    >
    <ContentTemplate>
        <asp:DataList id="DataListEliteProduct" runat="server" DataKeyField="ProductID" RepeatDirection="Horizontal" RepeatColumns="6" DataSourceID="EliteProductSource" CellPadding="0" BorderWidth="0px" Width="100%" OnItemCommand="DataListEliteProduct_ItemCommand"   >
            <ItemTemplate>
            <UL style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; PADDING-TOP: 5px; TEXT-ALIGN: center" onmousemove="switchUL(this,'#F5F5F5')" onmouseout="switchUL(this,'#FFFFFF')"><LI style="HEIGHT: 100px"><A href='../ShowProduct.aspx?ProductID=<%# Eval("ProductID") %>'><IMG id="Editeproductimage" onerror="this.src='../Images/show_nopic.gif'" src='<%# "../"+Eval("ProductSmallImageUrl") %>' runat="server" /></A></LI><LI style="HEIGHT: 100px"><asp:Literal id="Label2" runat="server" Text='<%# Eval("ProductName") %>' __designer:wfdid="w1"></asp:Literal><BR /><SPAN style="COLOR: red"><asp:Literal id="Label3" runat="server" Text='<%# Eval("CurrentPrice") %>' __designer:wfdid="w2"></asp:Literal>元</SPAN></LI><LI>
            <asp:Button id="cancle_elite" runat="server" Text="取消推荐"  __designer:wfdid="w3"  CommandName="cancleshopelite" CommandArgument='<%# Eval("ProductID") %>'></asp:Button></LI></UL>
            </ItemTemplate>
        </asp:DataList> 
    </ContentTemplate>
</asp:UpdatePanel>
</div>

  <div class="SearchTableStyle" style="width:98%; display:none; padding-left:0;">    
        <div class="title"><span>添加推荐商品</span></div>
        <div>
          &nbsp;方法一：输入商品标题搜索<asp:TextBox ID="KeyWords" runat="server"/><asp:Button ID="Button1" runat="server" Text="搜索" OnClick="Button3_Click" /><br />
          &nbsp;方法二：直接选择商品
        </div>
  </div>
   
        <div style="clear:both"></div>
         <asp:UpdatePanel ID="UpdatePanel1" runat="server">
              <ContentTemplate>
            <asp:GridView id="GVProduct" runat="server" DataSourceID="ProductDataSource" CssClass="tableHead" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="ProductID">
                <Columns>
                <asp:TemplateField HeaderText="ID" HeaderStyle-Width="4%">
                <ItemTemplate>
                        <input  type="checkbox" name="chk_select" value='<%# Eval("ProductID") %>' />
                </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="图片" HeaderStyle-Width="12%">
                    <ItemTemplate>
                         <asp:HyperLink ID="HyperLink1" runat="server" Target="_blank" NavigateUrl='<%#  "../ShowProduct.aspx?ProductID="+Eval("ProductID") %>'>
                         <img id="productimage" src='<%# ((Convert.ToString(Eval("ProductSmallImageUrl"))=="")?"../Images/show_nopic.gif":Eval("ProductSmallImageUrl")) %>' />
                         </asp:HyperLink>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="名称" ItemStyle-HorizontalAlign="Left">
                    <ItemTemplate>
                          <asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("ProductName") %>' Target="_blank" NavigateUrl='<%#  "../ShowProduct.aspx?ProductID="+Eval("ProductID") %>'/>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="商品类型" HeaderStyle-Width="7%">
                    <ItemTemplate>
                        <asp:Literal ID="ProductType"  runat="server" Text='<%# MallZ.Web.Shop.TextFormat.GetProductType(Eval("ProductType").ToString()) %>' /><br />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="当前价格" HeaderStyle-Width="7%">
                    <ItemTemplate>
                        <asp:Literal ID="CurrentPrice" runat="server" Text='<%# Eval("CurrentPrice") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="上架情况" HeaderStyle-Width="7%">
                    <ItemTemplate>
                        <asp:Literal ID="EnableSingleSell" runat="server" Text='<%# (Eval("EnableSingleSell").ToString() == "True")?"√":"×" %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField HeaderText="库存量" HeaderStyle-Width="7%" DataField="Stocks" />
                <asp:TemplateField HeaderText="销售时间" HeaderStyle-Width="13%">
                    <ItemTemplate>
                        <asp:Literal ID="Literal1"  runat="server" Text='<%#Eval("BeginDate")%>' /><br />
                        <asp:Literal ID="EndDate"  runat="server" Text='<%# (Eval("NoLimitDate").ToString()=="1")?MallZ.Common.Language.Get("Shop/Product/AllValidDay"):Eval("EndDate") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="操作" HeaderStyle-Width="7%">
                    <ItemTemplate>
                         <asp:HyperLink ID="EditProduct" runat="server" Text="编辑" NavigateUrl='<%#"../EditProduct.aspx?ProductID="+Eval("ProductID") %>' Target="_blank" />
                    </ItemTemplate>
                </asp:TemplateField>
                </Columns>
                <PagerStyle CssClass="productPageStyle">
                </PagerStyle>
                </asp:GridView>
            </ContentTemplate>
             <Triggers>
            <asp:AsyncPostBackTrigger ControlID="ButElite" EventName="Click"></asp:AsyncPostBackTrigger>
            </Triggers>
         </asp:UpdatePanel>
        <div style="text-align:center; margin-top:10px;">
             <asp:Button ID="ButElite" runat="server" OnClick="ButElite_Click" Text="橱窗推荐" />
        </div>    
  
<asp:ObjectDataSource ID="EliteProductSource" runat="server" SelectMethod="GetRecommendProductBySalerID" TypeName="MallZ.Data.Shop_Product" UpdateMethod="SetProductShopElite">
    <SelectParameters>
        <asp:Parameter Name="SalerID" Type="Int32" />
        <asp:Parameter Name="num" Type="Int32" />
    </SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ProductDataSource" runat="server" SelectMethod="GetProductByCategoryIDShopIDKeywords" TypeName="MallZ.Data.Shop_Product" >
    <SelectParameters>
        <asp:Parameter DefaultValue="-1" Name="CateGoryID" Type="Int32" />
        <asp:Parameter DefaultValue="" Name="ShopID" Type="Int32" />
        <asp:ControlParameter ControlID="KeyWords" Name="KeyWords" PropertyName="Text" Type="String" />
        <asp:Parameter DefaultValue="-1" Name="DateTimeSect" Type="String" />
    </SelectParameters>
</asp:ObjectDataSource>            
</asp:Content>

