private void btnSaveToLeftSide_Click(object sender, EventArgs e) { foreach (IItem rightItem in _rightItemsFound.Values) { IItem leftItem = null; if (_leftItemsFound.TryGetValue(rightItem.ID.ToString(), out leftItem)) { leftItem.CopyTo(rightItem, false, false); } else if (_rightStartItem.GetItem(rightItem.Parent.ID.ToString()) != null) { leftItem = _leftStartItem.GetItem(rightItem.Parent.ID.ToString()); if (leftItem != null) { leftItem.CopyTo(rightItem, true, false); } } } Reset(); }
private void btnTransferFields_Click(object sender, EventArgs e) { string[] sItemList = tbEditorControl.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); _leftStartItem.Options.Language = tbLanguage.Text; _rightStartItem.Options.Language = tbLanguage.Text; foreach (string sPath in sItemList) { IItem srcItem = _leftStartItem.GetItem(sPath); IItem dstItem = _rightStartItem.GetItem(sPath); if ((srcItem == null) || (dstItem == null)) { continue; } tbResult.Text += sPath + "\r\n"; dstItem.CopyTo(srcItem, false, false); /* * foreach (IField field in srcItem.Fields) * { * * if (field.Content.Contains(tbSearchFieldValue.Text)) * { * * IField dstField = Util.GetFieldByName(field.Name, dstItem.Fields); * if (dstField != null) * { * string sTmpContent = SitecoreConverter.Plugins.HtmlToXhtmlPlugin.FixContent(field.Content); * dstField.Content = sTmpContent; * } * * dstItem.Save(); * } * } */ } tbResult.Text += "Finished copying" + "\r\n"; if (Util.WarningList.Count > 0) { ViewTextForm viewTextForm = new ViewTextForm(); viewTextForm.RichEdit.Text = "A number of warnings occurred while copying content, they are: \n"; foreach (string sWarning in Util.WarningList) { viewTextForm.RichEdit.Text += sWarning + "\n"; } viewTextForm.ShowDialog(this); } }