Exemplo n.º 1
0
 /// <summary>
 /// BlogTaskUpdated - Event Handler Raised by WorkflowManager SaveTask 
 /// </summary>
 /// <param name="beforeUpdate"></param>
 /// <param name="afterUpdate"></param>
 public void BlogTaskUpdated(UserTask beforeUpdate, UserTask afterUpdate)
 {
     Blog blog = eCollabroDbContext.Repository<Blog>().Find(afterUpdate.ContexContentId);
     if (blog != null)
     {
         TempBlog blogInQueue = _workflowManager.GetFromQueue<TempBlog>(ContextEnum.Blog, blog.BlogId);
         if (blogInQueue != null)// record in queue for pending approval/draft
         {
             blogInQueue.ApprovalStatus = afterUpdate.TaskStatus;
             blogInQueue.ApproveRejectById = UserContextDetails.UserId;
             blogInQueue.ApproveRejectDate = DateTime.UtcNow;
             if (afterUpdate.TaskStatus.Equals(WorkflowConstants.ApprovedStatus))
             {
                 MapBlogQueueToBlog(blog, blogInQueue);
                 _workflowManager.DeleteFromQueue(ContextEnum.Blog, blog.BlogId);
             }
         }
         else
         {
             blog.ApprovalStatus = afterUpdate.TaskStatus;
             blog.ApproveRejectById = UserContextDetails.UserId;
             blog.ApproveRejectDate = DateTime.UtcNow;
         }
         eCollabroDbContext.Save();
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// DocumentTaskUpdated - Event Handler Raised by WorkflowManager SaveTask 
 /// </summary>
 /// <param name="beforeUpdate"></param>
 /// <param name="afterUpdate"></param>
 public void DocumentTaskUpdated(UserTask beforeUpdate, UserTask afterUpdate)
 {
     Document document = eCollabroDbContext.Repository<Document>().Query().Include(inc => inc.FileObject).Filter(qry => qry.DocumentId.Equals(afterUpdate.ContexContentId)).Get().FirstOrDefault();
     if (document != null)
     {
         TempDocument documentInQueue = _workflowManager.GetFromQueue<TempDocument>(ContextEnum.Document, document.DocumentId);
         if (documentInQueue != null)// record in queue for pending approval/draft
         {
             documentInQueue.ApprovalStatus = afterUpdate.TaskStatus;
             documentInQueue.ApproveRejectById = UserContextDetails.UserId;
             documentInQueue.ApproveRejectDate = DateTime.UtcNow;
             if (afterUpdate.TaskStatus.Equals(WorkflowConstants.ApprovedStatus))
             {
                 MapDocumentQueueToDocument(document, documentInQueue);
                 _workflowManager.DeleteFromQueue(ContextEnum.Document, document.DocumentId);
             }
         }
         else
         {
             document.ApprovalStatus = afterUpdate.TaskStatus;
             document.ApproveRejectById = UserContextDetails.UserId;
             document.ApproveRejectDate = DateTime.UtcNow;
         }
         eCollabroDbContext.Save();
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// TaskUpdated - Event Handler Raised by WorkflowManager SaveTask 
 /// </summary>
 /// <param name="beforeUpdate"></param>
 /// <param name="afterUpdate"></param>
 public void TaskUpdated(UserTask beforeUpdate, UserTask afterUpdate)
 {
     bool contentUpdateRequired = false;
     string taskNewStatus = afterUpdate.TaskStatus;
     if (!beforeUpdate.TaskStatus.Equals(WorkflowConstants.ApprovedStatus) && afterUpdate.TaskStatus.Equals(WorkflowConstants.ApprovedStatus))
     {
         contentUpdateRequired = true;
     }
     else if (!beforeUpdate.TaskStatus.Equals(WorkflowConstants.RejectedStatus) && afterUpdate.TaskStatus.Equals(WorkflowConstants.RejectedStatus))
     {
         contentUpdateRequired = true;
     }
     if (contentUpdateRequired)
     {
         if (afterUpdate.ContextId.Equals((int)ContextEnum.Blog))
             BlogTaskUpdated(beforeUpdate, afterUpdate);
         else if (afterUpdate.ContextId.Equals((int)ContextEnum.ContentPage))
             ContentPageTaskUpdated(beforeUpdate, afterUpdate);
         else if (afterUpdate.ContextId.Equals((int)ContextEnum.Document))
             DocumentTaskUpdated(beforeUpdate, afterUpdate);
         else if (afterUpdate.ContextId.Equals((int)ContextEnum.Image))
             ImageTaskUpdated(beforeUpdate, afterUpdate);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// ContentPageTaskUpdated - Event Handler Raised by WorkflowManager SaveTask 
 /// </summary>
 /// <param name="beforeUpdate"></param>
 /// <param name="afterUpdate"></param>
 public void ContentPageTaskUpdated(UserTask beforeUpdate, UserTask afterUpdate)
 {
     ContentPage contentPage = eCollabroDbContext.Repository<ContentPage>().Find(afterUpdate.ContexContentId);
     if (contentPage != null)
     {
         TempContentPage contentPageInQueue = _workflowManager.GetFromQueue<TempContentPage>(ContextEnum.ContentPage, contentPage.ContentPageId);
         if (contentPageInQueue != null)// record in queue for pending approval/draft
         {
             contentPageInQueue.ApprovalStatus = afterUpdate.TaskStatus;
             contentPageInQueue.ApproveRejectById = UserContextDetails.UserId;
             contentPageInQueue.ApproveRejectDate = DateTime.UtcNow;
             if (afterUpdate.TaskStatus.Equals(WorkflowConstants.ApprovedStatus))
             {
                 MapContentPageQueueToContentPage(contentPage, contentPageInQueue);
                 _workflowManager.DeleteFromQueue(ContextEnum.ContentPage, contentPage.ContentPageId);
             }
         }
         else
         {
             contentPage.ApprovalStatus = afterUpdate.TaskStatus;
             contentPage.ApproveRejectById = UserContextDetails.UserId;
             contentPage.ApproveRejectDate = DateTime.UtcNow;
         }
         eCollabroDbContext.Save();
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// ImageTaskUpdated - Event Handler Raised by WorkflowManager SaveTask 
 /// </summary>
 /// <param name="beforeUpdate"></param>
 /// <param name="afterUpdate"></param>
 public void ImageTaskUpdated(UserTask beforeUpdate, UserTask afterUpdate)
 {
     SiteImage siteImage = eCollabroDbContext.Repository<SiteImage>().Query().Filter(qry => qry.ImageId.Equals(afterUpdate.ContexContentId)).Include(inc => inc.ImageObject).Get().FirstOrDefault();
     if (siteImage != null)
     {
         TempSiteImage siteImageInQueue = _workflowManager.GetFromQueue<TempSiteImage>(ContextEnum.Image, siteImage.ImageId);
         if (siteImageInQueue != null)// record in queue for pending approval/draft
         {
             siteImageInQueue.ApprovalStatus = afterUpdate.TaskStatus;
             siteImageInQueue.ApproveRejectById = UserContextDetails.UserId;
             siteImageInQueue.ApproveRejectDate = DateTime.UtcNow;
             if (afterUpdate.TaskStatus.Equals(WorkflowConstants.ApprovedStatus))
             {
                 MapImageQueueToImage(siteImage, siteImageInQueue);
                 _workflowManager.DeleteFromQueue(ContextEnum.Image, siteImage.ImageId);
             }
         }
         else
         {
             siteImage.ApprovalStatus = afterUpdate.TaskStatus;
             siteImage.ApproveRejectById = UserContextDetails.UserId;
             siteImage.ApproveRejectDate = DateTime.UtcNow;
         }
         eCollabroDbContext.Save();
     }
 }