<%@ Page Language="C#" %>

<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="TopWinCMS.BLL" %>
<%@ Import Namespace="TopWinCMS.Model" %>
<%@ Import Namespace="TopWinCMS.Common" %>
<%@ Import Namespace="TopWinCMS.IDAL" %>
<%@ Import Namespace="TopWinCMS.DALFactory" %>
<%@ Register Src="Header.ascx" TagName="Header" TagPrefix="uc1" %>
<%@ Register Src="SearchBar.ascx" TagName="searchbar" TagPrefix="uc1" %>
<%@ Register Src="Left.ascx" TagName="Left" TagPrefix="uc2" %>
<%@ Register Src="~/UserControl/UC_AjaxLoading.ascx" TagName="UC_AjaxLoading" TagPrefix="uc3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>园玉商城</title>
    <link href="/Shop/css.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript" src="/JS/TopWinCMS.js"></script>
    <script language="javascript" type="text/javascript" src="/JS/Ajax/Ajax.js"></script>
    <script language="javascript" type="text/javascript" src="/JS/Ajax/MemberLoginBar.js"></script>
    <script language="javascript" type="text/javascript" src="/JS/Ajax/Shop.js"></script>
    <script language="javascript" type="text/javascript" src="/JS/Ajax/PostComment.js"></script>
    <script language="javascript" type="text/javascript" src="/JS/Ajax/GetVote.js"></script>
    <script runat="server">  
    
        private void Page_Load(object sender, System.EventArgs e)
        {

            if (!IsPostBack)
            {
                new ClassManage().BindDDL(DDL_Class, TopWinCMS.Model.Enum.Class_BindOption.NoLink, "", 4);
                Bind();
            }
        }
        private void Bind()
        {
            Repeater1.DataSource = new Public_Class().Show(int.Parse(DDL_Class.SelectedValue));
            Repeater1.DataBind();


        }
        private List<ShopInfo> Repeater2DataSouce(object ClassID)
        {
            SQLModel s_model = new SQLModel();
            s_model.FieldKey = "ID";
            s_model.Fields = "*";
            s_model.OrderField = "ID DESC";
            s_model.PageNo = 1;
            s_model.PageSize = 100;
            s_model.TableName = "TopWinCMS_Shop";


            s_model.WHERE = " pass=1 and deleted=0 and ClassID in (select [ID] from TopWinCMS_Class where path like (select path+'%' from TopWinCMS_Class where [ID] = " + ClassID + "))";

            return new Public_Shop(4).BindList(s_model);
        }

        protected void DDL_Class_SelectedIndexChanged(object sender, EventArgs e)
        {
            Bind();
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td>
                <uc1:Header ID="Header1" runat="server" />
                <table width="1002
      " border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td height="68" colspan="2" valign="top" background="/shop/images/top_nav.gif">
                            <uc1:searchbar ID="SearchBar1" runat="server" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td height="5">
            </td>
        </tr>
        <tr>
            <td>
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td width="204" valign="top">
                            <uc2:Left ID="Left1" runat="server" />
                        </td>
                        <td valign="top">
                            <table width="794" border="0" align="center" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td width="794" height="29" background="/shop/images/middle_bg2.gif">
                                        &nbsp;&nbsp;<span class="black02"><strong>报价单</strong></span>
                                    </td>
                                </tr>
                            </table>
                            <asp:ScriptManager ID="ScriptManager1" runat="server">
                            </asp:ScriptManager>
                            <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                                <ProgressTemplate>
                                    <uc3:UC_AjaxLoading ID="UC_AjaxLoading1" runat="server" />
                                </ProgressTemplate>
                            </asp:UpdateProgress>
                            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                <ContentTemplate>
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td height="30" class="chen02">
                                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请选择你要查看的系列:
                                                <asp:DropDownList ID="DDL_Class" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DDL_Class_SelectedIndexChanged">
                                                </asp:DropDownList>
                                            </td>
                                        </tr>
                                    </table>
                                    <table width="780" border="0" align="center">
                                        <tr>
                                            <td width="528" height="28" align="center">
                                                产品名称
                                            </td>
                                            <td width="86" height="28" align="center">
                                                市场价
                                            </td>
                                            <td width="86" height="28" align="center">
                                                会员价
                                            </td>
                                            <td width="62" height="28" align="center">
                                                订购
                                            </td>
                                        </tr>
                                        <asp:Repeater ID="Repeater1" runat="server">
                                            <ItemTemplate>
                                                <tr>
                                                    <td height="28" colspan="4" bgcolor="#000000" style="color: #FFF; font-weight: bold;">
                                                        <%# Eval("ClassName") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td height="28" colspan="4">
                                                        <table width="780" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
                                                            <asp:Repeater ID="Repeater2" runat="server" DataSource='<%#Repeater2DataSouce(Eval("ID")) %>'>
                                                                <ItemTemplate>
                                                                    <tr>
                                                                        <td height="30" bgcolor="#F3F3F3" class="black01">
                                                                            <img src="<%# Eval("PicUrl") %>" alt="" width="73" height="73" align="absmiddle" /><%# Eval("GoodsName") %>
                                                                        </td>
                                                                        <td bgcolor="#F3F3F3" class="black01">
                                                                            <%# Eval("PriceMarket", "{0:c}")%>
                                                                        </td>
                                                                        <td bgcolor="#F3F3F3" class="black01">
                                                                            <%# Eval("PriceMember", "{0:c}")%>
                                                                        </td>
                                                                        <td bgcolor="#F3F3F3" class="blue">
                                                                            <input type="button" onclick="JoinCart(4,<%# Eval("ID") %>);" value="加入购物车" />
                                                                        </td>
                                                                    </tr>
                                                                </ItemTemplate>
                                                            </asp:Repeater>
                                                        </table>
                                                    </td>
                                                </tr>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                        <%
                                            if (Repeater1.Items.Count == 0)
                                            {
                                        %>
                                        <tr>
                                            <td colspan="4">
                                                没有数据
                                            </td>
                                        </tr>
                                        <%
                                            }
                                        %>
                                    </table>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
        </tr>
    </table>
    <script language="javascript" type="text/javascript">
        //Ajax显示购物车界面
        ShowShopingCart(4);
    </script>
    </form>
</body>
</html>
