B2017-230 Added a stored procedure and function to check for the usage of a given applicability.

B2017-230 added references to working draft property page to all applicability usage check results to appear in the Search panel results pane.
B2017-230 Added a check for the usage of the applicability that the user wants to remove.
This commit is contained in:
2018-09-27 15:11:09 +00:00
parent e5938b1815
commit bd265442d3
3 changed files with 187 additions and 3 deletions

View File

@@ -2675,7 +2675,13 @@ namespace VEPROMS
int ownerID = MySessionInfo.CheckOutItem(args.DocVersionConfig.MyDocVersion.VersionID, CheckOutType.DocVersion);
frmVersionsProperties frmver = new frmVersionsProperties(args.DocVersionConfig);
frmver.ProgressBar = bottomProgBar;
frmver.DisplaySearch1 = displaySearch1; //B2017-230 provide access to global search
dr = frmver.ShowDialog();
if (frmver._showApplicSearchResults) //B2017-230 open global search with places that specifiy the applicabilty that the user tried to delete
{
toolsPanel.Expanded = true;
toolsTabs.SelectedTab = toolstabResults;
}
MySessionInfo.CheckInItem(ownerID);
}
else if (args.ProcedureConfig != null)

View File

@@ -39,6 +39,14 @@ namespace VEPROMS
private string _DefaultChgBarUsrMsg2 = null;
private bool _DefaultDisableDuplex = false;
private DisplaySearch _DisplaySearch1 = null;
public DisplaySearch DisplaySearch1
{
get { return _DisplaySearch1; }
set { _DisplaySearch1 = value; }
}
// For the initial release, we are assuming there will be only one rofst for a docversion. Changes
// will be needed here if more than 1.
private ROFstInfo _SelectedROFst;
@@ -1376,10 +1384,34 @@ namespace VEPROMS
bsApples.DataSource = _Apples;
lbApplicabilities.SelectedItem = cfg;
}
public bool _showApplicSearchResults = false;
private bool ApplicIsUsed(MiniConfig cfg) // B2017-230 - don't allow user to remove an applicability that is being used (specified)
{
if (_showApplicSearchResults)
{
_showApplicSearchResults = false;
_DisplaySearch1.SearchResults = null;
}
Cursor.Current = Cursors.WaitCursor;
ItemInfoList placesUsed = ItemInfoList.GetListFromApplicabilitySearch(_DocVersionConfig.MyDocVersion.VersionID.ToString(), "", "", 0, ItemSearchIncludeLinks.Nothing, false, false, "", cfg.Index.ToString());
Cursor.Current = Cursors.Default;
if (placesUsed != null && placesUsed.Count > 0)
{ // B2017-230 give user option to save the locations in Global Search results
if (MessageBox.Show(string.Format("Cannot remove an Applicability that is being use in {0} places.\n\nDo you want to view locations via Search Results?\n\nThe Search panel will open when you exit the property page.",placesUsed.Count), "Applicability In Use", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
_showApplicSearchResults = true;
_DisplaySearch1.SearchResults = placesUsed;
_DisplaySearch1.ReportTitle = string.Format("{0} Applicability", cfg.Name);
_DisplaySearch1.TypesSelected = string.Format("These Locations Specify The \"{0}\" Applicability", cfg.Name);
}
return true;
}
return false;
}
private void btnDelApple_Click(object sender, EventArgs e)
{
MiniConfig cfg = bsApples.Current as MiniConfig;
if (MessageBox.Show(string.Format("Are you sure you want to delete {0}", cfg.Name), "Confirm Delete", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
if (!ApplicIsUsed(cfg) && MessageBox.Show(string.Format("Are you sure you want to delete {0}", cfg.Name), "Confirm Delete", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
{
if (_DeletedApples == null)
_DeletedApples = new List<MiniConfig>();