public static InterView GetInterView(String id) { InterView iv = new InterView(); try { MongoDatabase md = MongoDBHelper.MongoDB; MongoCollection<InterView> mc = md.GetCollection<InterView>("InterView"); iv = mc.FindOne(Query.EQ("_id", ObjectId.Parse(id))); return iv; } catch (System.Exception err) { throw new CBB.ExceptionHelper.OperationException( CBB.ExceptionHelper.ErrType.SystemErr, CBB.ExceptionHelper.ErrNo.DBOperationError, err); } }
public static InterView AddInterView(String mid, String systemQuestionID, String question, String answer) { InterView iv = new InterView(); iv.MemberID = mid; iv.SystemQuestionID = systemQuestionID; iv.Question = question; iv.Answer = answer; iv.CreatedTime = DateTime.Now; try { MongoDatabase md = MongoDBHelper.MongoDB; MongoCollection<InterView> mc = md.GetCollection<InterView>("InterView"); mc.Insert(iv); //审核关键字 new Moooyo.BiZ.FilterWord.FilterWordController().FilterText(answer, InterView.GetCollectionName(), iv.ID, "Answer", iv.MemberID); //增加用户计数 BiZ.MemberManager.MemberManager.ModifyInterViewCount(mid, MemberManager.StatusModifyType.Add); //增加动态 BiZ.Member.Activity.ActivityController.AddActivity( mid, Member.Activity.ActivityType.UpdateInterView, BiZ.Member.Activity.ActivityController.GetActivityContent_UpdateInterView_Title(), BiZ.Member.Activity.ActivityController.GetActivityContent_UpdateInterView(iv.Question, iv.Answer), false); return iv; } catch (System.Exception err) { throw new CBB.ExceptionHelper.OperationException( CBB.ExceptionHelper.ErrType.SystemErr, CBB.ExceptionHelper.ErrNo.DBOperationError, err); } }
/// <summary> /// 更新内容的回复显示集合,工厂方法 /// </summary> /// <param name="ID">回复对象</param> /// <returns>操作是否成功</returns> public Boolean UpdateCommentList(Comment.Comment comment) { try { InterView obj = new InterView(); obj = InterViewProvider.GetInterView(comment.CommentToID); if (obj.AnswerList != null) { if (obj.AnswerList.Count >= 6) { obj.AnswerList.Insert(0, comment); obj.AnswerList.RemoveAt(obj.AnswerList.Count - 1); } else { obj.AnswerList.Insert(0, comment); } } else { List<Comment.Comment> commentlist = new List<Comment.Comment>(); commentlist.Add(comment); obj.AnswerList = commentlist; } obj.AnswerCount = Comment.CommentProvider.findForTypeCount(comment.CommentToID, Comment.CommentType.InterView, Comm.DeletedFlag.No); obj.Save(obj); return true; } catch (System.Exception err) { throw new CBB.ExceptionHelper.OperationException( CBB.ExceptionHelper.ErrType.SystemErr, CBB.ExceptionHelper.ErrNo.DBOperationError, err); } }
/// <summary> /// 更新访谈喜欢数量 /// </summary> /// <param name="interviewID">访谈编号</param> /// <returns></returns> public Boolean UpdateLikeCount(String interviewID) { try { InterView obj = new InterView(); obj = InterViewProvider.GetInterView(interviewID); if (obj != null) { obj.LikeCount = Like.LikeDataFactory.GetLike<Like.LikeData>(null, interviewID, Like.LikeType.InterView, Like.LikeData.GetCollectionName()).Count; obj.Save(obj); } return true; } catch (System.Exception err) { throw new CBB.ExceptionHelper.OperationException( CBB.ExceptionHelper.ErrType.SystemErr, CBB.ExceptionHelper.ErrNo.DBOperationError, err); } }
public InterView Save(InterView obj) { try { MongoDatabase md = MongoDBHelper.MongoDB; MongoCollection<InterView> mc = md.GetCollection<InterView>(InterView.GetCollectionName()); mc.Save(obj); return obj; } catch (System.Exception err) { throw new CBB.ExceptionHelper.OperationException( CBB.ExceptionHelper.ErrType.SystemErr, CBB.ExceptionHelper.ErrNo.DBOperationError, err); } }