protected void Update() { int id = -1; int.TryParse(btnUpdateMultiTypeItem.CommandArgument, out id); if (XmlItems.ContainsKey(id)) { var xmlItem = XmlItems[id]; XmlDocument doc = new XmlDocument(); XmlNode item = doc.CreateElement("Item"); XmlAttribute xmlId = doc.CreateAttribute("id"); xmlId.Value = xmlItem.Id.ToString(); item.Attributes.Append(xmlId); XmlAttribute xmlSortId = doc.CreateAttribute("sortId"); xmlSortId.Value = xmlItem.SortId.ToString(); item.Attributes.Append(xmlSortId); XmlItems[id] = new XmlItem() { Id = xmlItem.Id, SortId = xmlItem.SortId, Aliases = editMultiTypeControl.Save(item) }; if (SaveDataEditor != null) { SaveDataEditor(); } Close(); } }
protected void Add() { int id = NewId(); int sortId = NewSortId(); XmlItem xmlItem = new XmlItem() { Id = id, SortId = sortId }; xmlItem.Aliases = editMultiTypeControl.Save(xmlItem.GetXmlItem()); XmlItems.Add(id, xmlItem); var multiTypeDataEditorItemControl = (MultiTypeDataEditorItemControl)Page.LoadControl("~/umbraco/plugins/MultiType4Ben/MultiTypeDataEditorItemControl.ascx"); multiTypeDataEditorItemControl.Id = id; multiTypeDataEditorItemControl.SortId = sortId; multiTypeDataEditorItemControl.MacroId = MacroId; multiTypeDataEditorItemControl.Items = XmlItems[id].Aliases; multiTypeDataEditorItemControl.MultiTypes = MultiTypeByAlias; multiTypeDataEditorItemControl.Delete += new MultiTypeDataEditorItemControl.DataEditorItemButton(Delete); multiTypeDataEditorItemControl.Edit += new MultiTypeDataEditorItemControl.DataEditorItemButton(Edit); multiTypeDataEditorItemControl.Visible = false; MultiTypeDataEditorItemControls.Add(id, multiTypeDataEditorItemControl); pnlMultiTypes.Controls.Add(multiTypeDataEditorItemControl); if (SaveDataEditor != null) { SaveDataEditor(); } Close(); }
protected void Update() { int id = -1; int.TryParse(btnUpdateMultiTypeItem.CommandArgument, out id); if (XmlItems.ContainsKey(id)){ var xmlItem = XmlItems[id]; XmlDocument doc = new XmlDocument(); XmlNode item = doc.CreateElement("Item"); XmlAttribute xmlId = doc.CreateAttribute("id"); xmlId.Value = xmlItem.Id.ToString(); item.Attributes.Append(xmlId); XmlAttribute xmlSortId = doc.CreateAttribute("sortId"); xmlSortId.Value = xmlItem.SortId.ToString(); item.Attributes.Append(xmlSortId); XmlItems[id] = new XmlItem() { Id = xmlItem.Id, SortId = xmlItem.SortId, Aliases = editMultiTypeControl.Save(item) }; if (SaveDataEditor != null) { SaveDataEditor(); } Close(); } }
protected void Add() { int id = NewId(); int sortId = NewSortId(); XmlItem xmlItem = new XmlItem() { Id = id, SortId = sortId }; xmlItem.Aliases = editMultiTypeControl.Save(xmlItem.GetXmlItem()); XmlItems.Add(id, xmlItem); var multiTypeDataEditorItemControl = (MultiTypeDataEditorItemControl)Page.LoadControl("~/umbraco/plugins/MultiType4Ben/MultiTypeDataEditorItemControl.ascx"); multiTypeDataEditorItemControl.Id = id; multiTypeDataEditorItemControl.SortId = sortId; multiTypeDataEditorItemControl.MacroId = MacroId; multiTypeDataEditorItemControl.Items = XmlItems[id].Aliases; multiTypeDataEditorItemControl.MultiTypes = MultiTypeByAlias; multiTypeDataEditorItemControl.Delete += new MultiTypeDataEditorItemControl.DataEditorItemButton(Delete); multiTypeDataEditorItemControl.Edit += new MultiTypeDataEditorItemControl.DataEditorItemButton(Edit); multiTypeDataEditorItemControl.Visible = false; MultiTypeDataEditorItemControls.Add(id, multiTypeDataEditorItemControl); pnlMultiTypes.Controls.Add(multiTypeDataEditorItemControl); if (SaveDataEditor != null) { SaveDataEditor(); } Close(); }