示例#1
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 ///   AddHtmlTextLog creates a new HtmlTextLog for an Item
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <param name = "objHtmlTextLog">An HtmlTextLogInfo object</param>
 /// -----------------------------------------------------------------------------
 public void AddHtmlTextLog(HtmlTextLogInfo objHtmlTextLog)
 {
     DataProvider.Instance().AddHtmlTextLog(objHtmlTextLog.ItemID, objHtmlTextLog.StateID, objHtmlTextLog.Comment, objHtmlTextLog.Approved, UserController.Instance.GetCurrentUserInfo().UserID);
 }
示例#2
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 ///   GetHtmlTextLog retrieves a collection of HtmlTextLogInfo objects for an Item
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <param name = "ItemID">The Id of the Item</param>
 /// -----------------------------------------------------------------------------
 public ArrayList GetHtmlTextLog(int ItemID)
 {
     return(CBO.FillCollection(DataProvider.Instance().GetHtmlTextLog(ItemID), typeof(HtmlTextLogInfo)));
 }
 /// -----------------------------------------------------------------------------
 /// <summary>
 ///   GetHtmlText gets the HtmlTextInfo object for the Module, Item, and Workflow
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <param name = "ModuleID">The ID of the Module</param>
 /// <param name = "ItemID">The ID of the Item</param>
 public HtmlTextInfo GetHtmlText(int ModuleID, int ItemID)
 {
     return(CBO.FillObject <HtmlTextInfo>(DataProvider.Instance().GetHtmlText(ModuleID, ItemID)));
 }
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   UpdateHtmlText creates a new HtmlTextInfo object or updates an existing HtmlTextInfo object
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name = "htmlContent">An HtmlTextInfo object</param>
        /// <param name = "MaximumVersionHistory">The maximum number of versions to retain</param>
        public void UpdateHtmlText(HtmlTextInfo htmlContent, int MaximumVersionHistory)
        {
            var  _workflowStateController = new WorkflowStateController();
            bool blnCreateNewVersion      = false;

            // determine if we are creating a new version of content or updating an existing version
            if (htmlContent.ItemID != -1)
            {
                if (htmlContent.WorkflowName != "[REPAIR_WORKFLOW]")
                {
                    HtmlTextInfo objContent = GetTopHtmlText(htmlContent.ModuleID, false, htmlContent.WorkflowID);
                    if (objContent != null)
                    {
                        if (objContent.StateID == _workflowStateController.GetLastWorkflowStateID(htmlContent.WorkflowID))
                        {
                            blnCreateNewVersion = true;
                        }
                    }
                }
            }
            else
            {
                blnCreateNewVersion = true;
            }

            // determine if content is published
            if (htmlContent.StateID == _workflowStateController.GetLastWorkflowStateID(htmlContent.WorkflowID))
            {
                htmlContent.IsPublished = true;
            }
            else
            {
                htmlContent.IsPublished = false;
            }

            if (blnCreateNewVersion)
            {
                // add content
                htmlContent.ItemID = DataProvider.Instance().AddHtmlText(htmlContent.ModuleID,
                                                                         htmlContent.Content,
                                                                         htmlContent.Summary,
                                                                         htmlContent.StateID,
                                                                         htmlContent.IsPublished,
                                                                         UserController.Instance.GetCurrentUserInfo().UserID,
                                                                         MaximumVersionHistory);
            }
            else
            {
                // update content
                DataProvider.Instance().UpdateHtmlText(htmlContent.ItemID, htmlContent.Content, htmlContent.Summary, htmlContent.StateID, htmlContent.IsPublished, UserController.Instance.GetCurrentUserInfo().UserID);
            }

            // add log history
            var logInfo = new HtmlTextLogInfo();

            logInfo.ItemID   = htmlContent.ItemID;
            logInfo.StateID  = htmlContent.StateID;
            logInfo.Approved = htmlContent.Approved;
            logInfo.Comment  = htmlContent.Comment;
            var objLogs = new HtmlTextLogController();

            objLogs.AddHtmlTextLog(logInfo);

            // create user notifications
            CreateUserNotifications(htmlContent);

            // refresh output cache
            ModuleController.SynchronizeModule(htmlContent.ModuleID);
        }
 /// -----------------------------------------------------------------------------
 /// <summary>
 ///   GetAllHtmlText gets a collection of HtmlTextInfo objects for the Module and Workflow
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <param name = "ModuleID">The ID of the Module</param>
 public List <HtmlTextInfo> GetAllHtmlText(int ModuleID)
 {
     return(CBO.FillCollection <HtmlTextInfo>(DataProvider.Instance().GetAllHtmlText(ModuleID)));
 }