コード例 #1
0
        private void CloneItem(Item sourceItem, Item destinatonSite, NameValueCollection targets)
        {
            var destination = sourceItem.GetDestinationItem(destinatonSite);

            if (destination == null)
            {
                throw new ClientAlertException("Parent Item on Mall Site is not exists.");
            }
            var newItem = BucketManager.IsItemContainedWithinBucket(sourceItem)
                ? BucketManager.CloneItem(sourceItem, destination, true)
                : sourceItem.CloneTo(destination);

            targets.Add(newItem.GetSiteItem().ID.ToShortID().ToString(), newItem.ID.Guid.ToString().ToUpper());
            newItem.Editing.BeginEdit();
            newItem.Fields[HiddenFields.Templates.HiddenField.Fields.SourceId].SetValue(sourceItem.ID.ToString(), true);
            newItem.Fields[Templates.MainSiteSetting.Fields.MallSites].SetValue(string.Empty, true);
            newItem.Editing.EndEdit();
        }