念粁扮寂亟阻ゞ糞媾栃裂眉蚊尺更〃��心嗤乂涛嗔錬李戻工匯和旗鷹。徽除豚鴬人坩貧購噐眉蚊尺更議猟嫗載謹��遇拝亟誼脅載挫��侭參祥音彈姥瓜壅亟阻。音狛宸叱爺嗽嗤涛嗔藻冱皇潜��遇拝園殻嶄窟�嶢散留判郎亙糞庁�侭參珊頁畳協亟竃栖慌�躙�寄社。
枠酒勣初府匯和��宸倖庁翠頁匯倖斌瞳砿尖庁翠。殻會嶄糞�崛防牝卦停�誓、耶紗、俐個吉孔嬬。
Model�酊殖�斌瞳瞳兎糞悶窃��BrandInfo.cs��
using
System;
namespace JKL.eShop.Model
{
/**//// <summary>
/// 瞳兎圷方象
/// </summary>
[Serializable]
public class BrandInfo
{
/**//***************************************************
* 撹埀双燕
***************************************************/
//瞳兎Id
private int _Id;
//瞳兎兆各
private string _Name;
//電會園催
private int _Number;
//頁倦葎容呪瞳兎
private bool _IsVouch;
/**//***************************************************
* 奉來双燕
***************************************************/
/**//// <summary>
/// 瞳兎Id
/// </summary>
public int Id
{
get { return _Id; }
set { _Id = value; }
}
/**//// <summary>
/// 瞳兎兆各
/// </summary>
public string Name
{
get { return _Name; }
set { _Name = value; }
}
/**//// <summary>
/// 電會園催
/// </summary>
public int OrderNumber
{
get { return _Number; }
set { _Number = value; }
}
/**//// <summary>
/// 頁倦容呪瞳兎
/// </summary>
public bool IsVouch
{
get { return _IsVouch; }
set { _IsVouch = value; }
}
public string Vouch
{
get
{
if (_IsVouch)
{
return "容呪瞳兎";
}
else
{
return "噸宥瞳兎";
}
}
}
/**//***************************************************
* 更夛痕方
***************************************************/
public BrandInfo() { }
public BrandInfo(int id, string name)
{
_Id = id;
_Name = name;
}
public BrandInfo(int id, string name, int
orderNumber, bool isVouch)
{
_Id = id;
_Name = name;
_Number = orderNumber;
_IsVouch = isVouch;
}
}
} |
Model�酊殖�GoodSortInfo.cs
using
System;
using System.Collections.Generic;
using System.Text;
namespace JKL.eShop.Model
{
/**//// <summary>
/// 蛍窃糞悶窃
/// </summary>
[Serializable]
public class GoodSortInfo
{
/**//***************************************************
* 撹埀双燕
***************************************************/
//蛍窃Id
private int _Id;
//蛍窃兆各
private string _Name;
//雫艶
private int _Layer;
//貧雫蛍窃
private GoodSortInfo _ParentSort;
//和雫蛍窃方楚
private int _ChildNumber;
//姥廣
private string _Remark;
/**//***************************************************
* 奉來双燕
***************************************************/
/**//// <summary>
/// 蛍窃Id
/// </summary>
public int Id
{
get { return _Id; }
set { _Id = value; }
}
/**//// <summary>
/// 蛍窃兆各
/// </summary>
public string Name
{
get { return _Name; }
set { _Name = value; }
}
/**//// <summary>
/// 蛍窃吉雫
/// </summary>
public int Layer
{
get { return _Layer; }
set { _Layer = value; }
}
/**//// <summary>
/// 貧雫蛍窃
/// </summary>
public GoodSortInfo ParentSort
{
get { return _ParentSort; }
set { _ParentSort = value; }
}
/**//// <summary>
/// 貧雫蛍窃Id
/// </summary>
public int ParentId
{
get { return _ParentSort.Id; }
}
/**//// <summary>
/// 和雫蛍窃方楚
/// </summary>
public int ChildSortCount
{
get { return _ChildNumber; }
set { _ChildNumber = value; }
}
/**//// <summary>
/// 姥廣
/// </summary>
public string Remark
{
get { return _Remark; }
set { _Remark = value; }
}
/**//***************************************************
* 更夛痕方
***************************************************/
public GoodSortInfo() { }
public GoodSortInfo(int id)
{
_Id = id;
}
public GoodSortInfo(int id, string name)
{
_Id = id;
_Name = name;
}
public GoodSortInfo(int id, string name,
int depth, int childNumber)
{
_Id = id;
_Name = name;
_Layer = depth;
_ChildNumber = childNumber;
}
}
} |
Model�酊殖�GoodInfo.cs��
using
System;
using System.Collections;
using System.Collections.Generic;
namespace JKL.eShop.Model
{
/**//// <summary>
/// 斌瞳圷方象
/// </summary>
[Serializable]
public class GoodInfo
{
/**//***************************************************
* 撹埀双燕
***************************************************/
//斌瞳Id
private int _Id;
//斌瞳兆各
private string _Name;
//瞳兎
private BrandInfo _BrandInfo;
//蛍窃
private GoodSortInfo _SortInfo;
//斌瞳園鷹
private string _Code;
//訳侘鷹
private string _Barcode;
//汽了(倖/歳/期吉��
private string _Unit;
//号鯉
private string _Standard;
//酒初
private string _SimpleIntroduction;
//�袁庫誼�
private string _DetailIntroduction;
//夕頭揃抄
private string _PicturePath;
//窟下晩豚
private DateTime _PublicTime;
//厚仟晩豚
private DateTime _UpdateTime;
//偏魁勺
private decimal _MarketPrice;
//巣弁勺
private decimal _SellPrice;
//奘僕持蛍
private decimal _Score;
//箝誓肝方
private int _ClickCount;
//貧匯肝箝誓扮寂
private DateTime _ClickTime;
//斌瞳嶽窃
private string _KindName;
//垂贋方楚
private int _Stock;
//頁倦�塋�
private bool _Visable = false;
購囚忖粁旦訟#region 購囚忖粁旦訟
private static Hashtable _KindList;
private static Hashtable _PopList;
#endregion
/**//***************************************************
* 奉來双燕
***************************************************/
public int Id
{
get { return _Id; }
set { _Id = value; }
}
/**//// <summary>
/// 斌瞳園鷹
/// </summary>
public string Code
{
get { return _Code; }
set { _Code = value; }
}
/**//// <summary>
/// 訳侘鷹
/// </summary>
public string Barcode
{
get { return _Barcode; }
set { _Barcode = value; }
}
/**//// <summary>
/// 瞳兎
/// </summary>
public BrandInfo BrandInfo
{
get
{
if (_BrandInfo == null)
{
_BrandInfo = new BrandInfo();
}
return _BrandInfo;
}
set { _BrandInfo = value; }
}
/**//// <summary>
/// 瞳兎兆各
/// </summary>
public string BrandName
{
get { return this.BrandInfo.Name; }
set { this.BrandInfo.Name = value; }
}
/**//// <summary>
/// 斌瞳蛍窃
/// </summary>
public GoodSortInfo Sort
{
get { return _SortInfo; }
set { _SortInfo = value; }
}
/**//// <summary>
/// 斌瞳兆各
/// </summary>
public string Name
{
get { return _Name; }
set { _Name = value; }
}
/**//// <summary>
/// 汽了(倖/歳/期吉��
/// </summary>
public string Unit
{
get { return _Unit; }
set { _Unit = value; }
}
/**//// <summary>
/// 号鯉
/// </summary>
public string Standard
{
get { return _Standard; }
set { _Standard = value; }
}
/**//// <summary>
/// 酒初
/// </summary>
public string SimpleIntroduction
{
get { return _SimpleIntroduction; }
set { _SimpleIntroduction = value; }
}
/**//// <summary>
/// �袁庫誼�
/// </summary>
public string DetailIntroduction
{
get { return _DetailIntroduction; }
set { _DetailIntroduction = value; }
}
/**//// <summary>
/// 夕頭揃抄
/// </summary>
public string PicturePath
{
get { return _PicturePath; }
set { _PicturePath = value; }
}
/**//// <summary>
/// 窟下晩豚
/// </summary>
public DateTime PublicTime
{
get { return _PublicTime; }
set { _PublicTime = value; }
}
/**//// <summary>
/// 厚仟晩豚
/// </summary>
public DateTime UpdateTime
{
get { return _UpdateTime; }
set { _UpdateTime = value; }
}
/**//// <summary>
/// 偏魁勺
/// </summary>
public decimal MarketPrice
{
get { return _MarketPrice; }
set { _MarketPrice = value; }
}
/**//// <summary>
/// 巣弁勺
/// </summary>
public decimal SellPrice
{
get { return _SellPrice; }
set { _SellPrice = value; }
}
/**//// <summary>
/// 奘僕持蛍
/// </summary>
public decimal Score
{
get { return _Score; }
set { _Score = value; }
}
/**//// <summary>
/// 箝誓肝方
/// </summary>
public int ClickCount
{
get { return _ClickCount; }
set { _ClickCount = value; }
}
/**//// <summary>
/// 貧肝箝誓扮寂
/// </summary>
public DateTime ClickTime
{
get { return _ClickTime; }
set { _ClickTime = value; }
}
public string KindName
{
get { return _KindName; }
set { _KindName = value; }
}
/**//// <summary>
/// 垂贋方楚
/// </summary>
public int Stock
{
get { return _Stock; }
set { _Stock = value; }
}
/**//// <summary>
/// 頁倦�塋�
/// </summary>
public bool Visable
{
get { return _Visable; }
set { _Visable = value; }
}
/**//***************************************************
* 更夛痕方
***************************************************/
public GoodInfo() { }
public GoodInfo(int id, string code, string
name, string picturePath, decimal marketPrice, decimal
sellPrice, string unit, string standard, int stock)
{
_Id = id;
_Code = code;
_Name = name;
_PicturePath = picturePath;
_MarketPrice = marketPrice;
_SellPrice = sellPrice;
_Unit = unit;
_Standard = standard;
_Stock = stock;
}
public GoodInfo(int id, string code, string
name, string picturePath, string brandName, string
kindName, string standard, string simpleIntroduction,
DateTime publicTime, decimal marketPrice, decimal
sellPrice, string unit, decimal score, int clickNumber)
{
_Id = id;
_Code = code;
_Name = name;
_PicturePath = picturePath;
this.BrandName = brandName;
_KindName = kindName;
_Standard = standard;
_SimpleIntroduction = simpleIntroduction;
_PublicTime = publicTime;
_MarketPrice = marketPrice ;
_SellPrice = sellPrice;
_Unit = unit;
_Score = score;
_ClickCount = clickNumber;
_Stock = Stock;
}
public GoodInfo(int id, string code, string
name, string picturePath, string brandName, string
kindName, string standard, string simpleIntroduction,
string detailIntroduction, decimal marketPrice,
decimal sellPrice, string unit, decimal score, int
clickNumber, DateTime publicTime, int stock)
{
_Id = id;
_Code = code;
_Name = name;
_PicturePath = picturePath;
this.BrandName = brandName;
_KindName = kindName;
_Standard = standard;
_SimpleIntroduction = simpleIntroduction;
_DetailIntroduction = detailIntroduction;
_MarketPrice = marketPrice;
_SellPrice = sellPrice;
_Unit = unit;
_Score = score;
_ClickCount = clickNumber;
_PublicTime = publicTime;
_Stock = stock;
}
}
}
SimpleIntroduction, DetailIntroduction, MarketPrice,
SellPrice, PublicTime, UpdateTime, ClickCount, ClickTime,
Stock) VALUES (" + good.Sort.Id + ", '"
+ good.Name + "', " + good.BrandInfo.Id
+ ", '" + good.Code + "', '"
+ good.Barcode + "', '" + good.Unit +
"', '" + good.Standard + "', '"
+ good.PicturePath + "', '" + good.SimpleIntroduction
+ "', '" + good.DetailIntroduction + "',
" + good.MarketPrice + ", " + good.SellPrice
+ ", '" + good.PublicTime + "', '"
+ good.UpdateTime + "', " + good.ClickCount
+ ", '" + good.ClickTime + "', "
+ good.Stock + ")";
cmd.ExecuteNonQuery();
return true;
}
}
} |
BLL�酊殖�GoodBLL.cs
BLL
using System;
using System.Collections.Generic;
using JKL.eShop.DAL;
using JKL.eShop.Model;
namespace JKL.eShop.BLL
{
/**//// <summary>
///
/// </summary>
public class GoodBLL
{
/**//* **************************************************
* 撹埀双燕
* *************************************************/
private GoodDAL _GoodDal
= null;
/**//* **************************************************
* 奉來双燕
* *************************************************/
private GoodDAL GoodDal
{
get
{
if (_GoodDal == null)
{
_GoodDal = new GoodDAL();
}
return _GoodDal;
}
}
/**//* **************************************************
* 巷慌圭隈
* *************************************************/
/**//// <summary>
/// 厚仟斌瞳佚連
/// </summary>
/// <param name="goodInfo"></param>
/// <returns></returns>
public bool ChangeGood(GoodInfo goodInfo)
{
return false;
}
/**//// <summary>
/// 斌瞳延勺
/// </summary>
/// <param name="goodinfo"></param>
/// <returns></returns>
public bool ChangePrice(GoodInfo goodinfo)
{
return this.GoodDal.UpdateGoodsPrice(goodinfo);
}
/**//// <summary>
/// 功象ID卦指斌瞳議�袁湖渡�
/// </summary>
/// <param name="goodId"></param>
/// <returns></returns>
public GoodInfo GetGood(int goodId)
{
GoodInfo good = this.GoodDal.SelectGood(goodId);
good.ClickCount++;
this.GoodDal.UpdateGood(good);
return good;
}
卦指斌瞳佚連双燕#region 卦指斌瞳佚連双燕
/**//// <summary>
/// 卦指侭嗤斌瞳議双燕
/// </summary>
/// <returns></returns>
public IList<GoodInfo> GetGoodsList()
{
return this.GoodDal.SelectGoods();
}
/**//// <summary>
/// 卦指峺協蛍窃議侭奉斌瞳双燕
/// </summary>
/// <param name="sortId">蛍窃Id</param>
/// <returns></returns>
public IList<GoodInfo> GetGoodsListBySort(int
sortId)
{
return this.GoodDal.SelectGoodsBySort(sortId);
}
/**//// <summary>
/// 功象犯壇殻業議窃侏卦指斌瞳双燕
/// </summary>
/// <param name="sortId"></param>
/// <returns></returns>
public IList<GoodInfo> GetGoodsListByPop(string
popKind)
{
return this.GoodDal.SelectGoodsListByPop(1000,
popKind);
}
/**//// <summary>
/// 卦指峺協瞳兎議侭奉斌瞳双燕
/// </summary>
/// <param name="brandName"></param>
/// <returns></returns>
public IList<GoodInfo> GetGoodsListByBrand(string
brandName)
{
GoodDAL goodDal = new GoodDAL();
return goodDal.SelectGoodsListByBrand(brandName);
}
public IList<GoodInfo>
GetGoodsBrief()
{
return this.GoodDal.SelectGoodsBrief();
}
/**//// <summary>
///
/// </summary>
/// <param name="topNumber"></param>
/// <param name="kindName"></param>
/// <returns></returns>
public IList<GoodInfo> GetGoodsBriefByKind(int
topNumber, string kindName)
{
return this.GoodDal.SelectGoodsBriefByKind(topNumber,
kindName);
}
public IList<GoodInfo>
GetGoodsListByKind(string kindName)
{
return this.GoodDal.SelectGoodsListByKind(kindName);
}
#endregion
斌瞳臥儂何蛍#region 斌瞳臥儂何蛍
public IList<GoodInfo>
QueryGoodsList(string keyword)
{
GoodDAL goodDal = new GoodDAL();
return goodDal.SelectGoodsListByKeyword(keyword);
}
#endregion
}
} |
DAL�酊殖�GoodDAL.cs
using
System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using KoalaStudio.Data.SqlServer;
using JKL.eShop.Model;
namespace JKL.eShop.DAL
{
/**//// <summary>
///
/// </summary>
public class GoodDAL
{
/**//* **************************************************
* 撹埀双燕
* **************************************************/
/**//* **************************************************
* 奉來双燕
* **************************************************/
/**//* **************************************************
* 更夛痕方
* **************************************************/
public GoodDAL()
{ }
/**//* **************************************************
* 暴嗤才鞭隠擦圭隈
* **************************************************/
/**//// <summary>
///
/// </summary>
/// <param name="sqlText"></param>
/// <returns></returns>
private IList<GoodInfo> SelectGoodsBrief(string
sqlText)
{
CmdCommand cmd = new CmdCommand();
cmd.CommandText = sqlText;
SqlDataReader dr = cmd.ExecuteReader();
IList<GoodInfo> goods = new List<GoodInfo>();
SortDAL sortDal = new SortDAL();
if (dr.HasRows)
{
while (dr.Read())
{
GoodInfo good = new GoodInfo();
good.Id = Convert.ToInt32(dr["Id"]);
;
good.Code = dr["dianneima"].ToString();
good.Name = dr["Name"].ToString();
string picturePath = dr["Picture"].ToString();
good.PicturePath = picturePath.Substring(0,
picturePath.IndexOf("|||"));
good.MarketPrice = Convert.ToDecimal(dr["MarketPrice"]);
;
good.SellPrice = Convert.ToDecimal(dr["MemberPrice"]);
good.Unit = dr["DanWei"].ToString();
good.Standard = dr["GuiGe"].ToString();
goods.Add(good);
}
dr.Close();
cmd.Disconnection();
}
return goods;
}
/**//// <summary>
///
/// </summary>
/// <param name="sqlText"></param>
/// <returns></returns>
private IList<GoodInfo> SelectGoodsList(string
sqlText)
{
CmdCommand cmd = new CmdCommand();
cmd.CommandText = sqlText;
SqlDataReader dr = cmd.ExecuteReader();
IList<GoodInfo> goods = new List<GoodInfo>();
SortDAL sortDal = new SortDAL();
if (dr.HasRows)
{
while (dr.Read())
{
GoodInfo good = new GoodInfo();
good.Id = Convert.ToInt32(dr["Id"]);
good.Name = dr["Name"].ToString();
good.BrandInfo.Name = dr["Brand"].ToString();
good.Code = dr["dianneima"].ToString();
string picturePath = dr["Picture"].ToString();
good.PicturePath = picturePath.Substring(0,
picturePath.IndexOf("|||"));
good.KindName = dr["Kind"].ToString();
good.Standard = dr["GuiGe"].ToString();
good.SimpleIntroduction = dr["Introduce"].ToString();
good.PublicTime = Convert.ToDateTime(dr["JoinDate"]);
good.MarketPrice = Convert.ToDecimal(dr["MarketPrice"]);
;
good.SellPrice = Convert.ToDecimal(dr["MemberPrice"]);
good.Unit = dr["DanWei"].ToString();
good.Score = Convert.ToDecimal(dr["Score"]);
good.ClickCount = Convert.ToInt32(dr["TotalHits"]);
goods.Add(good);
}
dr.Close();
cmd.Disconnection();
}
return goods;
}
/**//* **************************************************
* 巷慌圭隈
* **************************************************/
/**//// <summary>
/// 厚仟斌瞳議勺鯉才垂贋佚連
/// </summary>
/// <returns></returns>
public bool UpdateGoodsPrice(GoodInfo goodInfo)
{
CmdCommand cmd = new CmdCommand();
cmd.CommandText = "UPDATE SW_Product
SET MarketPrice = " + goodInfo.MarketPrice
+ ", MemberPrice = " + goodInfo.SellPrice
+ ", Stock = " + goodInfo.Stock + ",
ModiDate = '" + DateTime.Now + "' WHERE
Id = " + goodInfo.Id;
cmd.ExecuteNonQuery();
return true;
}
/**//// <summary>
/// 厚仟斌瞳佚連
/// 輝念叙屶隔厚仟泣似楕匯��
/// </summary>
/// <param name="good"></param>
/// <returns></returns>
public bool UpdateGood(GoodInfo good)
{
CmdCommand cmd = new CmdCommand();
cmd.CommandText = "UPDATE eShop_Goods
SET ClickCount = " + good.ClickCount + "
WHERE GoodId = " + good.Id;
cmd.ExecuteNonQuery();
return true;
}
/**//// <summary>
/// 卦指侭嗤斌瞳双燕
/// </summary>
/// <returns></returns>
public IList<GoodInfo> SelectGoods()
{
string sqlText = "SELECT * FROM
eShop_Goods";
return this.SelectGoodsList(sqlText);
}
/**//// <summary>
/// 卦指峺協蛍窃議侭奉斌瞳双燕
/// </summary>
/// <param name="sortId"></param>
/// <returns></returns>
public IList<GoodInfo> SelectGoodsBySort(int
sortId)
{
string sqlText = "SELECT * FROM
SW_Product WHERE Hide = 0 AND ClassId IN (SELECT
ClassId FROM SW_Class WHERE Parentstr LIKE '%"
+ sortId + "%' OR ClassId = " + sortId
+ ")";
return this.SelectGoodsList(sqlText);
}
/**//// <summary>
/// 卦指峺協電佩窃侏議侭奉斌瞳双燕
/// </summary>
/// <param name="topNumber"></param>
/// <param name="popName"></param>
/// <returns></returns>
public IList<GoodInfo> SelectGoodsByPop(int
topNumber, string popName)
{
string sqlText = "SELECT TOP "
+ topNumber + " Id, dianneima, Name, Picture,
Brand, GuiGe, CASE Kind WHEN 0 THEN '恷仟貧尺' WHEN
1 THEN '容呪斌瞳' WHEN 2 THEN '蒙勺斌瞳' END AS Kind, Introduce,
JoinDate, MarketPrice, MemberPrice, DanWei, Score,
TotalHits, Stock FROM SW_Product WHERE Hide = 0
ORDER BY " + GoodInfo.PopList[popName].ToString()
+ " DESC";
return this.SelectGoodsList(sqlText);
}
/**//// <summary>
/// 卦指峺協瞳兎議侭奉斌瞳双燕
/// </summary>
/// <param name="brandName"></param>
/// <returns></returns>
public IList<GoodInfo> SelectGoodsByBrand(string
brandName)
{
string sqlText = "SELECT * FROM
SW_Product WHERE Hide = 0 AND Brand = '" +
brandName + "'";
return this.SelectGoodsList(sqlText);
}
/**//// <summary>
/// 卦指侭嗤斌瞳双燕��梓酒勣傍苧卦指
/// </summary>
/// <returns></returns>
public IList<GoodInfo> SelectGoodsBrief()
{
string sqlText = "SELECT Id, dianneima,
Name, Picture, MarketPrice, MemberPrice, DanWei,
GuiGe, Stock FROM SW_Product";
return this.SelectGoodsBrief(sqlText);
}
/**//// <summary>
/// 卦指峺協蛍曝議侭奉斌瞳双燕��梓酒勣傍苧卦指
/// </summary>
/// <returns></returns>
public IList<GoodInfo> SelectGoodsBriefByKind(int
topNumber, string kindName)
{
string sqlText = "SELECT TOP "
+ topNumber + " Id, dianneima, Name, Picture,
MarketPrice, MemberPrice, DanWei, GuiGe, Stock FROM
SW_Product WHERE Hide = 0 AND Kind = " + GoodInfo.KindList[kindName].ToString()
+ " ORDER BY JoinDate DESC";
return this.SelectGoodsBrief(sqlText);
}
/**//// <summary>
/// 卦指峺協蛍曝議侭奉斌瞳双燕
/// </summary>
/// <param name="kindName"></param>
/// <returns></returns>
public IList<GoodInfo> SelectGoodsListByKind(string
kindName)
{
string sqlText = "SELECT Id, dianneima,
Name, Picture, Brand, GuiGe, CASE Kind WHEN 0 THEN
'恷仟貧尺' WHEN 1 THEN '容呪斌瞳' WHEN 2 THEN '蒙勺斌瞳' END
AS Kind, Introduce, JoinDate, MarketPrice, MemberPrice,
DanWei, Score, TotalHits, Stock FROM SW_Product
WHERE Hide = 0 AND (Kind = " + GoodInfo.KindList[kindName].ToString()
+ ") ORDER BY JoinDate DESC";
return this.SelectGoodsList(sqlText);
}
/**//// <summary>
/// 卦指斌瞳議�袁湖渡�
/// </summary>
/// <param name="goodId"></param>
/// <returns></returns>
public GoodInfo SelectGood(int goodId)
{
CmdCommand cmd = new CmdCommand();
cmd.CommandText = "SELECT TOP 1
Id, dianneima, Name, Picture, Brand, GuiGe, CASE
Kind WHEN 0 THEN '恷仟貧尺' WHEN 1 THEN '容呪斌瞳' WHEN
2 THEN '蒙勺斌瞳' END AS Kind, Introduce, JoinDate,
Detail, MarketPrice, MemberPrice, DanWei, Score,
TotalHits, Stock FROM SW_Product WHERE Hide = 0
AND Id = " + goodId;
SqlDataReader dr = cmd.ExecuteReader();
GoodInfo good;
if (dr.HasRows)
{
dr.Read();
string picturePath = dr["Picture"].ToString();
picturePath = picturePath.Substring(0,
picturePath.IndexOf("|||"));
good = new GoodInfo(Convert.ToInt32(dr["Id"]),
dr["dianneima"].ToString(), dr["Name"].ToString(),
picturePath, dr["Brand"].ToString(), dr["Kind"].ToString(),
dr["GuiGe"].ToString(), dr["Introduce"].ToString(),
dr["Detail"].ToString(), Convert.ToDecimal(dr["MarketPrice"]),
Convert.ToDecimal(dr["MemberPrice"]),
dr["DanWei"].ToString(), Convert.ToDecimal(dr["Score"]),
Convert.ToInt32(dr["TotalHits"]), Convert.ToDateTime(dr["JoinDate"]),
Convert.ToInt32(dr["Stock"]));
dr.Close();
cmd.Disconnection();
}
else
{
good = new GoodInfo();
}
return good;
}
/**//// <summary>
/// 功象購囚忖卦指斌瞳双燕
/// </summary>
/// <param name="queryString"></param>
/// <returns></returns>
public IList<GoodInfo> SelectGoodsListByKeyword(string
keyword)
{
string sqlText = "SELECT Id, dianneima,
Name, Picture, Brand, GuiGe, CASE Kind WHEN 0 THEN
'恷仟貧尺' WHEN 1 THEN '容呪斌瞳' WHEN 2 THEN '蒙勺斌瞳' END
AS Kind, Introduce, JoinDate, MarketPrice, MemberPrice,
DanWei, Score, TotalHits, Stock FROM SW_Product
WHERE Hide = 0 AND Name like '%" + keyword
+ "%'";
return this.SelectGoodsList(sqlText);
}
/**//// <summary>
/// 仟奐斌瞳
/// </summary>
/// <param name="good"></param>
/// <returns></returns>
public bool InsertGood(GoodInfo good)
{
CmdCommand cmd = new CmdCommand();
cmd.CommandText = "INSERT INTO
eShop_Goods (SortId, [Name], BrandId, Code, Barcode,
Unit, [Standard], PicturePath, |
|