/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.VideoPic DataRowToModel(DataRow row) { Maticsoft.Model.VideoPic model=new Maticsoft.Model.VideoPic(); if (row != null) { if(row["ID"]!=null && row["ID"].ToString()!="") { model.ID=int.Parse(row["ID"].ToString()); } if(row["VideoName"]!=null) { model.VideoName=row["VideoName"].ToString(); } if(row["VideoUrl"]!=null) { model.VideoUrl=row["VideoUrl"].ToString(); } if(row["AddUser"]!=null) { model.AddUser=row["AddUser"].ToString(); } if(row["AddTime"]!=null && row["AddTime"].ToString()!="") { model.AddTime=DateTime.Parse(row["AddTime"].ToString()); } if(row["PicUrl"]!=null) { model.PicUrl=row["PicUrl"].ToString(); } if(row["PicID"]!=null && row["PicID"].ToString()!="") { model.PicID=int.Parse(row["PicID"].ToString()); } } return model; }
private void VideoDetails_Load(object sender, EventArgs e) { if (common.videomode == "update") { Maticsoft.Model.VideoPic vp = new Maticsoft.Model.VideoPic(); vp = bllvp.GetModel(int.Parse(common.videoid)); Maticsoft.Model.Video model = bll.GetModel(int.Parse(common.videoid)); txtVideoName.Text = model.VideoName; txtVideoUrlF.Text = model.VideoUrl; //pictureBox1.Image = common.GetActorImage(vp.PicUrl); Maticsoft.Model.Picture picmodel = picturebll.GetModelList("PicType='视频' and Belong='" + model.VideoName + "'")[0]; txtVideoImg.Text = picmodel.PicUrl; pictureBox1.Image = common.GetActorImage(picmodel.PicUrl); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.VideoPic GetModel(int ID) { //该表无主键信息,请自定义主键/条件字段 StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 ID,VideoName,VideoUrl,AddUser,AddTime,PicUrl,PicID from VideoPic "); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@ID",SqlDbType.Int,4) }; Maticsoft.Model.VideoPic model=new Maticsoft.Model.VideoPic(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }