public Int64 GetLikeCount(string itemType, int itemId) { var dao = new LikeDao(ConfigurationManager.AppSettings["mysqlConnStr"]); var count = dao.GetLikeCount(itemId, itemType); return(count); }
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); }