예제 #1
0
파일: Model.cs 프로젝트: gdlprj/duscusys
 /// <summary>
 /// Create a new CommentPersonReadEntry object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 public static CommentPersonReadEntry CreateCommentPersonReadEntry(global::System.Int32 id)
 {
     CommentPersonReadEntry commentPersonReadEntry = new CommentPersonReadEntry();
     commentPersonReadEntry.Id = id;
     return commentPersonReadEntry;
 }
예제 #2
0
파일: Model.cs 프로젝트: gdlprj/duscusys
 /// <summary>
 /// Deprecated Method for adding a new object to the CommentPersonReadEntry EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCommentPersonReadEntry(CommentPersonReadEntry commentPersonReadEntry)
 {
     base.AddObject("CommentPersonReadEntry", commentPersonReadEntry);
 }
예제 #3
0
        //all the changes will be cached locally without refreshing/redropping the context         
        public static void pushDismissal(ArgPoint ap, DiscCtx ctx)
        {
            var persId = SessionInfo.Get().person.Id;

            var apId = ap.Id;
            ap = ctx.ArgPoint.Single(ap0 => ap0.Id == apId);

            foreach (var c in ap.Comment)
            {
                //skip "new comment"
                if(c.Person == null)
                    continue;                
                
                var existing = c.ReadEntry.FirstOrDefault(re => re.Person.Id == persId);               
                if (existing == null)
                {
                    var entry = new CommentPersonReadEntry
                        {
                            Comment = c,
                            Person = ctx.Person.Single(p => p.Id == persId)
                        };
                    ctx.AddToCommentPersonReadEntry(entry);
                }                
            }

            try
            {
                ctx.SaveChanges();
            }
            catch
            {                
            }

            UISharedRTClient.Instance.clienRt.SendCommentsRead(SessionInfo.Get().person.Id,
                                                              ap.Topic.Id,
                                                              ap.Id, -1);
        }