📄 itemdetail.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 bid.Entity;
namespace bid
{
/// <summary>
/// ItemDetail 的摘要说明。
/// </summary>
public class ItemDetail : Pagebase
{
protected System.Web.UI.WebControls.Label lblItemDesc;
protected System.Web.UI.WebControls.Label lblOwner;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Web.UI.WebControls.Button btnBid;
protected System.Web.UI.WebControls.RangeValidator RangeValidator1;
protected System.Web.UI.WebControls.TextBox txtPrice;
protected System.Web.UI.WebControls.Label lblInfo;
protected System.Web.UI.WebControls.HyperLink HyperLink1;
protected System.Web.UI.WebControls.Label lblBasePrice;
private void Page_Load(object sender, System.EventArgs e)
{
if( !IsPostBack )
{
LoadInitData();
}
}
private void LoadInitData()
{
this.LoadItemInfo( this.GetId() );
if( base.CurrentUser != null)
{
this.btnBid.Enabled = true;
}
else
{
this.btnBid.Enabled = false;
this.btnBid.Text = "您尚未登录,不能出价!";
}
}
private int GetId()
{
try
{
return int.Parse( Request.QueryString["Id"].ToString() );
}
catch
{
return 0;
}
}
private void LoadItemInfo( int ItemId )
{
Item item = new Item( ItemId );
if( item.Id != 0 )
{
this.lblItemDesc.Text = item.ItemDesc;
this.lblBasePrice.Text = item.BasePrice.ToString();
this.lblOwner.Text = bid.Entity.User.GetUser( item.UserID ).Name;
this.LoadItemPriceList( ItemId );
}
}
private void LoadItemPriceList( int ItemId )
{
ItemPrice ip = new ItemPrice();
DataTable tblTemp = ip.GetItemPriceByItemId( ItemId );
this.DataGrid1.DataSource = tblTemp;
this.DataGrid1.DataBind();
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnBid.Click += new System.EventHandler(this.btnBid_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btnBid_Click(object sender, System.EventArgs e)
{
ItemPrice ip = new ItemPrice();
string Result = ip.bid( GetId(), base.CurrentUser.Id, Double.Parse( this.txtPrice.Text ));
if( Result == "1" )
{
this.lblInfo.Text = "出价成功!";
LoadInitData();
}
else
{
this.lblInfo.Text = Result;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -