public GraphicMessage GetGraphicById(int id) { var dao = new GraphicMessageDao(ConfigurationManager.AppSettings["mysqlConnStr"]); var msg = dao.GetById(id.ToString()); return(msg); }
public void FollowByPost(string postId, string followerId) { var graphicMessageDao = new GraphicMessageDao(ConfigurationManager.AppSettings["mysqlConnStr"]); var graphicMsg = graphicMessageDao.GetById(postId); if (graphicMsg != null && !string.IsNullOrEmpty(graphicMsg.openId)) { var followDao = new FollowDao(ConfigurationManager.AppSettings["mysqlConnStr"]); bool isFollowed = followDao.GetFollowed(graphicMsg.openId, followerId); if (!isFollowed) { followDao.Add(new dataentity.Model.Follow() { followee = graphicMsg.openId, follower = followerId }); } } }
public ClubItem GetPostById(string postId) { ClubItem result = new ClubItem(); var dao = new GraphicMessageDao(ConfigurationManager.AppSettings["mysqlConnStr"]); var msg = dao.GetById(postId); List <string> pics = new List <string>(); if (!string.IsNullOrEmpty(msg.pic01)) { pics.Add(msg.pic01); } if (!string.IsNullOrEmpty(msg.pic02)) { pics.Add(msg.pic02); } if (!string.IsNullOrEmpty(msg.pic03)) { pics.Add(msg.pic03); } if (!string.IsNullOrEmpty(msg.pic04)) { pics.Add(msg.pic04); } if (!string.IsNullOrEmpty(msg.pic05)) { pics.Add(msg.pic05); } if (!string.IsNullOrEmpty(msg.pic06)) { pics.Add(msg.pic06); } List <string> audioes = new List <string>(); if (!string.IsNullOrEmpty(msg.audio01)) { audioes.Add(msg.audio01); } if (!string.IsNullOrEmpty(msg.audio02)) { audioes.Add(msg.audio02); } if (!string.IsNullOrEmpty(msg.audio03)) { audioes.Add(msg.audio03); } result = new ClubItem() { postId = msg.id, openId = msg.openId, author = msg.author, authorHeadPic = msg.authorHeadPic, name = msg.name, poster = !string.IsNullOrEmpty(msg.poster) ? msg.poster : msg.pic01, pics = pics, audioes = audioes, itemType = ClubItemType.Graphic, text = msg.text, likeCount = msg.likeCount, commentCount = msg.commentCount, createdAt = msg.createdAt }; return(result); }