/// <summary> /// ����һ������ /// </summary> public void Add(SalesProductModel model) { DbCommand dbCommand = dbw.GetStoredProcCommand("UP_pdSalesProduct_ADD"); dbw.AddInParameter(dbCommand, "ProductId", DbType.Int32, model.ProductId); dbw.AddInParameter(dbCommand, "SaleType", DbType.Byte, model.SaleType); dbw.AddInParameter(dbCommand, "SiteId", DbType.Int32, model.SiteId); dbw.AddInParameter(dbCommand, "timestamp", DbType.DateTime, model.TimeStamp); dbw.ExecuteNonQuery(dbCommand); }
/// <summary> /// ����һ������ /// </summary> public void Update(SalesProductModel model) { DbCommand dbCommand = dbw.GetStoredProcCommand("UP_pdSalesProduct_Update"); dbw.AddInParameter(dbCommand, "ProductId", DbType.Int32, model.ProductId); dbw.AddInParameter(dbCommand, "SaleType", DbType.Byte, model.SaleType); dbw.AddInParameter(dbCommand, "SiteId", DbType.Int32, model.SiteId); dbw.ExecuteNonQuery(dbCommand); }
/// <summary> /// ����ʵ������� /// </summary> public SalesProductModel ReaderBind(IDataReader dataReader) { SalesProductModel model=new SalesProductModel(); object ojb; ojb = dataReader["ProductId"]; if(ojb != null && ojb != DBNull.Value) { model.ProductId=(int)ojb; } ojb = dataReader["SaleType"]; if(ojb != null && ojb != DBNull.Value) { model.SaleType=(int)ojb; } ojb = dataReader["SiteId"]; if(ojb != null && ojb != DBNull.Value) { model.SiteId=(int)ojb; } ojb = dataReader["timestamp"]; if (ojb != null && ojb != DBNull.Value) { model.TimeStamp = Convert.ToDateTime(ojb); } return model; }
/// <summary> /// ����һ������ /// </summary> public void Add(SalesProductModel model) { dal.Add(model); }
/// <summary> /// ����һ������ /// </summary> public void Update(SalesProductModel model) { dal.Update(model); }
/// <summary> /// ��������б� /// </summary> public List<SalesProductModel> GetModelList(string strWhere) { DataSet ds = dal.GetList(strWhere); List<SalesProductModel> modelList = new List<SalesProductModel>(); int rowsCount = ds.Tables[0].Rows.Count; if (rowsCount > 0) { SalesProductModel model; for (int n = 0; n < rowsCount; n++) { model = new SalesProductModel(); 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]["SaleType"].ToString()!="") { model.SaleType=int.Parse(ds.Tables[0].Rows[n]["SaleType"].ToString()); } if(ds.Tables[0].Rows[n]["SiteId"].ToString()!="") { model.SiteId=int.Parse(ds.Tables[0].Rows[n]["SiteId"].ToString()); } if (ds.Tables[0].Rows[n]["timestamp"].ToString() != "") { model.TimeStamp = Convert.ToDateTime(ds.Tables[0].Rows[n]["timestamp"].ToString()); } modelList.Add(model); } } return modelList; }