/// <summary> /// ����һ������ /// </summary> public void Add(RelaProductModel model) { DbCommand dbCommand = dbw.GetStoredProcCommand("UP_pdRelaProduct_ADD"); dbw.AddInParameter(dbCommand, "ProductId", DbType.Int32, model.ProductId); dbw.AddInParameter(dbCommand, "RelaProductId", DbType.Int32, model.RelaProductId); dbw.ExecuteNonQuery(dbCommand); }
/// <summary> /// ����һ������ /// </summary> public void Add(RelaProductModel model) { dal.Add(model); }
/// <summary> /// ����һ������ /// </summary> public void Update(RelaProductModel model) { dal.Update(model); }
/// <summary> /// ��������б� /// </summary> public List<RelaProductModel> GetModelList(string strWhere) { DataSet ds = dal.GetList(strWhere); List<RelaProductModel> modelList = new List<RelaProductModel>(); int rowsCount = ds.Tables[0].Rows.Count; if (rowsCount > 0) { RelaProductModel model; for (int n = 0; n < rowsCount; n++) { model = new RelaProductModel(); if(ds.Tables[0].Rows[n]["ProductId"].ToString()!="") { model.ProductId=int.Parse(ds.Tables[0].Rows[n]["ProductId"].ToString()); } if(ds.Tables[0].Rows[n]["RelaProductId"].ToString()!="") { model.RelaProductId=int.Parse(ds.Tables[0].Rows[n]["RelaProductId"].ToString()); } modelList.Add(model); } } return modelList; }
/// <summary> /// ����ʵ������� /// </summary> public RelaProductModel ReaderBind(IDataReader dataReader) { RelaProductModel model=new RelaProductModel(); object ojb; ojb = dataReader["ProductId"]; if(ojb != null && ojb != DBNull.Value) { model.ProductId=(int)ojb; } ojb = dataReader["RelaProductId"]; if(ojb != null && ojb != DBNull.Value) { model.RelaProductId=(int)ojb; } return model; }