public T Add <T>(Form parentForm, XCollection <T> list) where T : MappingItem, IDicomMappingItem, new() { T selitem = GetSelectedItem() as T; FormElement2 <T> frm = new FormElement2 <T>(null, list, selitem, false, _gwDataDBConnection, _log, _asQueryResult, _isInbound); BeforeShowFormElement(ButtonType.Add, frm, selitem); if (frm.ShowDialog(parentForm) != DialogResult.OK) { return(null); } AfterShowFormElement(ButtonType.Add, frm, selitem); T newitem = frm.MappingItem; if (newitem == null) { return(null); } if (selitem == null) { list.Add(newitem); } else { newitem.DPath.Catagory = selitem.DPath.Catagory; int index = list.IndexOf(selitem); list.Insert(index, newitem); } return(newitem); }
public T AddChild <T>(Form parentForm, XCollection <T> list) where T : MappingItem, IDicomMappingItem, new() { T selitem = GetSelectedItem() as T; if (selitem == null || selitem.DPath.VR != DVR.SQ) { return(null); } FormElement2 <T> frm = new FormElement2 <T>(null, list, selitem, true, _gwDataDBConnection, _log, _asQueryResult, _isInbound); BeforeShowFormElement(ButtonType.AddChild, frm, selitem); if (frm.ShowDialog(parentForm) != DialogResult.OK) { return(null); } AfterShowFormElement(ButtonType.AddChild, frm, selitem); T newitem = frm.MappingItem; if (newitem == null) { return(null); } int index = list.IndexOf(selitem); bool hasChild = DicomMappingHelper.HasSequence <T>(index, list); if (hasChild == false) { T iBegin = new T(); DPath.SetItemGroupPathBegin(iBegin.DPath, 0); T iEnd = new T(); DPath.SetItemGroupPathEnd(iEnd.DPath, 0); int sqIndex = index + 1; list.Insert(sqIndex++, iBegin); list.Insert(sqIndex, iEnd); } if (DicomMappingHelper.FindEndDPathIndex <T>(ref index, list)) { newitem.DPath.Catagory = selitem.DPath.Catagory; list.Insert(index, newitem); } return(newitem); }
public T Edit <T>(Form parentForm, XCollection <T> list) where T : MappingItem, IDicomMappingItem, new() { T selitem = GetSelectedItem() as T; if (selitem == null) { return(null); } FormElement2 <T> frm = new FormElement2 <T>(selitem, list, selitem, false, _gwDataDBConnection, _log, _asQueryResult, _isInbound); BeforeShowFormElement(ButtonType.Edit, frm, selitem); if (frm.ShowDialog(parentForm) != DialogResult.OK) { return(null); } AfterShowFormElement(ButtonType.Edit, frm, selitem); return(selitem); }
protected virtual void AfterShowFormElement <T>(ButtonType type, FormElement2 <T> form, T obj) where T : MappingItem, IDicomMappingItem, new() { }