/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.StorePicture DataRowToModel(DataRow row) { Maticsoft.Model.StorePicture model=new Maticsoft.Model.StorePicture(); if (row != null) { if(row["PID"]!=null) { model.PID=row["PID"].ToString(); } if(row["StoreId"]!=null) { model.StoreId=row["StoreId"].ToString(); } if(row["PictureName"]!=null) { model.PictureName=row["PictureName"].ToString(); } if(row["PicturePath"]!=null) { model.PicturePath=row["PicturePath"].ToString(); } if(row["PicType"]!=null) { model.PicType=row["PicType"].ToString(); } } return model; }
protected virtual string SavePictureName(string storeId, string shopPicturePath) { var storePicture = new Maticsoft.Model.StorePicture() { PID = Guid.NewGuid().ToString() }; storePicture.PictureName = string.Format("{0}.jpg", storePicture.PID); storePicture.PicType = PicType; storePicture.PicturePath = shopPicturePath; storePicture.StoreId = storeId; StorePictureBll.Add(storePicture); return storePicture.PictureName; }
protected virtual Maticsoft.Model.StorePicture BuildStorePicture(Maticsoft.Model.StoreInfo storeInfo, string picturePathName) { var storePicture = new Maticsoft.Model.StorePicture { PID = Guid.NewGuid().ToString(), PicType = PicturType, PicturePath = picturePathName, StoreId = storeInfo.storeId, }; storePicture.PictureName = string.Format("{0}.jpg", storePicture.PID); return storePicture; }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.StorePicture GetModel(string PID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 PID,StoreId,PictureName,PicturePath,PicType from StorePicture "); strSql.Append(" where PID=@PID "); SqlParameter[] parameters = { new SqlParameter("@PID", SqlDbType.NVarChar,50) }; parameters[0].Value = PID; Maticsoft.Model.StorePicture model=new Maticsoft.Model.StorePicture(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }