C2020-049-Add-the-ability-for-PROMS-to-remember-the-procedure-tabs-that-were-open-when-you-closed-PROMS-2

This commit is contained in:
2024-10-03 15:11:15 -04:00
parent 297d75a2b3
commit fb7a99653d
4 changed files with 389 additions and 1 deletions

View File

@@ -23904,6 +23904,103 @@ GO
IF (@@Error = 0) PRINT 'Procedure Creation: [PasteItemReplace] Succeeded'
ELSE PRINT 'Procedure Creation: [PasteItemReplace] Error on Creation'
GO
-- SP: AddDisplayTabState
SET QUOTED_IDENTIFIER ON
GO
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[AddDisplayTabState]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [AddDisplayTabState];
GO
-- =============================================
-- Author: Paul Larsen
-- Create date: 9/18/2024
-- Description: Save current open tab state in PROMS editor.
-- =============================================
CREATE PROCEDURE [dbo].[AddDisplayTabState]
(
@ItemID int,
@DisplayTabID varchar(30),
@DisplayTabName varchar(100),
@userID varchar(100),
@order int
)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Remove all records
-- DELETE FROM [dbo].[DisplayTabTmp];
-- Record current tab information
INSERT INTO [dbo].[DisplayTabTmp] (itemid,DisplayTabID,DisplayTabName,userid,active, taborder)
VALUES (@ItemID,@DisplayTabID,@DisplayTabName,@userID, 1, @order)
END
GO
-- SP: GetDisplayTabdata
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[GetDisplayTabdata]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [GetDisplayTabdata];
GO
/****** Object: StoredProcedure [dbo].[GetDisplayTabdata] Script Date: 10/3/2024 11:29:44 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Paul Larsen
-- Create date: 09/18/2024
-- Description: retrieve PROMS edit tab saved state.
-- =============================================
CREATE PROCEDURE [dbo].[GetDisplayTabdata]
(
@UserID varchar(100)
)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
SELECT [ItemID]
,[DisplayTabID]
,[DisplayTabName]
,[UpdateDate]
,[UserID]
,[taborder]
FROM [dbo].[DisplayTabTmp]
WHERE UserID = @UserID AND Active = 1
order by taborder
END
GO
-- SP: DeactivateStateDisplayTabTmp
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DeactivateStateDisplayTabTmp]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [DeactivateStateDisplayTabTmp];
GO
/****** Object: StoredProcedure [dbo].[DeactivateStateDisplayTabTmp] Script Date: 10/3/2024 11:30:53 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Paul Larsen
-- Create date: 10/1/2024
-- Description: Set PROMES Edit window tabs state inactive.
-- =============================================
CREATE procedure [dbo].[DeactivateStateDisplayTabTmp]
(
@UserID varchar(100)
)
AS
UPDATE [dbo].[DisplayTabTmp]
SET Active = 0
WHERE UserID = @UserID
GO
/*
==========================================================================================================
End: C2017-031: SQL to allow copy/replace enhanced step

View File

@@ -1670,16 +1670,36 @@ namespace VEPROMS
return;
}
string stk = Volian.Base.Library.vlnStackTrace.StackToString();
string stk = Volian.Base.Library.vlnStackTrace.StackToString();
if (!stk.Contains("Exception"))
{
// B2018-091 Allow PROMS to close if only MSWord sections have been opened.
// B2019-071 we will now close one or all of the tabs (even step editor ones)
string DisplayTabID = "";
int pos;
int TabItemID;
string DisplayTabName = "";
int cnt = 0;
// Deactivate previous procedure tab state by user
VEPROMS.CSLA.Library.Item.DeactivateStateDisplayTabTmp(MySessionInfo.UserID);
// Save current procedure tab state
foreach (KeyValuePair<string, DisplayTabItem> pgTab in tc._MyDisplayTabItems)
{
cnt++;
DisplayTabID = pgTab.Key;
TabItemID = Int32.Parse(DisplayTabID.Substring(DisplayTabID.IndexOf("Item - ") + 7));
DisplayTabName = pgTab.Value.ToString();
//tc.SelectedDisplayTabItem.MyStepTabPanel.ToString()
VEPROMS.CSLA.Library.Item.AddDisplayTabsState(TabItemID, DisplayTabID, DisplayTabName, MySessionInfo.UserID, cnt);
}
int n = tc._MyDisplayTabItems.Count;
while (n-- > 0 && tc._MyDisplayTabItems.Count > 0)
{
tc.CloseTabItem(tc.SelectedDisplayTabItem);
// B2019-071 close just the current tab and continue working
@@ -2320,6 +2340,27 @@ namespace VEPROMS
CurrentID = txtSearch.Text;
}
}
// Add retrieve displaytabs state here.
openDisplaytabstate();
}
public void openDisplaytabstate()
{
DataTable DisPlayTabState = VEPROMS.CSLA.Library.Item.GetDisplayTabs(VlnSettings.UserID);
if (DisPlayTabState.Rows.Count > 0)
{
foreach (DataRow TabState in DisPlayTabState.Rows)
{
int _ItemID = (int)TabState["ItemID"];
//ItemInfoList _Procedures = ItemInfoList.GetList(_ItemID, (int)E_FromType.Procedure));
ItemInfo _Procedure = ItemInfo.Get(_ItemID);
//ItemInfo.Get
//ItemInfo.Get
OpenItem(_Procedure);
}
}
}
void tc_RefreshEnhancedDocument(object sender, ItemSelectedChangedEventArgs args)