only display ‘Create Enhanced’ checkbox on ‘new’
if copied item is not source or enhanced, pasting info a source is more like an ‘insert’ into enhanced.
This commit is contained in:
parent
c035370bb0
commit
c3a749e780
@ -212,19 +212,11 @@ namespace VEPROMS
|
||||
ppCmbxStpEditorCols.ValueMember = "EValue";
|
||||
ppCmbxStpEditorCols.SelectedIndex = -1;
|
||||
|
||||
// if the associated DocVersion has Enhanced, make the Enhanced checkbox visible
|
||||
// the only time the create enhanced checkbox is visisble is if this is a 'New' procedure in a set that is the 'Source'.
|
||||
cbEnhanced.Visible = false;
|
||||
DocVersionConfig dvc = _ProcedureConfig.MyProcedure.MyProcedureInfo.MyDocVersion.MyConfig as DocVersionConfig;
|
||||
if (dvc != null && dvc.MyEnhancedDocuments != null && dvc.MyEnhancedDocuments.Count > 0)
|
||||
{
|
||||
if (dvc.MyEnhancedDocuments.Count > 1 || dvc.MyEnhancedDocuments[0].Type != 0)
|
||||
{
|
||||
cbEnhanced.Visible = true;
|
||||
// if this procedure has enhanced data, the checkbox should not be editable:
|
||||
cbEnhanced.Enabled = !(_ProcedureConfig.MyEnhancedDocuments != null && _ProcedureConfig.MyEnhancedDocuments.Count > 0);
|
||||
cbEnhanced.Checked = (_ProcedureConfig.MyEnhancedDocuments != null && _ProcedureConfig.MyEnhancedDocuments.Count > 0);
|
||||
}
|
||||
}
|
||||
if (_ProcedureConfig.CreatingNew && dvc != null && dvc.MyEnhancedDocuments != null && dvc.MyEnhancedDocuments.Count > 0 && dvc.MyEnhancedDocuments[0].Type != 0)
|
||||
cbEnhanced.Visible = true;
|
||||
_Initializing = false;
|
||||
}
|
||||
|
||||
|
@ -234,6 +234,12 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public Procedure MyProcedure
|
||||
{ get { return _Procedure; } }
|
||||
private bool _CreatingNew = false;
|
||||
public bool CreatingNew
|
||||
{
|
||||
get { return _CreatingNew; }
|
||||
set { _CreatingNew = value; }
|
||||
}
|
||||
#endregion
|
||||
#region ToString
|
||||
public override string ToString()
|
||||
|
@ -1016,6 +1016,28 @@ namespace VEPROMS.CSLA.Library
|
||||
// tmpCopyStartSourceItem is the item that was copied in source.
|
||||
ItemInfo tmpCopyStartSourceItem = ItemInfo.Get(copyStartID);
|
||||
|
||||
// if the copied step is not a 'source', then this really needs to be more of an insert for the enhanced steps.
|
||||
StepConfig stepFromCfg = tmpCopyStartSourceItem.MyConfig as StepConfig;
|
||||
if (stepFromCfg.MyEnhancedDocuments == null || stepFromCfg.MyEnhancedDocuments.Count==0)
|
||||
{
|
||||
// Insert the enhanced steps. Loop through all enhanced document types, insert from
|
||||
// the paste item's linked step.
|
||||
foreach (EnhancedDocument edSource in pasteFromItem.GetMyEnhancedDocuments())
|
||||
{
|
||||
// create a new enhanced step and link it to this new source step.
|
||||
// the new source step's item is used to know what type & what to link to.
|
||||
// The ed.Type & ed.itemid show what type of enhanced document (use to create new
|
||||
// config Type).
|
||||
ItemInfo exEnh = ItemInfo.Get(edSource.ItemID);
|
||||
ItemInfo newEnh = exEnh.InsertEnhancedSteps(tmpCopyStartSourceItem.MyContent.Text, null, addType, MyContent.Type, edSource.Type, this.ItemID);
|
||||
if (newEnh == null) return null;
|
||||
StepConfig sc = new StepConfig(MyContent.Config);
|
||||
sc.AddEnhancedDocument(edSource.Type, newEnh.ItemID);
|
||||
SaveConfig(sc.ToString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// loop through all enhanced document types, pasting in the copied item(s).
|
||||
// Note that the copy/paste finds the enhanced items that relate to source,
|
||||
// i.e. copied item & paste from, and uses those to do the copy/paste.
|
||||
|
Loading…
x
Reference in New Issue
Block a user