C2020-049-Add-the-ability-for-PROMS-to-remember-the-procedure-tabs-that-were-open-when-you-closed-PROMS
This commit is contained in:
parent
7ca39a4d38
commit
60d7116549
@ -23596,6 +23596,135 @@ BEGIN CATCH -- Catch Block
|
|||||||
EXEC vlnErrorHandler
|
EXEC vlnErrorHandler
|
||||||
END CATCH
|
END CATCH
|
||||||
|
|
||||||
|
GO
|
||||||
|
-- Table: DisplayTabTmp
|
||||||
|
-- If DisplayTabTmp table already exists then don't drop and recreate it
|
||||||
|
IF Not Exists(SELECT * FROM sys.objects Where name = 'DisplayTabTmp' AND type in (N'U'))
|
||||||
|
Begin
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
-- =============================================
|
||||||
|
-- Author: Paul Larsen
|
||||||
|
-- Create date: 9/30/2024
|
||||||
|
-- Description: Table to hold tab state in PROMS editor.
|
||||||
|
-- =============================================
|
||||||
|
/****** Object: Table [dbo].[DisplayTabTmp] Script Date: 10/3/2024 11:22:00 AM ******/
|
||||||
|
|
||||||
|
CREATE TABLE [dbo].[DisplayTabTmp](
|
||||||
|
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||||
|
[ItemID] [int] NOT NULL,
|
||||||
|
[DisplayTabID] [nvarchar](100) NOT NULL,
|
||||||
|
[DisplayTabName] [nchar](100) NOT NULL,
|
||||||
|
[UpdateDate] [datetime] NOT NULL,
|
||||||
|
[UserID] [nchar](100) NOT NULL,
|
||||||
|
[Active] [bit] NOT NULL,
|
||||||
|
[taborder] [int] NOT NULL
|
||||||
|
) ON [PRIMARY]
|
||||||
|
|
||||||
|
ALTER TABLE [dbo].[DisplayTabTmp] ADD CONSTRAINT [DF_DisplayTabTmp_UpdateDate] DEFAULT (getdate()) FOR [UpdateDate]
|
||||||
|
|
||||||
|
ALTER TABLE [dbo].[DisplayTabTmp] ADD CONSTRAINT [DF_DisplayTabTmp_Active] DEFAULT ((1)) FOR [Active]
|
||||||
|
|
||||||
|
ALTER TABLE [dbo].[DisplayTabTmp] ADD DEFAULT ((0)) FOR [taborder]
|
||||||
|
|
||||||
|
End
|
||||||
|
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
|
GO
|
||||||
/*
|
/*
|
||||||
==========================================================================================================
|
==========================================================================================================
|
||||||
@ -23636,8 +23765,8 @@ BEGIN TRY -- Try Block
|
|||||||
DECLARE @RevDate varchar(255)
|
DECLARE @RevDate varchar(255)
|
||||||
DECLARE @RevDescription varchar(255)
|
DECLARE @RevDescription varchar(255)
|
||||||
|
|
||||||
set @RevDate = '07/29/2024 11:24'
|
set @RevDate = '10/03/2024 11:24'
|
||||||
set @RevDescription = 'C2021-059 Add SQL for Admin tool delete folders.'
|
set @RevDescription = 'C2020-049 Add the ability for PROMS to remember the procedure tabs that were open when you closed PROMS.'
|
||||||
|
|
||||||
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||||
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||||
|
@ -1670,16 +1670,36 @@ namespace VEPROMS
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string stk = Volian.Base.Library.vlnStackTrace.StackToString();
|
string stk = Volian.Base.Library.vlnStackTrace.StackToString();
|
||||||
|
|
||||||
if (!stk.Contains("Exception"))
|
if (!stk.Contains("Exception"))
|
||||||
{
|
{
|
||||||
// B2018-091 Allow PROMS to close if only MSWord sections have been opened.
|
// 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)
|
// 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;
|
int n = tc._MyDisplayTabItems.Count;
|
||||||
|
|
||||||
while (n-- > 0 && tc._MyDisplayTabItems.Count > 0)
|
while (n-- > 0 && tc._MyDisplayTabItems.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
tc.CloseTabItem(tc.SelectedDisplayTabItem);
|
tc.CloseTabItem(tc.SelectedDisplayTabItem);
|
||||||
|
|
||||||
// B2019-071 close just the current tab and continue working
|
// B2019-071 close just the current tab and continue working
|
||||||
@ -2320,6 +2340,27 @@ namespace VEPROMS
|
|||||||
CurrentID = txtSearch.Text;
|
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)
|
void tc_RefreshEnhancedDocument(object sender, ItemSelectedChangedEventArgs args)
|
||||||
|
@ -1132,6 +1132,91 @@ namespace VEPROMS.CSLA.Library
|
|||||||
throw new DbCslaException("Item.Add", ex);
|
throw new DbCslaException("Item.Add", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static void DeactivateStateDisplayTabTmp(string UserID)
|
||||||
|
{
|
||||||
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
|
{
|
||||||
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
|
cm.CommandText = "DeactivateStateDisplayTabTmp";
|
||||||
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
|
cm.Parameters.AddWithValue("@UserID", UserID);
|
||||||
|
cm.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemExt.DeactivateStateDisplayTabTmp", ex);
|
||||||
|
throw new DbCslaException("ItemExt.DeactivateStateDisplayTabTmp", ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void AddDisplayTabsState(int itemID, string displayTabID, string displayTabName, string UserID, int order)
|
||||||
|
//private void DataPortal_Fetch(int itemID, string displayTabID, string displayTabName)
|
||||||
|
{
|
||||||
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
|
{
|
||||||
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
|
cm.CommandText = "AddDisplayTabState";
|
||||||
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
|
cm.Parameters.AddWithValue("@ItemID", itemID);
|
||||||
|
cm.Parameters.AddWithValue("@displayTabID", displayTabID);
|
||||||
|
cm.Parameters.AddWithValue("@displayTabName", displayTabName);
|
||||||
|
cm.Parameters.AddWithValue("@UserID", UserID);
|
||||||
|
cm.Parameters.AddWithValue("@order", order);
|
||||||
|
cm.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemExt.AddDisplayTabsState", ex);
|
||||||
|
throw new DbCslaException("ItemExt.AddDisplayTabsState", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static DataTable GetDisplayTabs(string UserID) //, string displayTabID, string displayTabName)
|
||||||
|
//public static void DeactivateStateDisplayTabTmp(string UserID)
|
||||||
|
{
|
||||||
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
|
{
|
||||||
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
|
cm.CommandText = "GetDisplayTabdata";
|
||||||
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
|
cm.Parameters.AddWithValue("@UserID", UserID);
|
||||||
|
//cm.ExecuteNonQuery();
|
||||||
|
SqlDataAdapter da = new SqlDataAdapter(cm);
|
||||||
|
//da.Fill(dt);
|
||||||
|
//cn.Close();
|
||||||
|
//da.Dispose();
|
||||||
|
//return dt; // fix
|
||||||
|
|
||||||
|
SqlDataReader reader = cm.ExecuteReader();
|
||||||
|
DataTable dt = new DataTable();
|
||||||
|
dt.Load(reader);
|
||||||
|
return dt;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemExt.DeactivateStateDisplayTabTmp", ex);
|
||||||
|
throw new DbCslaException("ItemExt.DeactivateStateDisplayTabTmp", ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
[Transactional(TransactionalTypes.TransactionScope)]
|
[Transactional(TransactionalTypes.TransactionScope)]
|
||||||
protected override void DataPortal_Update()
|
protected override void DataPortal_Update()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user