/// <summary> /// ��������б� /// </summary> public List<NoName.NetShop.Model.ProductModel> GetModelList(string strWhere) { DataSet ds = dal.GetList(strWhere); List<NoName.NetShop.Model.ProductModel> modelList = new List<NoName.NetShop.Model.ProductModel>(); int rowsCount = ds.Tables[0].Rows.Count; if (rowsCount > 0) { NoName.NetShop.Model.ProductModel model; for (int n = 0; n < rowsCount; n++) { model = new NoName.NetShop.Model.ProductModel(); if(ds.Tables[0].Rows[n]["ProductId"].ToString()!="") { model.ProductId=int.Parse(ds.Tables[0].Rows[n]["ProductId"].ToString()); } model.ProductName=ds.Tables[0].Rows[n]["ProductName"].ToString(); model.ProductCode=ds.Tables[0].Rows[n]["ProductCode"].ToString(); model.CatePath=ds.Tables[0].Rows[n]["CatePath"].ToString(); if(ds.Tables[0].Rows[n]["CateId"].ToString()!="") { model.CateId=int.Parse(ds.Tables[0].Rows[n]["CateId"].ToString()); } if(ds.Tables[0].Rows[n]["TradePrice"].ToString()!="") { model.TradePrice=decimal.Parse(ds.Tables[0].Rows[n]["TradePrice"].ToString()); } if(ds.Tables[0].Rows[n]["MerchantPrice"].ToString()!="") { model.MerchantPrice=decimal.Parse(ds.Tables[0].Rows[n]["MerchantPrice"].ToString()); } if(ds.Tables[0].Rows[n]["ReducePrice"].ToString()!="") { model.ReducePrice=decimal.Parse(ds.Tables[0].Rows[n]["ReducePrice"].ToString()); } if(ds.Tables[0].Rows[n]["Stock"].ToString()!="") { model.Stock=int.Parse(ds.Tables[0].Rows[n]["Stock"].ToString()); } model.SmallImage=ds.Tables[0].Rows[n]["SmallImage"].ToString(); model.MediumImage=ds.Tables[0].Rows[n]["MediumImage"].ToString(); model.LargeImage=ds.Tables[0].Rows[n]["LargeImage"].ToString(); model.Keywords=ds.Tables[0].Rows[n]["Keywords"].ToString(); model.Brief=ds.Tables[0].Rows[n]["Brief"].ToString(); if(ds.Tables[0].Rows[n]["PageView"].ToString()!="") { model.PageView=int.Parse(ds.Tables[0].Rows[n]["PageView"].ToString()); } if(ds.Tables[0].Rows[n]["InsertTime"].ToString()!="") { model.InsertTime=DateTime.Parse(ds.Tables[0].Rows[n]["InsertTime"].ToString()); } if(ds.Tables[0].Rows[n]["ChangeTime"].ToString()!="") { model.ChangeTime=DateTime.Parse(ds.Tables[0].Rows[n]["ChangeTime"].ToString()); } if(ds.Tables[0].Rows[n]["Status"].ToString()!="") { model.Status=int.Parse(ds.Tables[0].Rows[n]["Status"].ToString()); } if(ds.Tables[0].Rows[n]["SortValue"].ToString()!="") { model.SortValue=int.Parse(ds.Tables[0].Rows[n]["SortValue"].ToString()); } if(ds.Tables[0].Rows[n]["Score"].ToString()!="") { model.Score=int.Parse(ds.Tables[0].Rows[n]["Score"].ToString()); } modelList.Add(model); } } return modelList; }
/// <summary> /// 增加一条数据 /// </summary> public void Add(NoName.NetShop.Model.ProductModel model) { dal.Add(model); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(NoName.NetShop.Model.ProductModel model) { dal.Update(model); }
/// <summary> /// 获得数据列表 /// </summary> public List <NoName.NetShop.Model.ProductModel> GetModelList(string strWhere) { DataSet ds = dal.GetList(strWhere); List <NoName.NetShop.Model.ProductModel> modelList = new List <NoName.NetShop.Model.ProductModel>(); int rowsCount = ds.Tables[0].Rows.Count; if (rowsCount > 0) { NoName.NetShop.Model.ProductModel model; for (int n = 0; n < rowsCount; n++) { model = new NoName.NetShop.Model.ProductModel(); if (ds.Tables[0].Rows[n]["ProductId"].ToString() != "") { model.ProductId = int.Parse(ds.Tables[0].Rows[n]["ProductId"].ToString()); } model.ProductName = ds.Tables[0].Rows[n]["ProductName"].ToString(); model.ProductCode = ds.Tables[0].Rows[n]["ProductCode"].ToString(); model.CatePath = ds.Tables[0].Rows[n]["CatePath"].ToString(); if (ds.Tables[0].Rows[n]["CateId"].ToString() != "") { model.CateId = int.Parse(ds.Tables[0].Rows[n]["CateId"].ToString()); } if (ds.Tables[0].Rows[n]["TradePrice"].ToString() != "") { model.TradePrice = decimal.Parse(ds.Tables[0].Rows[n]["TradePrice"].ToString()); } if (ds.Tables[0].Rows[n]["MerchantPrice"].ToString() != "") { model.MerchantPrice = decimal.Parse(ds.Tables[0].Rows[n]["MerchantPrice"].ToString()); } if (ds.Tables[0].Rows[n]["ReducePrice"].ToString() != "") { model.ReducePrice = decimal.Parse(ds.Tables[0].Rows[n]["ReducePrice"].ToString()); } if (ds.Tables[0].Rows[n]["Stock"].ToString() != "") { model.Stock = int.Parse(ds.Tables[0].Rows[n]["Stock"].ToString()); } model.SmallImage = ds.Tables[0].Rows[n]["SmallImage"].ToString(); model.MediumImage = ds.Tables[0].Rows[n]["MediumImage"].ToString(); model.LargeImage = ds.Tables[0].Rows[n]["LargeImage"].ToString(); model.Keywords = ds.Tables[0].Rows[n]["Keywords"].ToString(); model.Brief = ds.Tables[0].Rows[n]["Brief"].ToString(); if (ds.Tables[0].Rows[n]["PageView"].ToString() != "") { model.PageView = int.Parse(ds.Tables[0].Rows[n]["PageView"].ToString()); } if (ds.Tables[0].Rows[n]["InsertTime"].ToString() != "") { model.InsertTime = DateTime.Parse(ds.Tables[0].Rows[n]["InsertTime"].ToString()); } if (ds.Tables[0].Rows[n]["ChangeTime"].ToString() != "") { model.ChangeTime = DateTime.Parse(ds.Tables[0].Rows[n]["ChangeTime"].ToString()); } if (ds.Tables[0].Rows[n]["Status"].ToString() != "") { model.Status = int.Parse(ds.Tables[0].Rows[n]["Status"].ToString()); } if (ds.Tables[0].Rows[n]["SortValue"].ToString() != "") { model.SortValue = int.Parse(ds.Tables[0].Rows[n]["SortValue"].ToString()); } if (ds.Tables[0].Rows[n]["Score"].ToString() != "") { model.Score = int.Parse(ds.Tables[0].Rows[n]["Score"].ToString()); } modelList.Add(model); } } return(modelList); }