<%@ 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="Left2.ascx" TagName="Left" TagPrefix="uc2" %>
<%@ Register Assembly="TopWinCMS.WebControls" Namespace="TopWinCMS.WebControls" TagPrefix="TW" %>
<!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">  
    
        int BrandID;
        SQLModel s_model = new SQLModel();
        private void Page_Load(object sender, System.EventArgs e)
        {
            BrandID = int.Parse(Request["BrandID"]);
            if (!IsPostBack)
            {
                Bind_GoodsList();
            }
        }
        private void Bind_GoodsList()
        {

            s_model.Fields = "ID,ModelID,GoodsName,Hits,UpdateTime,Content,Stars,OnTop,Elite,IncludePic,ClassID,PicUrl,Brief,ColorStyle,FontStyle,PriceMarket,PriceMember";
            s_model.TableName = "TopWinCMS_Shop";
            s_model.WHERE = " deleted=0 and pass=1 and BrandID = " + BrandID;
            s_model.FieldKey = "ID";
            s_model.OrderField = "ID Desc";


            s_model.PageSize = 25;
            //s_model.PageNo = (Request["PageNo"] == null) ? 1 : int.Parse(Request["PageNo"]);

            ICommon MyCommonDAL = DataAccess.Instance<ICommon>();

            PageNavigation1.RecordCount = MyCommonDAL.Count(s_model);

            DL_List.DataSource = MyCommonDAL.DataRead(s_model);
            DL_List.DataBind();

        }
        protected void PageNavigation1_PageChanging(object src, PageChangingEventArgs e)
        {
            s_model.PageNo = e.NewPageIndex;
            Bind_GoodsList();
        }
    </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="images/Shop/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="images/Shop/middle_bg2.gif">
                                        &nbsp;&nbsp;<span class="black02"><strong>园玉商城 > 品牌专卖</strong></span>
                                    </td>
                                </tr>
                            </table>
                            <asp:DataList ID="DL_List" runat="server" HorizontalAlign="Center" RepeatColumns="4"
                                RepeatDirection="Horizontal" ShowFooter="False" ShowHeader="False" CellSpacing="20"
                                CellPadding="1">
                                <ItemTemplate>
                                    <table width="0" border="0" align="center" cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td>
                                                <div align="center">
                                                    <a href="ShopShow-<%#Eval("ID") %>.htm">
                                                        <img alt="" src="<%#Eval("PicUrl") %>" width="111" height="111" /></a>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="20" class="black01">
                                                产品名称：<%#Eval("GoodsName") %>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <img src="images/Shop/icon2.gif" width="16" height="16" align="absmiddle" /><span
                                                    class="black01">&nbsp;原价：<%# Eval("PriceMarket", "{0:c}")%></span><br />
                                                <img src="images/Shop/icon3.gif" width="16" height="16" align="absmiddle" /><span
                                                    class="chen02">&nbsp;特价：<%# Eval("PriceMember", "{0:c}")%></span>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td height="30">
                                                <input type="image" src="images/Shop/bt_6.gif" width="99" height="21" onclick="JoinCart(<%=Request["ModelID"] %>,<%#Eval("ID") %>); return false;" />
                                                <input type="image" src="images/Shop/bt_7.gif" width="53" height="21" hspace="10"
                                                    onclick="Favorite('<%#Eval("GoodsName") %>','<%=Request.Url %>'); return false;" />
                                            </td>
                                        </tr>
                                    </table>
                                </ItemTemplate>
                            </asp:DataList>
                            <%
                                if (DL_List.Items.Count == 0)
                                {
                            %>
                            没有商品数据
                            <%
                            
                                } %>
                            <div style="margin-left: auto; margin-right: auto; width: 700px">
                                <TW:PageNavigation ID="PageNavigation1" runat="server" OnPageChanging="PageNavigation1_PageChanging"
                                    PageSize="24" HorizontalAlign="Center">
                                </TW:PageNavigation>
                            </div>
                        </td>
                    </tr>
                </table>
                <br />
            </td>
        </tr>
    </table>
    <script language="javascript" type="text/javascript">
      //Ajax显示购物车界面
                ShowShopingCart(<%=Request["ModelID"] %>);
    </script>
    </form>
</body>
</html>
