public override void UpdateFriendHot(HotType type, int userID, int friendUserID) { using (SqlQuery query = new SqlQuery()) { query.CommandType = CommandType.StoredProcedure; query.CommandText = "bx_UpdateFriendHot"; query.CreateParameter <int>("@UserID", userID, SqlDbType.Int); query.CreateParameter <int>("@FriendUserID", friendUserID, SqlDbType.Int); query.CreateParameter <int>("@Hot", (int)type, SqlDbType.Int); query.ExecuteNonQuery(); } }
private void FormHotDetails_Load(object sender, EventArgs e) { #region 初始化控件内容 HotSmokeType smokeType = HotSmokeType.无; List <object> smokeTypeList = CommonHelper.GetDataSource <HotSmokeType>(smokeType); this.cbx_smoke.DisplayMember = "Name"; this.cbx_smoke.ValueMember = "Value"; this.cbx_smoke.DataSource = smokeTypeList; HotContinuousType continuousType = HotContinuousType.非连续; List <object> scontinuousTypeList = CommonHelper.GetDataSource <HotContinuousType>(continuousType); this.cbx_continuous.DisplayMember = "Name"; this.cbx_continuous.ValueMember = "Value"; this.cbx_continuous.DataSource = scontinuousTypeList; HotType hotType = HotType.其他; List <object> hotTypeList = CommonHelper.GetDataSource <HotType>(hotType); this.cbx_type.DisplayMember = "Name"; this.cbx_type.ValueMember = "Value"; this.cbx_type.DataSource = hotTypeList; #endregion //初始化行政区数据 this.Init(GlobeHelper.Instance.User); #region 编辑、查看时为控件赋值 if (this.currentHot != null) { this.coordinatesInputControl11.Longitude = this.currentHot.longitude; this.coordinatesInputControl11.Latitude = this.currentHot.latitude; this.tbx_no.Text = this.currentHot.no; this.tbx_pixels.Text = this.currentHot.pixels.ToString(); this.tbx_satellite.Text = this.currentHot.satellite; this.cbx_smoke.SelectedValue = this.currentHot.smoke; this.cbx_continuous.SelectedValue = this.currentHot.continuous; this.tbx_landType.Text = this.currentHot.landtype; this.dateTimePicker_receiptTime.Value = (this.currentHot.receiptt == "" || this.currentHot.receiptt == null) ? DateTime.Now : Convert.ToDateTime(this.currentHot.receiptt); this.dateTimePicker_reportTime.Value = (this.currentHot.reporttime == "" || this.currentHot.reporttime == null) ? DateTime.Now : Convert.ToDateTime(this.currentHot.reporttime); if (this.currentHot.pac != null && this.currentHot.pac != "") { this.cbx_province.SelectedValue = this.currentHot.pac.Substring(0, 2) + "0000"; this.cbx_city.SelectedValue = this.currentHot.pac.Substring(0, 4) + "00"; this.cbx_county.SelectedValue = this.currentHot.pac; } this.tbx_duty.Text = this.currentHot.duty; this.tbx_reporter.Text = this.currentHot.reporter; this.cbx_type.SelectedValue = this.currentHot.type; this.tbx_opinion.Text = this.currentHot.opinion; this.tbx_note.Text = this.currentHot.note; this.tbx_cre_pers.Text = this.currentHot.cre_pers; } #endregion this.hotControler.GetDetails(new Dictionary <string, object>() { { "id", this.currentHot.id } }); if (hotOperate != HotOperate.Feedback) { this.hotControler.GetDetails(new Dictionary <string, object>() { { "id", this.currentHot.id } }); } else { this.panel_feedback.Visible = false; this.tabControl1.TabPages.Remove(this.tabPage_ExamineInfo); this.btnExamine.Visible = false; } }
public override void UpdateFriendHot(HotType type, int userID, int friendUserID) { using (SqlQuery query = new SqlQuery()) { query.CommandType = CommandType.StoredProcedure; query.CommandText = "bx_UpdateFriendHot"; query.CreateParameter<int>("@UserID", userID, SqlDbType.Int); query.CreateParameter<int>("@FriendUserID", friendUserID, SqlDbType.Int); query.CreateParameter<int>("@Hot", (int)type, SqlDbType.Int); query.ExecuteNonQuery(); } }
public async Task <HttpResult <List <Post> > > GetHotPostsAsync(HotType hotType, Category category, int count = 10, CancellationToken cancellationToken = default) { string requestUri = $"{baseUri}/hot/{hotType.ToString().ToLower()}/category/{category}/count/{count}"; return(await GetDataAsync <HttpResult <List <Post> > >(requestUri, cancellationToken)); }
/// <summary> /// 更新好友间的热度 /// </summary> /// <param name="type"></param> /// <param name="userID"></param> /// <param name="friendUserID"></param> public abstract void UpdateFriendHot(HotType type, int userID, int friendUserID);
private void FormFireHot_Load(object sender, EventArgs e) { #region 初始化控件内容 if (m_OperationType == OperationType.Add) { this.Text = "新增热点"; } else if (m_OperationType == OperationType.Edit) { this.Text = "编辑热点"; } else if (m_OperationType == OperationType.Check) { this.Text = "查看热点"; } HotSmokeType smokeType = HotSmokeType.无; List <object> smokeTypeList = CommonHelper.GetDataSource <HotSmokeType>(smokeType); this.cbx_smoke.DisplayMember = "Name"; this.cbx_smoke.ValueMember = "Value"; this.cbx_smoke.DataSource = smokeTypeList; HotContinuousType continuousType = HotContinuousType.非连续; List <object> scontinuousTypeList = CommonHelper.GetDataSource <HotContinuousType>(continuousType); this.cbx_continuous.DisplayMember = "Name"; this.cbx_continuous.ValueMember = "Value"; this.cbx_continuous.DataSource = scontinuousTypeList; HotType hotType = HotType.其他; List <object> hotTypeList = CommonHelper.GetDataSource <HotType>(hotType); this.cbx_type.DisplayMember = "Name"; this.cbx_type.ValueMember = "Value"; this.cbx_type.DataSource = hotTypeList; this.tbx_cre_pers.Text = GlobeHelper.Instance.User.name; #endregion //初始化行政区数据 this.Init(GlobeHelper.Instance.User); #region 编辑、查看时为控件赋值 if (this.currentHot != null && this.m_OperationType != OperationType.Add) { this.coordinatesInputControl1.Longitude = this.currentHot.longitude; this.coordinatesInputControl1.Latitude = this.currentHot.latitude; this.tbx_no.Text = this.currentHot.no; this.tbx_pixels.Text = this.currentHot.pixels.ToString(); this.tbx_satellite.Text = this.currentHot.satellite; this.cbx_smoke.SelectedValue = this.currentHot.smoke; this.cbx_continuous.SelectedValue = this.currentHot.continuous; this.tbx_landType.Text = this.currentHot.landtype; this.dateTimePicker_receiptTime.Value = (this.currentHot.receiptt == "" || this.currentHot.receiptt == null) ? DateTime.Now : Convert.ToDateTime(this.currentHot.receiptt); this.dateTimePicker_reportTime.Value = (this.currentHot.reporttime == "" || this.currentHot.reporttime == null) ? DateTime.Now : Convert.ToDateTime(this.currentHot.reporttime); if (this.currentHot.pac != null && this.currentHot.pac != "") { this.cbx_province.SelectedValue = this.currentHot.pac.Substring(0, 2) + "0000"; this.cbx_city.SelectedValue = this.currentHot.pac.Substring(0, 4) + "00"; this.cbx_county.SelectedValue = this.currentHot.pac; } this.tbx_duty.Text = this.currentHot.duty; this.tbx_reporter.Text = this.currentHot.reporter; this.cbx_type.SelectedValue = this.currentHot.type; this.tbx_opinion.Text = this.currentHot.opinion; this.tbx_note.Text = this.currentHot.note; this.tbx_cre_pers.Text = this.currentHot.cre_pers; if (this.m_OperationType == OperationType.Check) { this.btnOK.Visible = false; } } #endregion }
/// <summary> /// 添加评论 并更新缓存 /// </summary> /// <param name="userID">评论者ID</param> /// <param name="targetID">被评论的记录、日志、相册的ID</param> /// <param name="commentID">被评论的评论ID</param> /// <param name="type">评论类型 记录、日志、相册</param> /// <param name="content"></param> /// <param name="createIP"></param> /// <returns></returns> public bool AddComment(AuthUser operatorUser, int targetID, int commentID, CommentType type, string content, string createIP, bool isReply, int replyTargetUserID, out int newCommentId, out string newCommentContent) { Notify notify; newCommentId = 0; newCommentContent = string.Empty; if (Permission.Can(operatorUser, SpacePermissionSet.Action.AddComment) == false) { ThrowError <NoPermissionAddCommentError>(new NoPermissionAddCommentError()); return(false); } if (targetID < 0) { ThrowError(new InvalidParamError("targetID")); return(false); } if (commentID < 0) { ThrowError(new InvalidParamError("commentID")); return(false); } if (string.IsNullOrEmpty(content)) { ThrowError(new EmptyCommentError("content")); return(false); } if (StringUtil.GetByteCount(content) > Consts.Comment_Length) { ThrowError(new InvalidCommentLengthError("content", content, Consts.Comment_Length)); return(false); } int commentTargetUserID = GetCommentTargetUserID(targetID, type); if (FriendBO.Instance.MyInBlacklist(operatorUser.UserID, commentTargetUserID)) { ThrowError(new PrivacyError()); return(false); } bool isApproved = true; //string reverter, version; //content = AllSettings.Current.ContentKeywordSettings.ReplaceKeywords.Replace(content, out version, out reverter); CommentPointType commentPointType = CommentPointType.AddApprovedComment; KeywordReplaceRegulation keywordReg = AllSettings.Current.ContentKeywordSettings.ReplaceKeywords; content = keywordReg.Replace(content); string keyword = null; if (AllSettings.Current.ContentKeywordSettings.BannedKeywords.IsMatch(content, out keyword)) { Context.ThrowError(new KeywordBannedError("content", keyword)); return(false); } if (AllSettings.Current.ContentKeywordSettings.ApprovedKeywords.IsMatch(content)) { isApproved = false; commentPointType = CommentPointType.AddNoApprovedComment; } if (StringUtil.GetByteCount(content) > Consts.Comment_Length) { Context.ThrowError(new InvalidCommentLengthError("content", content, Consts.Comment_Length)); return(false); } int targetUserID = 0; int tempCommentID = 0; content = CommentUbbParser.ParseForSave(content); newCommentContent = content; bool success = CommentPointAction.Instance.UpdateUserPoint(operatorUser.UserID, commentPointType, delegate(PointActionManager.TryUpdateUserPointState state) { if (state != PointActionManager.TryUpdateUserPointState.CheckSucceed) { return(false); } else { //添加评论并发送动态与通知 switch (type) { case CommentType.Board: SimpleUser user = UserBO.Instance.GetSimpleUser(targetID); if (user == null) { ThrowError(new UserNotExistsError("targetID", targetID)); return(false); } CommentDao.Instance.AddComment(operatorUser.UserID, targetID, type, isApproved, content, /* reverter, */ createIP, out targetUserID, out tempCommentID); FeedBO.Instance.CreateLeveMessageFeed(operatorUser.UserID, targetID); if (isReply && operatorUser.UserID != replyTargetUserID) { notify = new BoardCommentNotify(operatorUser.UserID, tempCommentID, isReply, targetID); notify.UserID = replyTargetUserID; NotifyBO.Instance.AddNotify(operatorUser, notify); } else if (targetID != operatorUser.UserID) { notify = new BoardCommentNotify(operatorUser.UserID, tempCommentID, false, targetID); notify.UserID = targetID; NotifyBO.Instance.AddNotify(operatorUser, notify); } CacheUtil.RemoveBySearch(string.Format(cacheKey_List_Space, targetID, type)); break; case CommentType.Blog: BlogArticle article = BlogBO.Instance.GetBlogArticle(targetID); if (article == null) { ThrowError(new NotExistsAlbumError(targetID)); return(false); } if (!article.EnableComment) { ThrowError(new PrivacyError()); return(false); } else { if (article.UserID != operatorUser.UserID) //如果不是作者评论自己的 给作者加积分 { CommentDao.Instance.AddComment(operatorUser.UserID, targetID, type, isApproved, content, /* reverter, */ createIP, out targetUserID, out tempCommentID); success = BlogPointAction.Instance.UpdateUserPoint(article.UserID, BlogPointType.ArticleWasCommented); if (success == false) { return(false); } } else { CommentDao.Instance.AddComment(operatorUser.UserID, targetID, type, isApproved, content, /* reverter, */ createIP, out targetUserID, out tempCommentID); } } FeedBO.Instance.CreatBlogCommentFeed(operatorUser.UserID, article.UserID, targetID, article.Subject); if (isReply && operatorUser.UserID != replyTargetUserID) { notify = new BlogCommentNotify(operatorUser.UserID, article.Subject, targetID, tempCommentID, isReply, article.UserID); notify.UserID = replyTargetUserID; NotifyBO.Instance.AddNotify(operatorUser, notify); } else if (article.UserID != operatorUser.UserID) { notify = new BlogCommentNotify(operatorUser.UserID, article.Subject, targetID, tempCommentID, false, article.UserID); notify.UserID = article.UserID; NotifyBO.Instance.AddNotify(operatorUser, notify); } break; case CommentType.Doing: Doing doing = DoingBO.Instance.GetDoing(targetID); if (doing == null) { ThrowError(new NotExistsDoingError(targetID)); return(false); } CommentDao.Instance.AddComment(operatorUser.UserID, targetID, type, isApproved, content, /* reverter, */ createIP, out targetUserID, out tempCommentID); if (isReply && operatorUser.UserID != replyTargetUserID) { notify = new DoingPostNotify(operatorUser.UserID, doing.Content, doing.ID, tempCommentID, isReply, doing.UserID); notify.UserID = replyTargetUserID; NotifyBO.Instance.AddNotify(operatorUser, notify); } else if (doing.UserID != operatorUser.UserID) { notify = new DoingPostNotify(operatorUser.UserID, doing.Content, doing.ID, tempCommentID, false, doing.UserID); notify.UserID = doing.UserID; NotifyBO.Instance.AddNotify(operatorUser, notify); } DoingBO.Instance.ClearCachedEveryoneData(); break; case CommentType.Share: Share share = ShareBO.Instance.GetUserShare(targetID); if (share == null) { ThrowError(new NotExistsShareError(targetID)); return(false); } if (share.UserID != operatorUser.UserID) //如果不是分享作者评论自己的分享 给分享作者加积分 { CommentDao.Instance.AddComment(operatorUser.UserID, targetID, type, isApproved, content, /* reverter, */ createIP, out targetUserID, out tempCommentID); success = SharePointAction.Instance.UpdateUserPoint(share.UserID, SharePointType.ShareWasCommeted); if (!success) { return(false); } } else { CommentDao.Instance.AddComment(operatorUser.UserID, targetID, type, isApproved, content, /* reverter, */ createIP, out targetUserID, out tempCommentID); } ShareBO.Instance.ClearCachedEveryoneData(); FeedBO.Instance.CreatShareCommentFeed(operatorUser.UserID, share.UserID, targetID, share.Type); if (isReply && operatorUser.UserID != replyTargetUserID) { notify = new SharePostNotify(operatorUser.UserID, targetID, tempCommentID, isReply, share.UserID); notify.UserID = replyTargetUserID; NotifyBO.Instance.AddNotify(operatorUser, notify); } else if (share.UserID != operatorUser.UserID) { notify = new SharePostNotify(operatorUser.UserID, targetID, tempCommentID, false, share.UserID); notify.UserID = share.UserID; NotifyBO.Instance.AddNotify(operatorUser, notify); } break; case CommentType.Photo: Photo photo = AlbumBO.Instance.GetPhoto(targetID); if (photo == null) { ThrowError(new NotExistsPhotoError(targetID)); return(false); } CommentDao.Instance.AddComment(operatorUser.UserID, targetID, type, isApproved, content, /* reverter, */ createIP, out targetUserID, out tempCommentID); FeedBO.Instance.CreatPictureCommentFeed(operatorUser.UserID, targetUserID, targetID, photo.ThumbSrc, photo.Name, content); if (isReply && operatorUser.UserID != replyTargetUserID) { notify = new PhotoCommentNotify(operatorUser.UserID, targetID, photo.Name, tempCommentID, isReply, photo.UserID); notify.UserID = replyTargetUserID; NotifyBO.Instance.AddNotify(operatorUser, notify); } else if (photo.UserID != operatorUser.UserID) { notify = new PhotoCommentNotify(operatorUser.UserID, targetID, photo.Name, tempCommentID, false, photo.UserID); notify.UserID = photo.UserID; NotifyBO.Instance.AddNotify(operatorUser, notify); } break; } return(true); } }); if (success == false) { return(false); } newCommentId = tempCommentID; //更新热度 if (targetUserID != 0) { HotType hotType = HotType.Comment; if (type == CommentType.Board) { hotType = HotType.Messag; } FriendBO.Instance.UpdateFriendHot(operatorUser.UserID, hotType, targetUserID); } if (isApproved == false) { Context.ThrowError(new UnapprovedCommentError()); return(false); } return(true); }