<%@ Page language="c#" Codebehind="Price.aspx.cs" AutoEventWireup="false" Inherits="XpShop.WebUI.Price" %>
<%@ Register TagPrefix="uc1" TagName="Header" Src="Modules/Header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="LoginForm" Src="Modules/LoginForm.ascx" %>
<%@ Register TagPrefix="uc1" TagName="SmallCart" Src="Modules/SmallCart.ascx" %>
<%@ Register TagPrefix="uc1" TagName="LeftNavTop2Level" Src="Modules/LeftNavTop2Level.ascx" %>
<%@ Register TagPrefix="uc1" TagName="CommendProduct" Src="Modules/CommendProduct.ascx" %>
<%@ Register TagPrefix="uc1" TagName="SpecialProduct" Src="Modules/SpecialProduct.ascx" %>
<%@ Register TagPrefix="uc1" TagName="HotProduct" Src="Modules/HotProduct.ascx" %>
<%@ Register TagPrefix="uc1" TagName="NewProduct" Src="Modules/NewProduct.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Link" Src="Modules/Link.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Helper" Src="Modules/Helper.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Footer" Src="Modules/Footer.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<HEAD>		
		<!--#include file="../../inc/encoding.inc"-->
		<title><%=GetResourceString("PriceCenter")%>|<%=config.SiteTitle%></title>
		<!--#include file="../../inc/head.inc"-->		
	</HEAD>
	<body>
		<div id="container">
			<uc1:Header id="Header1" runat="server"></uc1:Header>
		    <!--位置导航开始-->
	        <div class="path"><a href="/<%=System.Configuration.ConfigurationSettings.AppSettings["ShopFolder"]%><%if(config.html==""){%>default.aspx<%}else{%>Index.<%=config.html%><%}%>"><%=GetResourceString("Home")%></a> > <%=GetResourceString("PriceCenter")%></div>
	        <!--位置导航结束-->
			<div id="content">
				<div id="content_left_side">
					<!--会员登录开始-->
					<uc1:LoginForm id="LoginForm1" runat="server"></uc1:LoginForm>
					<!--会员登录结束-->
				</div>
				<div id="content_middle_side">
					<!--商品列表开始-->
					<div class="mframe">
						<div class="tl"></div>
						<div class="tr"></div>
						<div class="tm"><div class="on"><%=GetResourceString("PriceCenter")%></div></div>
						<div class="ml"></div>
						<div class="mr"></div>
						<div class="mm">
						    <div id="productlist">
						        <div class="product">
						            <div id="category">
						                <%=GetResourceString("SeeCategoryPrice")%>：<a href='/<%=System.Configuration.ConfigurationSettings.AppSettings["ShopFolder"]%><%if(config.html==""){%>price.aspx<%}else{%>price.<%=config.html%><%}%>'>全部类别</a>
						                <%BindSubCatList();%>
									    <asp:DataList id="dlSubCatList" CellPadding="3" CellSpacing="0" RepeatLayout="Table" RepeatDirection="Horizontal" RepeatColumns="7" CssClass="tdbg" Style="MARGIN-LEFT:30px" runat="server">
										    <ItemStyle Width="100px" />
										    <ItemTemplate> <a href='/<%=System.Configuration.ConfigurationSettings.AppSettings["ShopFolder"]%>price.aspx?CatID=<%# DataBinder.Eval(Container.DataItem,"CategoryID")%>'><%#DataBinder.Eval(Container.DataItem,"Name")%> </a> </ItemTemplate>
									    </asp:DataList>
						            </div>
						            <div id="productprice">
				                        <asp:DataGrid ID="dgList" Runat="server" DataKeyField="ProductID" AutoGenerateColumns="False"
										    HeaderStyle-BackColor="Gainsboro" ItemStyle-BackColor="#ece9d8" BorderWidth="1" BorderColor="#ffffff" Width="100%">
										    <Columns>
											    <asp:BoundColumn DataField="Name" HeaderText="名称">
											    </asp:BoundColumn>
											    <asp:BoundColumn DataField="ProductNo" HeaderText="型号"></asp:BoundColumn>
											    <asp:BoundColumn DataField="ShortDesc" HeaderText="配置"></asp:BoundColumn>
											    <asp:TemplateColumn HeaderText="价格">
												    <ItemTemplate>
													    <%# GetPrice(DataBinder.Eval(Container.DataItem,"MemberPrice").ToString(),DataBinder.Eval(Container.DataItem,"ProductID").ToString())%>
												    </ItemTemplate>
											    </asp:TemplateColumn>
											    <asp:TemplateColumn HeaderText="备注">
												    <ItemTemplate>
													    <a href='/<%=System.Configuration.ConfigurationSettings.AppSettings["ShopFolder"]%><%if(config.html==""){%>Show.aspx?PID=<%#DataBinder.Eval(Container.DataItem,"ProductID")%><%}else{%>products/Product_<%#DataBinder.Eval(Container.DataItem,"ProductID")%>.<%=config.html%><%}%>' target="_self" >购买&详情</a>
												    </ItemTemplate>
											    </asp:TemplateColumn>
										    </Columns>
									    </asp:DataGrid>
						            </div>
						        </div>
						        <div class="page">
					             <!-- 翻页开始-->
                                <span>
                                    <asp:HyperLink ID="hplPrev" runat="server"></asp:HyperLink>[&nbsp;
                                    <asp:Label ID="lbPage" runat="server"></asp:Label>&nbsp;]
                                    <asp:HyperLink ID="hplNext" runat="server"></asp:HyperLink>
                                </span>
                                <span style="padding-left:20px;">
                                   <asp:Label ID="lblTotalPage" runat="server" visble="false"></asp:Label>
                                   <asp:Label ID="lblPagerInfo" runat="server"></asp:Label><b><asp:Label ID="lblCurrentPage"
                                        runat="server" visble="false"></asp:Label></b> &nbsp;<input id="gopage" type="text"
                                            name="gopage" class="inputbg" size="1" onkeyup="isNumber()"><input type="button"
                                                value="Go" class="go" onclick="return GoPage();">
                                </span>
				               <!-- 翻页结束-->
				                <script language="javascript">
					              function getParameter(psName)
                                  {
                                      var result="0";
                                      var url=self.location.toString();
                                      if(url.indexOf("?")>-1)
                                      {
                                          var str=url.split("?")[1];
                                          if(str.indexOf(psName)!=-1&&(("?"+str).substr(str.indexOf(psName)-1,1)=="?"||str.substr(str.indexOf(psName)-1,1)=="&"))
                                          {   
                                              if(str.substring(str.indexOf(psName),str.length).indexOf("&")!=-1)
                                              {   
                                                  var Test=str.substring(str.indexOf(psName),str.length);   
                                                  result=Test.substr(Test.indexOf(psName),Test.indexOf("&")-Test.indexOf(psName));   
                                              }   
                                              else
                                              {   
                                                result=str.substring(str.indexOf(psName),str.length);   
                                              }
                                              result=result.split("=")[1];
                                          }
                                      }
                                      return result;
                                    }
                                    //  alert(getParameter("keyword"));
    								
					                function GoPage() 
					                { 
						                if(trim(document.getElementById("gopage").value)!="" )
						                {
							                if(document.getElementById("gopage").value!="0")
							                {
                                                
								                if(document.getElementById("gopage").value><%=totalpage %>)
								                {
									                alert("<%=GetResourceString("Error1")%>");
									                document.getElementById("gopage").value="1";
									                return false;
								                }
								                else
								                {
                                       	            javascript:window.location.href="/<%=System.Configuration.ConfigurationSettings.AppSettings["ShopFolder"]%>Price.aspx?CatID=" + getParameter("CatID") + "&Page=" + document.getElementById("gopage").value;
									                document.getElementById("gopage").value="";
								                }
							                }
							                else
							                {  
								                alert("<%=GetResourceString("InputError")%>");
								                document.getElementById("gopage").value="";
							                }
						                }
						                else
						                {
							                alert("<%=GetResourceString("Entertojumptothepage")%>");
							                document.getElementById("gopage").value="";
						                }
                                        
						                return false;
					                }
					                function trim(str)
					                {
						                return str.replace(new RegExp("(^[\\s]*)|([\\s]*$)", "g"), "");	
					                }
					                function isNumber()
					                {
						                document.getElementById("gopage").value = document.getElementById("gopage").value.replace(/\D/g,"");
					                }

					                function addtocart(pid)
					                {
						                if('<%=config.ShopStop%>' == 'True')
						                {
							                temp=window.open('ShoppingCart.aspx?pid='+pid+'&ts='+Math.random(),'shopcat','width=700,height=650,scrollbars=yes');
							                temp.focus();
						                }
						                else
						                {
							                alert('<%=config.ShopStopWords%>');
							                return false;
						                }
					                }
                                </script>
						        </div>
						    </div> 
						</div>
					    <div class="bl"></div>
					    <div class="br"></div>
					    <div class="bm"></div>
					</div>
					<!--商品列表结束-->
				</div>
				<div style="clear:both;"></div>
			</div>
			<uc1:Helper id="Helper1" runat="server"></uc1:Helper>
			<uc1:Footer id="Footer1" runat="server"></uc1:Footer>
		</div>
	</body>
</HTML>
