diff --git a/PROMS/Volian.Controls.Library/DisplayTransition.cs b/PROMS/Volian.Controls.Library/DisplayTransition.cs index d5111417..7cc1ba88 100644 --- a/PROMS/Volian.Controls.Library/DisplayTransition.cs +++ b/PROMS/Volian.Controls.Library/DisplayTransition.cs @@ -561,6 +561,15 @@ namespace Volian.Controls.Library } private void cbTranProcsFillIn(ItemInfo prcitm) { + // B2018-009 - disable the save button if a folder is selected that does not contain procedures + if (prcitm == null) + { + _TreeComboSetHasDV = false; + SaveCancelEnabling(); + return; + } + else + _TreeComboSetHasDV = true; ItemInfo curSelProc = null; if (cbTranProcs.Items.Count > 0) curSelProc = cbTranProcs.SelectedItem as ItemInfo; if (curSelProc != null && prcitm.ItemID == curSelProc.ItemID) return; @@ -699,29 +708,33 @@ namespace Volian.Controls.Library DropDownNode newnode = new DropDownNode(fic.FolderID, fic.ToString()); par.Nodes.Add(newnode); newnode.Tag = fic; - if (fic.HasChildren) // allow for '+' for tree expansion + // B2018-009 Eliminate Working Draft (DocVersions) from the procedure tree for transitions + if (fic.ChildFolderCount > 0) // allow for '+' for tree expansion { DropDownNode tnt = new DropDownNode(0, "VLN_DUMMY"); newnode.Nodes.Add(tnt); } } } - else if (fi.FolderDocVersionCount > 0) - { - foreach (DocVersionInfo dv in fi.FolderDocVersions) - { - if ((VersionTypeEnum)dv.VersionType == VersionTypeEnum.WorkingDraft) - { - DropDownNode newnode = new DropDownNode(dv.VersionID, dv.ToString()); - newnode.Tag = dv; - par.Nodes.Add(newnode); - } - } - } + // B2018-009 Eliminate Working Draft (DocVersions) from the procedure tree for transitions + //else if (fi.FolderDocVersionCount > 0) + //{ + // foreach (DocVersionInfo dv in fi.FolderDocVersions) + // { + // if ((VersionTypeEnum)dv.VersionType == VersionTypeEnum.WorkingDraft) + // { + // DropDownNode newnode = new DropDownNode(dv.VersionID, dv.ToString()); + // newnode.Tag = dv; + // par.Nodes.Add(newnode); + // } + // } + //} } vlnTreeComboSets.Value = par; vlnTreeComboSets.DropDownControl.SelectedNode = par; } + // B2018-009 variable used to disable the save button if a folder is selected does not contain procedures + private bool _TreeComboSetHasDV = false; private void DropDown_FinishEditing(object sender, DropDownValueChangedEventArgs e) { DropDownNode selnd = (DropDownNode)vlnTreeComboSets.DropDownControl.SelectedNode; @@ -739,9 +752,23 @@ namespace Volian.Controls.Library // note that the folder may contain more than one docversion, check for // only 1 working draft. int cntwd = 0; - foreach (DocVersionInfo dvt in fi.FolderDocVersions) + if (fi.FolderDocVersions != null) // B2018-009 Only look for DocVersions if some exist { - if ((VersionTypeEnum)dvt.VersionType == VersionTypeEnum.WorkingDraft) cntwd++; + foreach (DocVersionInfo dvt in fi.FolderDocVersions) + { + if ((VersionTypeEnum)dvt.VersionType == VersionTypeEnum.WorkingDraft) cntwd++; + } + } + else + { + MessageBox.Show("Based on your selection, cannot get list of procedures, Select another folder."); + // disable ALL other controls + cbTranProcs.Enabled = false; + cbTranSects.Enabled = false; + tvTran.Enabled = false; + // B2018-009 - disable the save button if a folder is selected that does not contain procedures + cbTranProcsFillIn(null); + return; } if (cntwd == 1) defines_set = true; } @@ -755,6 +782,8 @@ namespace Volian.Controls.Library cbTranProcs.Enabled = false; cbTranSects.Enabled = false; tvTran.Enabled = false; + // B2018-009 - disable the save button if a folder is selected that does not contain procedures + cbTranProcsFillIn(null); return; } @@ -781,6 +810,8 @@ namespace Volian.Controls.Library cbTranProcs.Enabled = false; cbTranSects.Enabled = false; tvTran.Enabled = false; + // B2018-009 - disable the save button if a folder is selected that does not contain procedures + cbTranProcsFillIn(null); return; } cbTranProcsFillIn(dv.Procedures[0]); @@ -1054,7 +1085,8 @@ namespace Volian.Controls.Library bool hasChanged = SettingsChanged; bool isenh = MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep; // B2018-002 - Invalid Transitions - Set button enabled if it has a default section or it doesn't need a default - btnTranSave.Enabled = (HasDefault || !NeedsDefault) && !isenh && hasChanged && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons + // B2018-009 - Don't enable the save button if a folder is selected that does not contain procedures + btnTranSave.Enabled = _TreeComboSetHasDV && (HasDefault || !NeedsDefault) && !isenh && hasChanged && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons btnTranCancel.Enabled = _CurTrans != null && hasChanged; groupPanelTranFmt.Text = (!HasDefault && NeedsDefault) ? "Requires Default" : "Select Format"; // B2018-002 - Invalid Transitions - Set tool tip based upon HasDefault and NeedsDefault diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index dc783811..95f71680 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -1064,6 +1064,8 @@ namespace Volian.Controls.Library // else do a after from current HLS - if not at HLS, go up parents until find it. else if (fromtype == 0 && !_MyEditItem.MyItemInfo.IsStepSection) { + if (_MyEditItem.MyItemInfo.IsTable) // B2018-005 Save Current Changes to the table + _MyEditItem.MyParentEditItem.Select(); // High Level Step EditItem hlsEditItem = _MyEditItem; while (!hlsEditItem.MyItemInfo.IsHigh) hlsEditItem = hlsEditItem.ActiveParent; @@ -1071,8 +1073,8 @@ namespace Volian.Controls.Library } else if (contenttype == 21040) { - if (_MyEditItem.MyItemInfo.IsTable) // B2018-005 Save Current Changes to the table - _MyEditItem.MyParentEditItem.Select(); + if (_MyEditItem.MyItemInfo.IsTable) // B2018-005 Save Current Changes to the table + _MyEditItem.MyParentEditItem.Select(); // SupInfo _MyEditItem.AddChild((E_FromType)fromtype, 20040); } else if (InsertingTable(contenttype)) @@ -1365,15 +1367,15 @@ namespace Volian.Controls.Library } private void btnInsBefore_Click(object sender, EventArgs e) { - if (_MyEditItem.MyItemInfo.IsTable) // B2018-005 Save Current Changes to the table - _MyEditItem.MyParentEditItem.Select(); + if (_MyEditItem.MyItemInfo.IsTable) // B2018-005 Save Current Changes to the table + _MyEditItem.MyParentEditItem.Select(); // Previous _MyEditItem.AddSiblingBefore(); } private void btnInsAfter_Click(object sender, EventArgs e) { - if (_MyEditItem.MyItemInfo.IsTable) // B2018-005 Save Current Changes to the table - _MyEditItem.MyParentEditItem.Select(); + if (_MyEditItem.MyItemInfo.IsTable) // B2018-005 Save Current Changes to the table + _MyEditItem.MyParentEditItem.Select(); // Next _MyEditItem.AddSiblingAfter(); } /// @@ -3539,16 +3541,16 @@ namespace Volian.Controls.Library { StepTabPanel tmp = Parent as StepTabPanel; if (tmp.MyDisplayTabControl.MyCopyStep == null) return; - if (_MyEditItem.MyItemInfo.IsTable) // B2018-005 Save Current Changes to the table - _MyEditItem.MyParentEditItem.Select(); + if (_MyEditItem.MyItemInfo.IsTable) // B2018-005 Save Current Changes to the table + _MyEditItem.MyParentEditItem.Select(); // Paste After MyEditItem.PasteSiblingAfter(tmp.MyDisplayTabControl.MyCopyStep.ItemID); } private void btnPasteBefore_Click(object sender, EventArgs e) { StepTabPanel tmp = Parent as StepTabPanel; if (tmp.MyDisplayTabControl.MyCopyStep == null) return; - if (_MyEditItem.MyItemInfo.IsTable) // B2018-005 Save Current Changes to the table - _MyEditItem.MyParentEditItem.Select(); + if (_MyEditItem.MyItemInfo.IsTable) // B2018-005 Save Current Changes to the table + _MyEditItem.MyParentEditItem.Select(); // Paste Before MyEditItem.PasteSiblingBefore(tmp.MyDisplayTabControl.MyCopyStep.ItemID); } private void btnStepPaste_Click(object sender, EventArgs e)