Esempio n. 1
0
        /// <summary>
        /// 添加专家吐槽
        /// </summary>
        public void AddExperterComments(string userId, string sendUserId, CommentsTpye commentsTpye, string analyzeSchemeId, string recommendSchemeId, string content, string currentTime)
        {
            using (var biz = new GameBizBusinessManagement())
            {
                biz.BeginTran();

                var manager = new ExperterCommentsManager();
                var entity  = new ExperterComments()
                {
                    UserId            = userId,
                    CommentsTpye      = commentsTpye,
                    AnalyzeSchemeId   = analyzeSchemeId,
                    RecommendSchemeId = recommendSchemeId,
                    DealWithType      = DealWithType.NoneDealWith,
                    Content           = content,
                    SendUserId        = sendUserId,
                    DisposeOpinion    = "",
                    CurrentTime       = currentTime,
                    CreateTime        = DateTime.Now,
                };
                manager.AddExperterComments(entity);

                biz.CommitTran();
            }
        }
        /// <summary>
        /// 已经查询吐槽内容列表
        /// </summary>
        public List <ExperterCommentsInfo> QueryExperterCommentsByTime(string currentTime, CommentsTpye commentsTpye, string id, int length)
        {
            Session.Clear();
            var query = from r in this.Session.Query <ExperterComments>()
                        join u in this.Session.Query <UserRegister>() on r.SendUserId equals u.UserId
                        //where (r.CurrentTime == currentTime && r.CommentsTpye == commentsTpye && r.DealWithType == DealWithType.HasDealWith)
                        orderby r.CreateTime descending
                        select new ExperterCommentsInfo
            {
                Id                   = r.Id,
                ExperterId           = r.UserId,
                AnalyzeSchemeId      = r.AnalyzeSchemeId,
                DealWithType         = r.DealWithType,
                RecommendSchemeId    = r.RecommendSchemeId,
                CommentsTpye         = r.CommentsTpye,
                Content              = r.Content,
                CurrentTime          = r.CurrentTime,
                DisposeOpinion       = r.DisposeOpinion,
                CreateTime           = r.CreateTime,
                SendUserId           = u.UserId,
                DisplayName          = u.DisplayName,
                HideDisplayNameCount = u.HideDisplayNameCount,
            };

            switch (commentsTpye)
            {
            case CommentsTpye.HomeIndx:
                query = query.Where(p => p.CurrentTime == currentTime && p.CommentsTpye == commentsTpye && p.DealWithType == DealWithType.HasDealWith);
                break;

            case CommentsTpye.Experter:
                query = query.Where(p => p.CurrentTime == currentTime && p.CommentsTpye == commentsTpye && p.DealWithType == DealWithType.HasDealWith && p.ExperterId == id);
                break;

            case CommentsTpye.AllExperter:
                query = query.Where(p => p.CurrentTime == currentTime && p.CommentsTpye == commentsTpye && p.DealWithType == DealWithType.HasDealWith);
                break;

            case CommentsTpye.RecommendScheme:
                query = query.Where(p => p.CurrentTime == currentTime && p.CommentsTpye == commentsTpye && p.DealWithType == DealWithType.HasDealWith && p.RecommendSchemeId == id);
                break;

            case CommentsTpye.AnalyzeScheme:
                query = query.Where(p => p.CurrentTime == currentTime && p.CommentsTpye == commentsTpye && p.DealWithType == DealWithType.HasDealWith && p.AnalyzeSchemeId == id);
                break;

            default:
                break;
            }

            return(query.Take(length).ToList());
        }
 /// <summary>
 /// 查询吐槽内容列表
 /// </summary>
 public ExperterCommentsCollection QueryExperterCommentsByTime(string currentTime, CommentsTpye commentsTpye, string id, int length)
 {
     try
     {
         return(new ExpertBusiness().QueryExperterCommentsByTime(currentTime, commentsTpye, id, length));
     }
     catch (Exception ex)
     {
         throw new Exception("查询吐槽内容列表 - " + ex.Message);
     }
 }
 /// <summary>
 /// 添加吐槽
 /// </summary>
 public CommonActionResult AddExperterComments(string userId, string sendUserId, CommentsTpye commentsTpye, string analyzeSchemeId, string recommendSchemeId, string content, string currentTime)
 {
     try
     {
         new ExpertBusiness().AddExperterComments(userId, sendUserId, commentsTpye, analyzeSchemeId, recommendSchemeId, content, currentTime);
         return(new CommonActionResult(true, "操作成功"));
     }
     catch (Exception ex)
     {
         throw new Exception("添加吐槽 - " + ex.Message);
     }
 }
Esempio n. 5
0
        /// <summary>
        ///查询吐槽内容列表
        /// </summary>
        public ExperterCommentsCollection QueryExperterCommentsByTime(string currentTime, CommentsTpye commentsTpye, string id, int length)
        {
            ExperterCommentsCollection result = new ExperterCommentsCollection();

            result.List.AddRange(new ExperterCommentsManager().QueryExperterCommentsByTime(currentTime, commentsTpye, id, length));
            return(result);
        }