예제 #1
0
파일: OprHub.cs 프로젝트: DDN-Shep/OPR
        public void GetReport(long id)
        {
            Log.Verbose("OprHub - GetReport - id={0}: {0}", id, this.GetUserName());

            using (var db = new OprContext())
            {
                var report = db.GetReport(id, includeReports: true).SingleOrDefault();

                Log.Debug("Report = {0}", JsonConvert.SerializeObject(report));

                Clients.Caller.loadReport(report);
            }
        }
예제 #2
0
파일: OprHub.cs 프로젝트: DDN-Shep/OPR
        /// <summary>
        /// Get the latest comments (one for each type)
        /// </summary>
        /// <param name="reportId"></param>
        public void GetLatestComments(long reportId)
        {
            Log.Debug("Socket - GetLatestComments called by {0} with {1}", this.GetUserName(), reportId);

            using (var db = new OprContext())
            {
                var report = db.GetReport(reportId, includeComments: true).SingleOrDefault();

                if (report != null && report.CommentHistory != null)
                {
                    var comments = report.CommentHistory.Comments
                                   .OrderByDescending(c => c.ModifiedOn)
                                   .GroupBy(c => c.Type, (key, g) => new
                    {
                        Type    = key,
                        Comment = g.FirstOrDefault()
                    }).ToArray();

                    Clients.Caller.loadComments(comments);
                }
            }
        }