<%@ page language="C#" validaterequest="false" masterpagefile="MyShop.master" enableeventvalidation="false" autoeventwireup="true" inherits="Shop_Manage_shop_product_recommend, WebApp_deploy" title="推荐商品" enableviewstate="true" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <script type="text/javascript">
        function switchUL(obj, col) {
            obj.style.backgroundColor = col;
        }
    </script>
    <script type="text/javascript">
        //切换选项卡                
        function setButtonActive(flags) {
            var _flag = parseInt(flags);

            var otherli = document.getElementById("otherli"); //其它商品
            var scoreli = document.getElementById("scoreli"); //积分商品
            var promotionmanage = "<%=promotionmanage %>";
            if (promotionmanage == "0") {
                scoreli.style.display = "none";
                otherli.getElementsByTagName("a")[0].innerText = "全部";
            }
            if (_flag == 0) {
                otherli.className = "active";
                scoreli.className = "";
            } else {
                otherli.className = "";
                scoreli.className = "active";
            }
        }   
    </script>
    <div class="pageTitle">
        推荐商品管理</div>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div class="tips_onclick" style="width: 94%">
        <div style="padding: 5px 5px 5px 25px;">
            店长您好！请把您最好的商品拿出来推荐哦。在店铺明显位置，单个商品页面下方都会有这些商品的展示。
        </div>
    </div>
    <div id="MainMenu">
        <div class="TabMenu">
            <!--一级导航-->
            <ul id="M1">
                <li id="otherli" class="active"><a href="shop_product_recommend.aspx?TabMenu=tabOther">
                    <asp:Literal ID="ltrOther" runat="server" Text="其它商品"></asp:Literal>
                </a></li>
                <li id="scoreli"><a href="shop_product_recommend.aspx?TabMenu=tabScore">
                    <asp:Literal ID="ltrScore" runat="server" Text="积分商品"></asp:Literal>
                </a></li>
            </ul>
        </div>
        <div class="TabText">
            <div class="SearchTableStyle" style="width: 98%; padding-left: 0;">
                <div class="title">
                    <span>已推荐商品</span></div>
            </div>
            <div style="width: 98%; margin: 0 auto;">
                <%--<asp:UpdatePanel ID="UpdatePanel2" runat="server">
            <ContentTemplate>--%>
                <asp:DataList ID="DataListEliteProduct" runat="server" OnItemDataBound="DataListEliteProduct_ItemDataBound"
                    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: 120px"><a href='../ShowProduct.aspx?ProductID=<%# Eval("ProductID") %>'
                                target="_blank">
                                <img id="Editeproductimage" style="width: 120px; height: 120px" src='<%# "../"+Eval("ProductSmallImageUrl") %>'
                                    alt="" runat="server" /></a></li>
                            <li style="height: 100px">
                                <asp:Literal ID="Label2" runat="server" Text='<%#Eval("ProductName").ToString().Length > 10 ? Eval("ProductName").ToString().Substring(0, 10)+"..." : Eval("ProductName")%>'
                                    __designer:wfdid="w1"></asp:Literal>
                                <%--<asp:Literal ID="Label2" runat="server" Text='<%# Eval("ProductName") %>' __designer:wfdid="w1"></asp:Literal>
                                --%>
                                <br />
                                <span style="color: red">
                                    <asp:HiddenField ID="hfNeedPresentExpElite" runat="server" Value='<%#Eval("NeedPresentExp") %>' />
                                    <asp:HiddenField ID="hfProductTypeElite" runat="server" Value='<%#Eval("ProductType") %>' />
                                    <asp:Literal ID="Label3" runat="server" Text='<%# Eval("StandPrice") %>' __designer:wfdid="w2"></asp:Literal></span></li><li>
                                        <asp:Button ID="cancle_elite" runat="server" Text="取消推荐" __designer:wfdid="w3" CommandName="cancelEli"
                                            CommandArgument='<%# Eval("ProductID") %>'></asp:Button></li></ul>
                    </ItemTemplate>
                </asp:DataList>
                <%--</ContentTemplate>
        </asp:UpdatePanel>--%>
            </div>
            <div class="SearchTableStyle" style="width: 98%; 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" CssClass="tableHead" AllowPaging="True"
                AutoGenerateColumns="False" DataKeyNames="ProductID" Border="0" OnDataBound="GVProduct_DataBound"
                OnPageIndexChanging="GVProduct_PageIndexChanging" OnRowDataBound="GVProduct_RowDataBound"
                PageSize="10">
                <Columns>
                    <asp:TemplateField HeaderText="推荐">
                        <ItemTemplate>
                            <input type="checkbox" name="chk_select" value='<%# Eval("ProductID") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="商品类型">
                        <ItemTemplate>
                            <asp:Literal ID="ProductType" runat="server" Text='<%# HoWave.Web.Shop.TextFormat.GetProductType(Eval("ProductType").ToString()) %>' /><br />
                            <span>
                                <asp:Literal ID="CurrentPrice" runat="server" Text='<%# Eval("StandPrice") %>' /></span>
                            <asp:HiddenField ID="hfNeedPresentExp" runat="server" Value='<%#Eval("NeedPresentExp") %>' />
                            <asp:HiddenField ID="hfProductType" runat="server" Value='<%#Eval("ProductType") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="名称">
                        <ItemTemplate>
                            <%--<asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("ProductName") %>' NavigateUrl='<%#  "../ShowProduct.aspx?ProductID="+Eval("ProductID") %>' />--%>
                            <asp:HyperLink ID="HyperLink1" runat="server" Target="_blank" Text='<%#Eval("ProductName").ToString().Length > 30 ? Eval("ProductName").ToString().Substring(0, 28)+"..." : Eval("ProductName")%>'
                                NavigateUrl='<%#  "../ShowProduct.aspx?ProductID="+Eval("ProductID") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="图片">
                        <ItemTemplate>
                            <img runat="server" id="productimage" src='<%# ((Convert.ToString(Eval("ProductSmallImageUrl"))=="")?"../Images/show_nopic.gif":"../"+Eval("ProductSmallImageUrl")) %>'
                                width="68" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="结束时间">
                        <ItemTemplate>
                            <asp:Literal ID="EndDate" runat="server" Text='<%#Eval("EndDate")%>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="操作">
                        <ItemTemplate>
                            <%--<asp:HyperLink ID="EditProduct" runat="server" Text="编辑" NavigateUrl='<%#"../EditProduct.aspx?ProductID="+Eval("ProductID") %>'
                        Target="_blank" />--%>
                            <asp:HyperLink ID="EditProduct" runat="server" Text="编辑" NavigateUrl='<%#"../Add_Products.aspx?ProductID="+Eval("ProductID") %>'
                                Target="_blank" />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <PagerStyle CssClass="productPageStyle"></PagerStyle>
            </asp:GridView>
            <div style="text-align: center; margin-top: 10px;">
                <asp:Button ID="ButElite" runat="server" OnClick="ButElite_Click" Text=" 推 荐 " />
            </div>
            <%--</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="HoWave.Web.Shop_Product" UpdateMethod="SetProductElite">
                <SelectParameters>
                    <asp:Parameter Name="SalerID" Type="Int32" />
                    <asp:Parameter Name="proWhere" Type="String" />
                </SelectParameters>
                <UpdateParameters>
                    <asp:Parameter Name="IsElite" Type="Boolean" />
                    <asp:Parameter Name="ProductID" Type="Int32" />
                </UpdateParameters>
            </asp:ObjectDataSource>
            <%--<asp:ObjectDataSource ID="ProductDataSource" runat="server" SelectMethod="GetProductByCategoryIDShopIDKeywords"
        TypeName="HoWave.Web.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>--%>
            <br />
        </div>
    </div>
    <script type="text/javascript">        setButtonActive('<%=m_flag %>');</script>
</asp:Content>
