/// <summary> /// 根据ID获取媒体信息 /// </summary> /// <param name="info"></param> public Model.WeiXin.Media GetMediaByID(string id) { Model.WeiXin.Media res = null; if (!string.IsNullOrEmpty(id)) { string sql = string.Format("SELECT * FROM {0} WHERE ID='{1}'", TABLE_NAME, id); DataSet ds = DbHelperSQL.Query(sql); res = ds.ConvertToFirstObj <Model.WeiXin.Media>(); } return(res); }
/// <summary> /// 插入媒体数据 /// </summary> /// <param name="info"></param> public void InsertInfo(Model.WeiXin.Media info) { Dictionary <string, object> datas = new Dictionary <string, object>(); datas.Add("ID", info.ID); datas.Add("MediaName", info.MediaName); datas.Add("MediaFile", info.MediaFile); datas.Add("UploadTime", info.UploadTime); datas.Add("IsAutoSyn", info.IsAutoSyn); datas.Add("MediaType", info.MediaType); SQLHelperExt.Insert(TABLE_NAME, datas); }
/// <summary> /// 更新媒体数据 /// </summary> /// <param name="info"></param> public void UpdateInfo(Model.WeiXin.Media info) { string where = string.Format(" ID={0}", info.ID); Dictionary <string, object> datas = new Dictionary <string, object>(); datas.Add("ID", info.ID); datas.Add("MediaName", info.MediaName); datas.Add("MediaFile", info.MediaFile); datas.Add("UploadTime", info.UploadTime); datas.Add("IsAutoSyn", info.IsAutoSyn); datas.Add("LastSynTime", info.LastSynTime); datas.Add("MediaID", info.MediaID); datas.Add("MediaType", info.MediaType); SQLHelperExt.Update(TABLE_NAME, datas, where); }
protected void Page_Load(object sender, EventArgs e) { if (null != Common.Common.NoHtml(Request.QueryString["id"])) { mediaID = Common.Common.NoHtml(Request.QueryString["id"]); } if (!string.IsNullOrEmpty(mediaID)) { Model.WeiXin.Media media = MediaDAL.CreateInstance().GetMediaByID(mediaID); mediaFile = media.MediaFile; } else { Response.Write("无法播放指定的文件!"); Response.End(); } }