예제 #1
0
        public HttpResponseMessage Poll(int conferenceId, int sessionId, int visibility, System.DateTime lastCheck)
        {
            switch (visibility)
            {
            case 0:     // just the authors
                if (!ConferenceModuleContext.Security.IsPresenter(sessionId))
                {
                    return(AccessViolation("You need to be a presenter to see this"));
                }
                break;

            case 1:     // between authors and managers
                if (!(ConferenceModuleContext.Security.IsPresenter(sessionId) | ConferenceModuleContext.Security.CanManage))
                {
                    return(AccessViolation("You need to be a presenter or manager to see this"));
                }
                break;
            }
            try
            {
                var retValue = new pollReturnDTO();
                retValue.CheckTime = System.DateTime.Now;
                retValue.Comments  = CommentRepository.Instance.GetNewComments(sessionId, visibility, lastCheck);
                if (retValue.Comments.Count() > 0)
                {
                    retValue.NewTotalComments = CommentRepository.Instance.GetTotalComments(sessionId, visibility);
                }
                return(Request.CreateResponse(HttpStatusCode.OK, retValue));
            }
            catch (System.Exception ex)
            {
                return(ServiceError(ex.Message));
            }
        }
예제 #2
0
 public HttpResponseMessage Poll(int conferenceId, int sessionId, int visibility, System.DateTime lastCheck)
 {
     switch (visibility)
     {
         case 0: // just the authors
             if (!ConferenceModuleContext.Security.IsPresenter(sessionId))
             {
                 return AccessViolation("You need to be a presenter to see this");
             }
             break;
         case 1: // between authors and managers
             if (!(ConferenceModuleContext.Security.IsPresenter(sessionId) | ConferenceModuleContext.Security.CanManage))
             {
                 return AccessViolation("You need to be a presenter or manager to see this");
             }
             break;
     }
     try
     {
         var retValue = new pollReturnDTO();
         retValue.CheckTime = System.DateTime.Now;
         retValue.Comments = CommentRepository.Instance.GetNewComments(sessionId, visibility, lastCheck).FillStampLines();
         if (retValue.Comments.Count() > 0)
         {
             retValue.NewTotalComments = CommentRepository.Instance.GetTotalComments(sessionId, visibility);
         }
         return Request.CreateResponse(HttpStatusCode.OK, retValue);
     }
     catch (System.Exception ex)
     {
         return ServiceError(ex.Message);
     }
 }