📄 productmore.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using BLL;
using Socut.Data;
namespace Websystem
{
/// <summary>
/// productmore 的摘要说明。
/// </summary>
public class productmore : System.Web.UI.Page
{
protected CData myData=new CData();
protected DataSet ds=new DataSet();
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.Label Label5;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.Label Label6;
public string PICPATH="";
private void Page_Load(object sender, System.EventArgs e)
{
string user_IP="";
if(Request.ServerVariables["HTTP_VIA"]!=null)
{
user_IP=Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}
else
{
user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString();
}
string [] u_ip=user_IP.Split(new char[]{'.'});
bool look=false;
int i=1;
string sql = "select * from IpLock order by id desc";
ds = myData.GetDataSet(sql, 0, 0, "ip");
if(ds.Tables[0].Rows.Count>0)
foreach(DataRow dr in ds.Tables[0].Rows)
{
for(int j=1;j<=Convert.ToInt32(dr["ipsame"]);j++)
{
if(Convert.ToInt32(u_ip[j])==Convert.ToInt32(dr["ip"+i.ToString()]))
i++;
}
if(Convert.ToInt32(dr["ipsame"])==i)
{
look=true;//当条件成立表示IP类似,跳出循环,锁定IP,表示国内不可见
break;
}
}
int id=Convert.ToInt32(Request.QueryString["id"].ToString().Trim());
sql="update BU_MERCHANDISE set BROWSEDEGREE=BROWSEDEGREE+1 where id="+id;
myData.GetExecuteNonQuery(sql);
load_new(look);
load_hot(look);
load_pic(id);
}
//加载最新产品
private void load_new(bool look)
{
string str="<table width=100% border=0 cellspacing=0 cellpadding=0>";
string sql="";
if(look)
sql = "SELECT id,MERCHANDISE FROM BU_MERCHANDISE where ISOPEN=0 ORDER BY ID desc";
else
sql = "SELECT id,MERCHANDISE FROM BU_MERCHANDISE ORDER BY ID desc";
ds=myData.GetDataSet(sql,0,5,"cc");
if(ds.Tables[0].Rows.Count>0)
foreach(DataRow dr in ds.Tables[0].Rows)
{
str+="<tr><td height=23 bgcolor=#D3D3D3 align=left class=wenzi1> :: <span class=linkc><a href=productmore.aspx?id="+dr[0].ToString()+">>"+dr[1].ToString()+"</a></span></td> </tr><tr><td height=1></td></tr>";
}
str+="</table>";
this.Label2.Text=str;
}
//加载最热产品
private void load_hot(bool look)
{
string str="<table width=100% border=0 cellspacing=0 cellpadding=0>";
string sql="";
if(look)
sql = "SELECT id,MERCHANDISE FROM BU_MERCHANDISE where ISOPEN=0 ORDER BY BROWSEDEGREE desc";
else
sql = "SELECT id,MERCHANDISE FROM BU_MERCHANDISE ORDER BY BROWSEDEGREE desc";
ds=myData.GetDataSet(sql,0,6,"cc");
if(ds.Tables[0].Rows.Count>0)
foreach(DataRow dr in ds.Tables[0].Rows)
{
str+="<tr><td height=23 bgcolor=#D3D3D3 align=left class=wenzi1> :: <span class=linkc><a href=productmore.aspx?id="+dr[0].ToString()+">>"+dr[1].ToString()+"</a></span></td> </tr><tr><td height=1></td></tr>";
}
str+="</table>";
this.Label3.Text=str;
}
//加载产品图片
private void load_pic(int id)
{
string sql="select MERCHANDISEPIC.PICPATH,MERCHANDISEPIC.ISSMALL,BU_MERCHANDISE.MERCHANDISE,BU_MERCHANDISE.MODEL,BU_MERCHANDISE.BEWRITE from BU_MERCHANDISE,MERCHANDISEPIC where BU_MERCHANDISE.id=MERCHANDISEPIC.MERCHANDISEID and BU_MERCHANDISE.id="+id+" order by MERCHANDISEPIC.id desc";
ds=myData.GetDataSet(sql,0,4,"ds");
if(ds.Tables[0].Rows.Count>0)
{this.Label1.Text="<table width=100% border=1 cellpadding=0 cellspacing=0 bordercolor=#efefef style=BORDER-COLLAPSE:collapse><tr>";
foreach(DataRow dr in ds.Tables[0].Rows)
{
this.Label1.Text+="<td align=center valign=middle><a href="+dr[0].ToString()+" target=_blank><img border=\"0\" src="+dr[1].ToString()+" onmouseover=\"Image_look('"+dr[0].ToString()+"')\"></a></td>";
}
this.Label1.Text+="</tr></table>";
PICPATH=ds.Tables[0].Rows[0][0].ToString();
this.Label5.Text=ds.Tables[0].Rows[0][2].ToString();
this.Label4.Text=ds.Tables[0].Rows[0][2].ToString();
this.Label6.Text=ds.Tables[0].Rows[0][3].ToString();
this.TextBox2.Text=ds.Tables[0].Rows[0][4].ToString();
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -