Merge pull request 'C2020-049-Add-the-ability-for-PROMS-to-remember-the-procedure-tabs-that-were-open-when-you-closed-PROMS-2' (#418) from C2020-049-Add-the-ability-for-PROMS-to-remember-the-procedure-tabs-that-were-open-when-you-closed-PROMS-2 into Development
Code looked good. Ready for QA Testing.
This commit is contained in:
commit
a73a8fb993
@ -23904,6 +23904,103 @@ GO
|
|||||||
IF (@@Error = 0) PRINT 'Procedure Creation: [PasteItemReplace] Succeeded'
|
IF (@@Error = 0) PRINT 'Procedure Creation: [PasteItemReplace] Succeeded'
|
||||||
ELSE PRINT 'Procedure Creation: [PasteItemReplace] Error on Creation'
|
ELSE PRINT 'Procedure Creation: [PasteItemReplace] Error on Creation'
|
||||||
GO
|
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
|
End: C2017-031: SQL to allow copy/replace enhanced step
|
||||||
|
@ -1676,10 +1676,30 @@ namespace VEPROMS
|
|||||||
{
|
{
|
||||||
// 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)
|
||||||
|
@ -8004,6 +8004,171 @@ namespace VEPROMS.CSLA.Library
|
|||||||
MyContent.Config = _ProcedureConfig.ToString();
|
MyContent.Config = _ProcedureConfig.ToString();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
public class DisplayTabs
|
||||||
|
{
|
||||||
|
private int _ItemID;
|
||||||
|
public int ItemID
|
||||||
|
{
|
||||||
|
get { return _ItemID; }
|
||||||
|
set { _ItemID = value; }
|
||||||
|
|
||||||
|
}
|
||||||
|
private string _DisplayTabID;
|
||||||
|
public string DisplayTabID
|
||||||
|
{
|
||||||
|
get { return _DisplayTabID; }
|
||||||
|
set { _DisplayTabID = value; }
|
||||||
|
}
|
||||||
|
private string _DisplayTabName;
|
||||||
|
public string DisplayTabName
|
||||||
|
{
|
||||||
|
get { return _DisplayTabName; }
|
||||||
|
set { _DisplayTabName = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public SafeDataReader Dr { get; }
|
||||||
|
|
||||||
|
public DisplayTabs()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public DisplayTabs(int itemID, String displayTabID, String displayTabName)
|
||||||
|
{
|
||||||
|
_ItemID = itemID;
|
||||||
|
_DisplayTabID = displayTabID;
|
||||||
|
_DisplayTabName = displayTabName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DisplayTabs(SafeDataReader dr)
|
||||||
|
{
|
||||||
|
Dr = dr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static DataTable GetDisplayTabs(int itemID) //, string displayTabID, string displayTabName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DataTable tmp = DataPortal.Fetch<DataTable>(new DisplayTabs(itemID, "", "")); //, displayTabID, displayTabName));
|
||||||
|
//ItemInfo.AddList(tmp);
|
||||||
|
//tmp.AddEvents();
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new DbCslaException("Error on ItemInfoList.GetChildren", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private DataTable dt = new DataTable();
|
||||||
|
private DataTable DataPortal_Fetch(DisplayTabs criteria)
|
||||||
|
{
|
||||||
|
|
||||||
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
|
{
|
||||||
|
using (SqlCommand cm = cn.CreateCommand())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
|
cm.CommandText = "GetDisplayTabData";
|
||||||
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
|
SqlDataAdapter da = new SqlDataAdapter(cm);
|
||||||
|
da.Fill(dt);
|
||||||
|
cn.Close();
|
||||||
|
da.Dispose();
|
||||||
|
return dt;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemExt.DataPortal_Fetch", ex);
|
||||||
|
throw new DbCslaException("ItemExt.DataPortal_Fetch", ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//public static void AddDisplayTabsState(int itemID, string displayTabID, string displayTabName)
|
||||||
|
//{
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// //DisplayTabs tmp =
|
||||||
|
// DataPortal.Fetch<DisplayTabs>(new DisplayTabs(itemID, displayTabID, displayTabName)); //, displayTabID, displayTabName));
|
||||||
|
// //ItemInfo.AddList(tmp);
|
||||||
|
// //tmp.AddEvents();
|
||||||
|
// //return tmp;
|
||||||
|
// }
|
||||||
|
// catch (Exception ex)
|
||||||
|
// {
|
||||||
|
// throw new DbCslaException("Error on ItemInfoList.GetChildren", ex);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//private DataTable dt = new DataTable();
|
||||||
|
//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.ExecuteNonQuery();
|
||||||
|
// //SqlDataAdapter da = new SqlDataAdapter(cm);
|
||||||
|
// //da.Fill(dt);
|
||||||
|
// //cn.Close();
|
||||||
|
// //da.Dispose();
|
||||||
|
// //return dt; // fix
|
||||||
|
// }
|
||||||
|
// catch (Exception ex)
|
||||||
|
// {
|
||||||
|
// //if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemExt.DataPortal_Fetch", ex);
|
||||||
|
// throw new DbCslaException("ItemExt.DataPortal_Fetch", ex);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
|
public static void AddDisplayTabsState(int itemID, string displayTabID, string displayTabName)
|
||||||
|
//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.ExecuteNonQuery();
|
||||||
|
//SqlDataAdapter da = new SqlDataAdapter(cm);
|
||||||
|
//da.Fill(dt);
|
||||||
|
//cn.Close();
|
||||||
|
//da.Dispose();
|
||||||
|
//return dt; // fix
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
//if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemExt.AddDisplayTabsState", ex);
|
||||||
|
throw new DbCslaException("ItemExt.AddDisplayTabsState", ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region SectionInfo
|
#region SectionInfo
|
||||||
|
@ -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