Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="articleStruct"></param>
        /// <param name="prompt"></param>
        /// <returns>True if local document is up-to-date; else false</returns>
        public bool CheckWordDocVersion(ArticleStruct articleStruct, bool prompt = true)
        {
            int localWordDocVersion = _documentCustomProperties.WordSitecoreVersionNumber;

            int sitecoreWordDocVersion = articleStruct.WordDocVersionNumber;

            SetArticleVersionInformation(articleStruct, (sitecoreWordDocVersion > localWordDocVersion));
            if ((sitecoreWordDocVersion > localWordDocVersion))
            { //we're out of date!
                if (prompt)
                {
                    string message =
                        "A newer version of this article  was uploaded on {0} by {1}. " +
                        "If you continue using this version, you may overwrite more recent " +
                        "changes. To get the most recent version, navigate to Sitecore to download the new document.";

                    MessageBox.Show
                        (String.Format(message, articleStruct.WordDocLastUpdateDate, articleStruct.WordDocLastUpdatedBy),
                        @"Informa",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Exclamation);
                }
                return(false);
            }
            return(true);
        }
Ejemplo n.º 2
0
        public void SetArticleVersionInformation(ArticleStruct articleStruct, bool outOfDate)
        {
            if (outOfDate)
            {
                Color color = (Color) new ColorConverter().ConvertFromString("#F4CCCC");
                _parent.articleStatusBar1.uxVersionStateButton.BackColor   = color;
                _parent.articleStatusBar1.uxVersionStateButton.ToolTipText = "More Recent Version Available. Download it from Sitecore. Click for more information.";
                _parent.articleStatusBar1.uxVersionStateButton.Text        = "Out of Date";


                //uxVersionStatus.BackColor = Color.FromArgb(255, 244, 204, 204);
                //_parent.articleStatusBar1.uxVersionStateButton.BackColor = Color.FromArgb(255, 244, 204, 204);

                //uxVersionText.Text = @"More Recent Version Available";
                //uxVersionText.Font = new Font(uxVersionText.Font, FontStyle.Italic | FontStyle.Bold);
            }
            else
            {
                Color color = (Color) new ColorConverter().ConvertFromString("#d9ead3");
                _parent.articleStatusBar1.uxVersionStateButton.BackColor   = color;
                _parent.articleStatusBar1.uxVersionStateButton.ToolTipText = "Document Content is Up To Date. Click for more information.";
                _parent.articleStatusBar1.uxVersionStateButton.Text        = "Up To Date";
                //uxVersionStatus.BackColor = Color.FromArgb(255, 217, 234, 211);
                //uxVersionText.Text = @"Document Content is Up To Date";
                //uxVersionText.Font = new Font(uxVersionText.Font, FontStyle.Bold);
            }

            //uxLastUpdateDate.Text = articleStruct.WordDocLastUpdateDate;
            //uxLastUpdatedBy.Text = FormatUserName(articleStruct.WordDocLastUpdatedBy);
        }
Ejemplo n.º 3
0
        public void UpdateFields(ArticleStruct articleDetails)
        {
            InitializePublications();
            InitializeMediaType();
            InitializeContentType();
            SetCheckedOutStatus();
            if (string.IsNullOrEmpty(articleDetails.ArticleNumber))
            {
                return;
            }
            uxPublication.SelectedValue = articleDetails.Publication;
            if (articleDetails.Authors != null)
            {
                uxSelectedAuthors.PopulateRegular(articleDetails.Authors.Select(r => new StaffStruct {
                    ID = r.ID, Name = r.Name
                }).ToList());
            }

            //uxArticleNumberLabel.Text = articleDetails.ArticleNumber;
            if (articleDetails.WebPublicationDate > DateTime.MinValue)
            {
                SetPublicationTime(articleDetails.WebPublicationDate, true);
            }

            ArticleNumber              = articleDetails.ArticleNumber;
            ArticleGuid                = articleDetails.ArticleGuid;
            IsPublished                = articleDetails.IsPublished;
            uxEmbargoed.Checked        = articleDetails.Embargoed;
            uxMediaTypes.SelectedValue = articleDetails.MediaType;
            uxLabel.SelectedValue      = articleDetails.Label;
            uxNotes.Text               = articleDetails.NotesToEditorial;
            CheckWordDocVersion(articleDetails);

            _isLive = articleDetails.IsPublished;
            label1.Refresh();
        }