public int Update(Chain.Model.MicroWebsiteGoods model) { int result; if (this.Exists(model.MicroGoodsID, model.MicroGoodsCode, model.MicroGoodsShopID)) { result = -1; } else { result = this.dal.Update(model); } return(result); }
protected void GetGoodsInfo(int goodsID) { Chain.BLL.MicroWebsiteGoods bllGoods = new Chain.BLL.MicroWebsiteGoods(); Chain.Model.MicroWebsiteGoods modelGoods = bllGoods.GetModel(goodsID); this.txtGoodsID.Value = modelGoods.MicroGoodsID.ToString(); this.txtGoodsCode.Value = modelGoods.MicroGoodsCode; this.txtGoodsName.Value = modelGoods.MicroGoodsName; this.BindMicroGoodsClass(this.sltGoodsClass, 1); this.sltGoodsClass.Value = modelGoods.MicroGoodsClassID.ToString(); if (modelGoods.MicroPoint != -1) { this.txtGoodsPoint.Value = modelGoods.MicroPoint.ToString(); } else { this.txtGoodsPoint.Value = ""; } this.txtGoodsRemark.Value = modelGoods.MicroGoodsRemark; this.txtMicroPrice.Value = decimal.Parse(modelGoods.MicroPrice.ToString()).ToString("0.00"); this.txtGoodsBidPrice.Value = decimal.Parse(modelGoods.MicroGoodsBidPrice.ToString()).ToString("0.00"); this.txtMicroSalePrice.Value = decimal.Parse(modelGoods.MicroSalePrice.ToString()).ToString("0.00"); this.imgGoodsPhoto.Src = modelGoods.MicroGoodsPicture; this.txtUpdateGoodsName.Value = modelGoods.MicroGoodsPicture; }
public List <Chain.Model.MicroWebsiteGoods> DataTableToList(DataTable dt) { List <Chain.Model.MicroWebsiteGoods> modelList = new List <Chain.Model.MicroWebsiteGoods>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { for (int i = 0; i < rowsCount; i++) { Chain.Model.MicroWebsiteGoods model = new Chain.Model.MicroWebsiteGoods(); if (dt.Rows[i]["MicroGoodsID"] != null && dt.Rows[i]["MicroGoodsID"].ToString() != "") { model.MicroGoodsID = int.Parse(dt.Rows[i]["MicroGoodsID"].ToString()); } if (dt.Rows[i]["MicroGoodsCode"] != null && dt.Rows[i]["MicroGoodsCode"].ToString() != "") { model.MicroGoodsCode = dt.Rows[i]["MicroGoodsCode"].ToString(); } if (dt.Rows[i]["MicroGoodsClassID"] != null && dt.Rows[i]["MicroGoodsClassID"].ToString() != "") { model.MicroGoodsClassID = int.Parse(dt.Rows[i]["MicroGoodsClassID"].ToString()); } if (dt.Rows[i]["MicroGoodsName"] != null && dt.Rows[i]["MicroGoodsName"].ToString() != "") { model.MicroGoodsName = dt.Rows[i]["MicroGoodsName"].ToString(); } if (dt.Rows[i]["MicroSalePrice"] != null && dt.Rows[i]["MicroSalePrice"].ToString() != "") { model.MicroSalePrice = decimal.Parse(dt.Rows[i]["MicroSalePrice"].ToString()); } if (dt.Rows[i]["MicroPrice"] != null && dt.Rows[i]["MicroPrice"].ToString() != "") { model.MicroPrice = decimal.Parse(dt.Rows[i]["MicroPrice"].ToString()); } if (dt.Rows[i]["MicroPoint"] != null && dt.Rows[i]["MicroPoint"].ToString() != "") { model.MicroPoint = int.Parse(dt.Rows[i]["MicroPoint"].ToString()); } if (dt.Rows[i]["MicroGoodsBidPrice"] != null && dt.Rows[i]["MicroGoodsBidPrice"].ToString() != "") { model.MicroGoodsBidPrice = decimal.Parse(dt.Rows[i]["MicroGoodsBidPrice"].ToString()); } if (dt.Rows[i]["MicroGoodsRemark"] != null && dt.Rows[i]["MicroGoodsRemark"].ToString() != "") { model.MicroGoodsRemark = dt.Rows[i]["MicroGoodsRemark"].ToString(); } if (dt.Rows[i]["MicroGoodsPicture"] != null && dt.Rows[i]["MicroGoodsPicture"].ToString() != "") { model.MicroGoodsPicture = dt.Rows[i]["MicroGoodsPicture"].ToString(); } if (dt.Rows[i]["MicroGoodsCreateTime"] != null && dt.Rows[i]["MicroGoodsCreateTime"].ToString() != "") { model.MicroGoodsCreateTime = DateTime.Parse(dt.Rows[i]["MicroGoodsCreateTime"].ToString()); } if (dt.Rows[i]["MicroGoodsShopID"] != null && dt.Rows[i]["MicroGoodsShopID"].ToString() != "") { model.MicroGoodsShopID = int.Parse(dt.Rows[i]["MicroGoodsShopID"].ToString()); } modelList.Add(model); } } return(modelList); }