<%@ Page Language="C#"  Inherits="TopWinCMS.BLL.PageFactory.Pages.ShopIndex" EnableSessionState="false"
    EnableViewState="false" %>

<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Text.RegularExpressions" %>
<%@ Import Namespace="TopWinCMS.BLL" %>
<%@ Import Namespace="TopWinCMS.Model" %>
<%@ Import Namespace="TopWinCMS.Common" %>
<%@ Import Namespace="TopWinCMS.IDAL" %>
<%@ Import Namespace="TopWinCMS.DALFactory" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Src="Header.ascx" TagName="Header" TagPrefix="uc1" %>
<%@ Register Src="SearchBar.ascx" TagName="SearchBar" TagPrefix="uc2" %>
<%@ Register Src="Left.ascx" TagName="Left" TagPrefix="uc3" %>
 
<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/GetVote.js"></script>

</head>

<script runat="server">  
 
    SQLModel s_model = new SQLModel();
    private void Page_Load(object sender, System.EventArgs e)
    { 

        PageNavigation1.UrlPaging = true;

        
        PageNavigation1.UrlRewritePattern = "/ScorePresent-{0}.htm";

 
        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,PresentExp";
        s_model.TableName = "TopWinCMS_Shop";
        s_model.WHERE = " deleted=0 and pass=1 AND PresentExp<0";
        s_model.FieldKey = "ID"; 
        s_model.OrderField = "ID Desc";


        s_model.PageSize = PageNavigation1.PageSize;
        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();

        
    }
   
</script>

<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">
                            <uc2: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">
                            <uc3:Left ID="Left1" runat="server" />
                        </td>
                        <td valign="top">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          
                                <tr>
                                    <td height="5">
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <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><A href="/">园玉商城</A> &gt; 积分换购</STRONG></SPAN>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td height="5">
                                    </td>
                                </tr> 
                               
                                <tr>
                                    <td>
                                        <asp:DataList ID="DL_List" runat="server" HorizontalAlign="Center" RepeatColumns="3"
                                            RepeatDirection="Horizontal" ShowFooter="False" ShowHeader="False" CellSpacing="20"
                                            CellPadding="1" Width="98%">
                                            <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" onmouseout="ClearImg()" onmouseover="onmouseshow(event,document.documentElement,<%#Eval("ID") %>)" /></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><br />
                                                            <img src="images/Shop/icon2.gif" width="16" height="16" align="absmiddle" /><span class="black01">&nbsp;需要积分：<%# System.Math.Abs((int)Eval("PresentExp"))%></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)
                                            {
                                        %>
                                        没有商品数据
                                        <%
                            
                                            } %>
                                    </td>
                                </tr>
                            </table>
                            <br />
                            <div style="margin-left: auto; margin-right: auto; width: 90%">
                                <TopWinCMS:PageNavigation ID="PageNavigation1" runat="server" PageSize="15" HorizontalAlign="Center" EnableUrlRewriting="True">
                                </TopWinCMS:PageNavigation>
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <!--#include file="../Footer.aspx"-->
            </td>
        </tr>
    </table>

    <script language="javascript" type="text/javascript">
      //Ajax显示购物车界面
                ShowShopingCart(<%=Request["ModelID"] %>);
    </script>
    <div id="showLayers" style="display: none">
        <div id="ShowContentTitle">
            图标标题..</div>
        <img id="ShowContentImg" src="images/Shop/Ajax_Loading.gif" border="0" alt="读取中" />
        <div id="ShowConfig">
            配置信息：</div>
    </div>
    </form>
</body>
</html>
