Esempio n. 1
0
        public void ApproveContent(Guid siteGuid, Guid approvalUserGuid)
        {
            // get latest workflow record waiting for approval
            ContentWorkflow submittedContent = ContentWorkflow.GetWorkInProgress(this.moduleGuid, ContentWorkflowStatus.AwaitingApproval.ToString());

            if (submittedContent == null)
            {
                return;
            }

            // create a new content history record of the existing live content
            ContentHistory history = new ContentHistory();

            history.ContentGuid = ModuleGuid;
            history.ContentText = Body;
            history.SiteGuid    = siteGuid;
            history.UserGuid    = LastModUserGuid;
            history.CreatedUtc  = LastModUtc;
            history.Save();

            //update the html with the approved content
            this.body            = submittedContent.ContentText;
            this.lastModUserGuid = submittedContent.LastModUserGuid;
            this.lastModUtc      = DateTime.UtcNow;
            this.Save();

            //update content workflow to show record is now approved
            submittedContent.Status          = ContentWorkflowStatus.Approved;
            submittedContent.LastModUserGuid = approvalUserGuid;
            submittedContent.LastModUtc      = DateTime.UtcNow;
            submittedContent.Save();
        }
Esempio n. 2
0
        public static ContentWorkflow CreateDraftVersion(
            Guid siteGuid,
            string contentText,
            string customData,
            int customReferenceNumber,
            Guid customReferenceGuid,
            Guid moduleGuid,
            Guid userGuid)
        {
            ContentWorkflow draftVersion = new ContentWorkflow();

            draftVersion.moduleGuid            = moduleGuid;
            draftVersion.contentText           = contentText;
            draftVersion.customData            = customData;
            draftVersion.customReferenceNumber = customReferenceNumber;
            draftVersion.customReferenceGuid   = customReferenceGuid;
            draftVersion.siteGuid        = siteGuid;
            draftVersion.userGuid        = userGuid;
            draftVersion.lastModUserGuid = userGuid;
            draftVersion.createdDateUtc  = DateTime.UtcNow;
            draftVersion.status          = ContentWorkflowStatus.Draft;
            draftVersion.Save();

            return(draftVersion);
        }