📄 myyigo.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace secondhand
{
/// <summary>
/// myyigo 的摘要说明。
/// </summary>
public class myyigo : System.Web.UI.Page
{
protected DateTime ss;
public static int whichButton;
protected System.Web.UI.WebControls.ImageButton ImageButton1;
protected System.Web.UI.WebControls.ImageButton ImageButton2;
protected System.Web.UI.WebControls.ImageButton ImageButton3;
protected System.Web.UI.WebControls.ImageButton ImageButton4;
protected System.Web.UI.WebControls.LinkButton LinkButton1;
protected System.Web.UI.WebControls.LinkButton LinkButton2;
protected System.Web.UI.WebControls.LinkButton LinkButton3;
protected System.Web.UI.WebControls.LinkButton LinkButton4;
protected System.Web.UI.WebControls.LinkButton LinkButton5;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.DataGrid DataGrid2;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.ImageButton ImageButton5;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
ss=DateTime.Today;
DataGrid1.Visible=true;
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
this.ImageButton2.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton2_Click);
this.ImageButton3.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton3_Click);
this.ImageButton4.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton4_Click);
this.ImageButton5.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton5_Click);
this.LinkButton1.Click += new System.EventHandler(this.LinkButton1_Click);
this.LinkButton2.Click += new System.EventHandler(this.LinkButton2_Click);
this.LinkButton3.Click += new System.EventHandler(this.LinkButton3_Click);
this.LinkButton4.Click += new System.EventHandler(this.LinkButton4_Click);
this.LinkButton5.Click += new System.EventHandler(this.LinkButton5_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
Server.Transfer("default.aspx");
}
private void ImageButton2_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
Server.Transfer("mybuy.aspx");
}
private void ImageButton3_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
if( Session["ID"]==null||Session["pwd"]==null)
Response.Write ("<script>alert(\"请先登陆!\");</script>");
else
Server.Transfer("myyigo.aspx");
}
private void ImageButton4_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
if( Session["ID"]==null||Session["pwd"]==null)
Response.Write ("<script>alert(\"请先登陆!\");</script>");
else
Server.Transfer("myyigo.aspx");
}
private void ImageButton5_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
if( Session["ID"]==null||Session["pwd"]==null)
Response.Write ("<script>alert(\"请先登陆!\");</script>");
else
Server.Transfer("myyigo.aspx");
}
private void LinkButton1_Click(object sender, System.EventArgs e)
{
whichButton=1;
//Panel1.Visible=true;
Label3.Visible=true;
//Panel2.Visible=false;
Label1.Text="已买到的商品信息: ";
string ec_Data =
"Server=(local);"+
"uid=sa;pwd=sa;"+
"database=ec";
SqlConnection conn = new SqlConnection(ec_Data);
conn.Open();
SqlDataAdapter da=new SqlDataAdapter(" SELECT Done.commodityID as '商品号',commdotyInfo.comName as '商品名',userInfo.userName as '卖家','拍卖' as '拍卖/一口价' ,[date] as '发布时间',expire_date as '结束时间' FROM Done,commdotyInfo,userInfo where userInfo.userID=Done.userID and deal_auction=0 and Done.userID="+Session["ID"]+" and commdotyInfo.commodityID=Done.commodityID UNION SELECT Done.commodityID as '商品号',commdotyInfo.comName as '商品名',userInfo.userName as '卖家','一口价' as '拍卖/一口价' ,[date] as '发布时间',expire_date as '结束时间' FROM Done,commdotyInfo,userInfo where userInfo.userID=Done.userID and deal_auction=1 and Done.userID="+Session["ID"]+" and commdotyInfo.commodityID=Done.commodityID ", conn );
DataSet ds=new DataSet();
da.Fill(ds);
DataGrid1.DataSource=ds;
DataGrid1.DataBind();
}
private void LinkButton2_Click(object sender, System.EventArgs e)
{
whichButton=2;
DataGrid1.CurrentPageIndex=0;
//Panel1.Visible=true;
//Panel2.Visible=false;
Label1.Visible=true;
Label1.Text="竞拍中的商品信息: ";
string ec_Data =
"Server=(local);"+
"uid=sa;pwd=sa;"+
"database=ec";
SqlConnection conn = new SqlConnection(ec_Data);
conn.Open();
SqlDataAdapter da=new SqlDataAdapter("SELECT auction.commodityID as '商品号',commdotyInfo.comName as '商品名',userInfo.userName as '卖家','拍卖' as '拍卖/一口价',[date] as '发布时间',expire_date as '结束时间' FROM userInfo,auction,commdotyInfo where userInfo.userID=commdotyInfo.userID and auction.commodityID=commdotyInfo.commodityID and deal_auction=0 and paticipant="+Session["ID"]+" and expire_date> '"+ss+"' ORDER BY [date] ", conn );
DataSet ds=new DataSet();
da.Fill(ds);
DataGrid1.DataSource=ds;
DataGrid1.DataBind();
}
private void LinkButton3_Click(object sender, System.EventArgs e)
{
whichButton=3;
DataGrid1.CurrentPageIndex=0;
//Panel1.Visible=true;
//Panel2.Visible=false;
Label1.Visible=true;
Label1.Text="竞拍结束的商品信息: ";
string ec_Data =
"Server=(local);"+
"uid=sa;pwd=sa;"+
"database=ec";
SqlConnection conn = new SqlConnection(ec_Data);
conn.Open();
DateTime ss=DateTime.Today;
SqlDataAdapter da=new SqlDataAdapter("SELECT auction.commodityID as '商品号',commdotyInfo.comName as '商品名',userInfo.userName as '卖家','拍卖' as '拍卖/一口价',[date] as '发布时间',expire_date as '结束时间' FROM userInfo,auction,commdotyInfo where userInfo.userID=commdotyInfo.userID and auction.commodityID=commdotyInfo.commodityID and deal_auction=0 and paticipant="+Session["ID"]+" and expire_date< '"+ss+"' ORDER BY [date] ", conn );
DataSet ds=new DataSet();
da.Fill(ds);
DataGrid1.DataSource=ds;
DataGrid1.DataBind();
}
private void LinkButton4_Click(object sender, System.EventArgs e)
{
whichButton=4;
DataGrid2.CurrentPageIndex=0;
//Panel1.Visible=false;
//Panel2.Visible=true;
Label2.Visible=true;
Label2.Text="已卖出的商品信息: ";
string ec_Data =
"Server=(local);"+
"uid=sa;pwd=sa;"+
"database=ec";
SqlConnection conn = new SqlConnection(ec_Data);
conn.Open();
DateTime ss=DateTime.Today;
SqlDataAdapter da=new SqlDataAdapter("SELECT commodityID as '商品号',comName as '商品名','拍卖' as '拍卖/一口价',[date] as '发布时间',expire_date as '结束时间' FROM commdotyInfo where userID="+Session["ID"]+" and Status=0 and deal_auction=0 and expire_date< '"+ss+"' UNION SELECT commodityID as '商品号',comName as '商品名','一口价' as '拍卖/一口价',[date] as '发布时间',expire_date as '结束时间' FROM commdotyInfo where userID="+Session["ID"]+" and Status=0 and deal_auction=1 and expire_date< '"+ss+"' ORDER BY [date]", conn );
DataSet ds=new DataSet();
da.Fill(ds);
DataGrid2.DataSource=ds;
DataGrid2.DataBind();
}
private void LinkButton5_Click(object sender, System.EventArgs e)
{
whichButton=5;
DataGrid2.CurrentPageIndex=0;
//Panel1.Visible=false;
//Panel2.Visible=true;
Label2.Visible=true;
Label2.Text="出售中的商品信息: ";
string ec_Data =
"Server=(local);"+
"uid=sa;pwd=sa;"+
"database=ec";
SqlConnection conn = new SqlConnection(ec_Data);
conn.Open();
DateTime ss=DateTime.Today;
SqlDataAdapter da=new SqlDataAdapter("SELECT commodityID as '商品号',comName as '商品名','拍卖' as '拍卖/一口价',[date] as '发布时间',expire_date as '结束时间' FROM commdotyInfo where userID="+Session["ID"]+" and Status=1 and deal_auction=0 and expire_date> '"+ss+"' UNION SELECT commodityID as '商品号',comName as '商品名','一口价' as '拍卖/一口价',[date] as '发布时间',expire_date as '结束时间' FROM commdotyInfo where userID="+Session["ID"]+" and Status=1 and deal_auction=1 and expire_date> '"+ss+"' ORDER BY [date]", conn );
DataSet ds=new DataSet();
da.Fill(ds);
DataGrid2.DataSource=ds;
DataGrid2.DataBind();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -