Example #1
0
        public static void Edit([NotNull] ItemUri itemUri, [NotNull] string fieldName, [NotNull] string value)
        {
            Assert.ArgumentNotNull(itemUri, nameof(itemUri));
            Assert.ArgumentNotNull(fieldName, nameof(fieldName));
            Assert.ArgumentNotNull(value, nameof(value));

            ExecuteCompleted callback = delegate(string response, ExecuteResult executeResult)
            {
                if (!DataService.HandleExecute(response, executeResult))
                {
                    return;
                }

                var parts = response.Split(',');

                Guid fieldGuid;
                if (!Guid.TryParse(parts[0], out fieldGuid))
                {
                    return;
                }

                var fieldUri = new FieldUri(new ItemVersionUri(itemUri, LanguageManager.CurrentLanguage, Version.Latest), new FieldId(fieldGuid));

                Notifications.RaiseFieldChanged(fieldUri, fieldUri, value);
            };

            itemUri.DatabaseUri.Site.DataService.ExecuteAsync("Items.SetFieldValue", callback, itemUri.DatabaseUri.DatabaseName.ToString(), itemUri.ItemId.ToString(), LanguageManager.CurrentLanguage.ToString(), Version.Latest.ToString(), fieldName, value);
        }
Example #2
0
        public bool Equals([CanBeNull] FieldUri other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(other.FieldId.Equals(FieldId) && Equals(other.ItemVersionUri, ItemVersionUri));
        }