📄 giohang.cs.exclude
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
/// <summary>
/// Summary description for GioHang
/// </summary>
public class GioHang
{
//ArrayList cart = new ArrayList(LapTop a[]);
System.Collections.Generic.List<LapTop> cart = new System.Collections.Generic.List<LapTop>();
LapTop lap = new LapTop();
public System.Collections.Generic.List<LapTop> Cart
{
get { return cart; }
}
public GioHang()
{
}
public void AddLapTop(LapTop a)
{
this.cart.Add(a);
}
public int Count()
{
return this.cart.Count;
}
public DataTable ToDatatable()
{
DataTable dt=new DataTable();
DataRow row;
dt.Columns.Add(new DataColumn("id_sp"));
dt.Columns.Add(new DataColumn("ten_sp"));
dt.Columns.Add(new DataColumn("gia"));
dt.Columns.Add(new DataColumn("sl"));
for (int i = 0; i < cart.Count; i++)
{
row = dt.NewRow();
row[0] = cart[i].ID_SP;
row[1]= cart[i].TEN_SP;
row[2]= cart[i].GIA;
row[3] = cart[i].SL;
dt.Rows.Add(row);
}
return dt;
}
}
public class LapTop
{
string id_sp;
string ten_sp;
string gia;
int sl=1;
public string ID_SP
{
get { return id_sp; }
set { id_sp = value; }
}
public int SL
{
get { return sl; }
set { sl = value; }
}
public string TEN_SP
{
get { return ten_sp; }
set { ten_sp = value; }
}
public string GIA
{
get { return gia; }
set { gia = value; }
}
public LapTop()
{
this.ID_SP = id_sp;
this.TEN_SP = id_sp;
this.GIA = gia;
this.SL = sl;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -