public void SimpleCompare(string database, string itemId)
        {
            try
            {
                using (new SecurityDisabler())
                {
                    Status = new List <Tuple <string, string> >();
                    var localItem = _sitecoreAccessService.GetLatestItemData(itemId, database);
                    if (localItem == null)
                    {
                        Status.Add(new Tuple <string, string>("cmmissing", "This content item only exists on the remote server."));
                        return;
                    }
                    var localChecksum = _checksumManager.GetChecksum(localItem.Id.ToString());
                    ChildChanged = localChecksum != -1 && Checksum != localChecksum;
                    CompareContentTreeNode local = new CompareContentTreeNode(localItem);
                    if (Revision != local.Revision)
                    {
                        Status.Add(new Tuple <string, string>("cmfieldchanged", "This content item exists on the local server, however the fields have different values."));
                    }
                    else
                    {
                        Status.Add(new Tuple <string, string>("cmequal", "This content item is equivalent on the source and target servers."));
                    }
                    if (ChildChanged)
                    {
                        Status.Add(new Tuple <string, string>("cmchildchanged", "There are changes in the children of this item."));
                    }
                    HashSet <string> tracker = new HashSet <string>();

                    foreach (ContentTreeNode child in Nodes)
                    {
                        tracker.Add(child.Id);
                    }

                    foreach (IItemData child in _sitecoreAccessService.GetChildren(localItem))
                    {
                        if (tracker.Contains(child.Id.ToString()))
                        {
                            continue;
                        }
                        var newnode = new CompareContentTreeNode(child, false)
                        {
                            Status = new List <Tuple <string, string> >
                            {
                                new Tuple <string, string>("cmextra", "This item only exists on the local server.")
                            },
                            MissingRemote = true
                        };
                        Nodes.Add(newnode);
                    }
                }
            }
            catch (Exception e)
            {
                Log.Error("Problem assembling diff for " + itemId, e, this);
            }
        }
예제 #2
0
        public dynamic GetLocationFromXml(XmlNode arg, Database db)
        {
            var     node     = new ContentTreeNode(_sitecoreDataAccessService.GetLatestItemData(arg.Attributes?["id"]?.InnerText));
            dynamic location = new ExpandoObject();

            location.item        = node;
            location.description = arg.Attributes?["description"]?.InnerText;
            return(location);
        }