public bool GetLiked(string itemType, int itemId, string openId)
        {
            var dao  = new LikeDao(ConfigurationManager.AppSettings["mysqlConnStr"]);
            var like = dao.GetLike(itemId, itemType, openId);

            return(like != null);
        }
        public Int64 GetLikeCount(string itemType, int itemId)
        {
            var dao   = new LikeDao(ConfigurationManager.AppSettings["mysqlConnStr"]);
            var count = dao.GetLikeCount(itemId, itemType);

            return(count);
        }
Example #3
0
        public void setDisLike(long senMeanId)
        {
            LikeDao lkDao    = new LikeDao();
            A_Like  sTblLike = lkDao.getLstLike(senMeanId);

            if (sTblLike == null)
            {
                lkDao.Insert(new A_Like()
                {
                    SenMeanId = senMeanId, LikeFlag = 0
                });
            }
            else
            {
                lkDao.UpdateDisLike(sTblLike);
            }
        }
        public ResponseEntity <string> Dislike(Like likeItem)
        {
            ResponseEntity <string> response = new ResponseEntity <string>();

            var  dao     = new LikeDao(ConfigurationManager.AppSettings["mysqlConnStr"]);
            bool success = dao.Dislike(likeItem);

            if (success)
            {
                response = new ResponseEntity <string>(true, "取消点赞成功", "取消点赞成功");
            }
            else
            {
                response = new ResponseEntity <string>(true, "取消点赞失败", "取消点赞失败");
            }
            return(response);
        }
        public UserProfile GetUser(string openId)
        {
            var dao         = new UserDao(ConfigurationManager.AppSettings["mysqlConnStr"]);
            var user        = dao.GetUser(openId);
            var userProfile = JsonConvert.DeserializeObject <UserProfile>(JsonConvert.SerializeObject(user));

            userProfile.certs = new List <DoctorCert>();
            if (!string.IsNullOrEmpty(userProfile.certificate) || !string.IsNullOrEmpty(userProfile.certText))
            {
                userProfile.certs.Add(new DoctorCert()
                {
                    cert = userProfile.certificate, text = userProfile.certText
                });
            }

            if (!string.IsNullOrEmpty(userProfile.certificate1) || !string.IsNullOrEmpty(userProfile.cert1Text))
            {
                userProfile.certs.Add(new DoctorCert()
                {
                    cert = userProfile.certificate1, text = userProfile.cert1Text
                });
            }

            if (!string.IsNullOrEmpty(userProfile.certificate2) || !string.IsNullOrEmpty(userProfile.cert2Text))
            {
                userProfile.certs.Add(new DoctorCert()
                {
                    cert = userProfile.certificate2, text = userProfile.cert2Text
                });
            }

            if (!string.IsNullOrEmpty(userProfile.certificate3) || !string.IsNullOrEmpty(userProfile.cert3Text))
            {
                userProfile.certs.Add(new DoctorCert()
                {
                    cert = userProfile.certificate3, text = userProfile.cert3Text
                });
            }

            if (!string.IsNullOrEmpty(userProfile.certificate4) || !string.IsNullOrEmpty(userProfile.cert4Text))
            {
                userProfile.certs.Add(new DoctorCert()
                {
                    cert = userProfile.certificate4, text = userProfile.cert4Text
                });
            }

            if (!string.IsNullOrEmpty(userProfile.certificate5) || !string.IsNullOrEmpty(userProfile.cert5Text))
            {
                userProfile.certs.Add(new DoctorCert()
                {
                    cert = userProfile.certificate5, text = userProfile.cert5Text
                });
            }

            if (!string.IsNullOrEmpty(userProfile.certificate6) || !string.IsNullOrEmpty(userProfile.cert6Text))
            {
                userProfile.certs.Add(new DoctorCert()
                {
                    cert = userProfile.certificate6, text = userProfile.cert6Text
                });
            }

            if (!string.IsNullOrEmpty(userProfile.certificate7) || !string.IsNullOrEmpty(userProfile.cert7Text))
            {
                userProfile.certs.Add(new DoctorCert()
                {
                    cert = userProfile.certificate7, text = userProfile.cert7Text
                });
            }


            var likeDao   = new LikeDao(ConfigurationManager.AppSettings["mysqlConnStr"]);
            var followDao = new FollowDao(ConfigurationManager.AppSettings["mysqlConnStr"]);

            userProfile.likeCount     = likeDao.GetLikeCount(openId);
            userProfile.fansCount     = followDao.GetFollowerCount(openId);
            userProfile.followeeCount = followDao.GetFolloweeCount(openId);

            return(userProfile);
        }