// 改 public bool Update(W_Resources resources) { using (SqlHelper helper = WechatDataBaseHelper.Create()) { int rows = helper.ExecuteNonQuery("update [W_Resources] set CataID=@CataID,RContent=@RContent,RURL=@RURL,RHURL=@RHURL,RType=@RType,RTitle=@RTitle,RDescription=@RDescription,MediaID=@MediaID,CreateTime=@CreateTime,IsDelete=@IsDelete where RID=@RID", new SqlParameter("@RID", resources.RID), new SqlParameter("@CataID", resources.CataID), new SqlParameter("@RContent", resources.RContent), new SqlParameter("@RURL", resources.RURL), new SqlParameter("@RHURL", resources.RHURL), new SqlParameter("@RType", resources.RType), new SqlParameter("@RTitle", resources.RTitle), new SqlParameter("@RDescription", resources.RDescription), new SqlParameter("@MediaID", resources.MediaID), new SqlParameter("@CreateTime", resources.CreateTime), new SqlParameter("@IsDelete", resources.IsDelete)); return(rows > 0); } }
// 增 public bool Add(W_Resources resources) { using (SqlHelper helper = WechatDataBaseHelper.Create()) { int rows = helper.ExecuteNonQuery("insert into [W_Resources] values (@RID,@CataID,@RContent,@RURL,@RHURL,@RType,@RTitle,@RDescription,@MediaID,@CreateTime,@IsDelete)", new SqlParameter("@RID", resources.RID), new SqlParameter("@CataID", resources.CataID), new SqlParameter("@RContent", resources.RContent), new SqlParameter("@RURL", resources.RURL), new SqlParameter("@RHURL", resources.RHURL), new SqlParameter("@RType", resources.RType), new SqlParameter("@RTitle", resources.RTitle), new SqlParameter("@RDescription", resources.RDescription), new SqlParameter("@MediaID", resources.MediaID), new SqlParameter("@CreateTime", resources.CreateTime), new SqlParameter("@IsDelete", resources.IsDelete)); return(rows > 0); } }
// 删 public bool Delete(W_Resources resources) { using (SqlHelper helper = WechatDataBaseHelper.Create()) { int rows = helper.ExecuteNonQuery("delete from [W_Resources] where RID=@RID", new SqlParameter("@RID", resources.RID)); return(rows > 0); } }
private void DoKeyWord(W_KeyWord keyWord) { if (string.Equals(keyWord.ResponseType, "viewPage", StringComparison.OrdinalIgnoreCase) == true) { W_ViewPageBLL bll = new W_ViewPageBLL(); W_ViewPage viewPage = bll.GetByResourcesID(keyWord.ResourcesID); DoViewPage(viewPage); } else { W_ResourcesBLL bll = new W_ResourcesBLL(); W_Resources resources = bll.GetByResourcesID(keyWord.ResourcesID); DoResources(resources); } }
private void DoResources(W_Resources resources) { if (resources.RType == "text") { this.Response = new TextResult() { Content = resources.RContent }; } else if (resources.RType == "image") { this.Response = new ImageResult() { MediaId = resources.MediaID }; } else if (resources.RType == "voice") { this.Response = new VoiceResult() { MediaId = resources.MediaID }; } else if (resources.RType == "video") { this.Response = new VideoResult() { Description = resources.RDescription, MediaId = resources.MediaID, Title = resources.RTitle }; } else if (resources.RType == "music") { this.Response = new MusicResult() { Description = resources.RDescription, HQMusicUrl = resources.RHURL, MusicURL = resources.RURL, ThumbMediaId = resources.MediaID, Title = resources.RTitle }; } }
// 改 public bool Update(W_Resources resources) { return(new W_ResourcesDAL().Update(resources)); }
// 删 public bool Delete(W_Resources resources) { return(new W_ResourcesDAL().Delete(resources)); }
// 增 public bool Add(W_Resources resources) { return(new W_ResourcesDAL().Add(resources)); }