C2025-027-AnnotationsTypeSelect #574
@@ -14,9 +14,6 @@ namespace VEPROMS
|
|||||||
// C2025-027 Annotation Type Filtering
|
// C2025-027 Annotation Type Filtering
|
||||||
public partial class dlgAnnotationsSelect : Form
|
public partial class dlgAnnotationsSelect : Form
|
||||||
{
|
{
|
||||||
//int AnnotationTypeID;
|
|
||||||
//string AnnotationNameStr = "";
|
|
||||||
|
|
||||||
public dlgAnnotationsSelect()
|
public dlgAnnotationsSelect()
|
||||||
mschill marked this conversation as resolved
Outdated
|
|||||||
{
|
{
|
||||||
mschill marked this conversation as resolved
Outdated
mschill
commented
commented out code should be removed or reason given for why it is commented out / should be in the code long term. commented out code should be removed or reason given for why it is commented out / should be in the code long term.
plarsen
commented
Comment removed. Comment removed.
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -96,22 +93,8 @@ namespace VEPROMS
|
|||||||
// Save selected list to DB.
|
// Save selected list to DB.
|
||||||
private void btnUpdate_Click(object sender, EventArgs e)
|
private void btnUpdate_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
int AnnotationTypeID;
|
|
||||||
string AnnotationNameStr = "";
|
|
||||||
// dltFlg flag is used to notify SQL SP to deleted all the entries for the user before entering the annotation type selections.
|
|
||||||
int dltFlg = 1;
|
|
||||||
|
|
||||||
//foreach (AnnotataionItem item in lstSelected.Items.OfType<AnnotataionItem>())
|
|
||||||
//{
|
|
||||||
// AnnotationTypeID = item.TypeID;
|
|
||||||
// AnnotationNameStr = item.NameStr;
|
|
||||||
|
|
||||||
DataTable dt2 = coverToTable(UserID);
|
DataTable dt2 = coverToTable(UserID);
|
||||||
|
VEPROMS.CSLA.Library.AnnotationstypeSelections.Update(dt2);
|
||||||
VEPROMS.CSLA.Library.AnnotationstypeSelections.Update2(dt2);
|
|
||||||
// dltFlg = 0;
|
|
||||||
//}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public class AnnotataionItem
|
public class AnnotataionItem
|
||||||
{
|
{
|
||||||
mschill marked this conversation as resolved
Outdated
mschill
commented
I am not sure what this flag is? Can there be comments explaining why? Flag removed I am not sure what this flag is?
I noticed it will be 1 on 1st iteration then 0 after that.
Can there be comments explaining why?
Flag removed
mschill
commented
Must be missing something .... Not sure I understand why we are deleting items and reentering them ...... wouldn't we lose history on when they were originally put in if we do that? When a user changes or adds to his selections, we need to remove his selections in the DB and insert the updates. Must be missing something .... Not sure I understand why we are deleting items and reentering them ...... wouldn't we lose history on when they were originally put in if we do that?
When a user changes or adds to his selections, we need to remove his selections in the DB and insert the updates.
plarsen
commented
Delete and reinsert works very well. Updates in this scenario are nightmares. Delete and reinsert works very well. Updates in this scenario are nightmares.
mschill
commented
not sure if this would help --- but just a thought - passing in a whole table of the annotationtypeselections instead of doing 1 update/insert at a time and then doing a merge with the current table? In the end, as long as Devin and John are good with it, I am too --- just figured I would check in case we were losing any needed info by removing and re-adding... not sure if this would help --- but just a thought - passing in a whole table of the annotationtypeselections instead of doing 1 update/insert at a time and then doing a merge with the current table?
In the end, as long as Devin and John are good with it, I am too --- just figured I would check in case we were losing any needed info by removing and re-adding...
mschill
commented
Would remove dltFlg and commented out code since no longer used. Would remove dltFlg and commented out code since no longer used.
mschill
commented
As FYI - still valid As FYI - still valid
plarsen
commented
Flag removed Flag removed
|
|||||||
@@ -178,14 +161,17 @@ namespace VEPROMS
|
|||||||
|
|
||||||
private DataTable coverToTable(string userid)
|
private DataTable coverToTable(string userid)
|
||||||
{
|
{
|
||||||
|
int RowID = 0;
|
||||||
DataTable dt = new DataTable();
|
DataTable dt = new DataTable();
|
||||||
mschill marked this conversation as resolved
Outdated
mschill
commented
Shouldn't need this as foreach loop below should loop 0 times if no rows. Shouldn't need this as foreach loop below should loop 0 times if no rows.
plarsen
commented
That look is used. It retrieves from AnnotationstypeSelections table. That look is used. It retrieves from AnnotationstypeSelections table.
|
|||||||
dt.Columns.Add("TypeID", typeof(Int32));
|
dt.Columns.Add("TypeID", typeof(Int32));
|
||||||
dt.Columns.Add("NameStr", typeof(string));
|
dt.Columns.Add("NameStr", typeof(string));
|
||||||
mschill marked this conversation as resolved
Outdated
mschill
commented
I thought Name was being removed from AnntationsSelections and just going to be pulled from AnnotationsType? Also, not quite sure why RowID is needed / was added? I thought Name was being removed from AnntationsSelections and just going to be pulled from AnnotationsType?
Also, not quite sure why RowID is needed / was added?
Should only need the TypeID and UserID unless I am missing something?
|
|||||||
dt.Columns.Add("UserID", typeof(string));
|
dt.Columns.Add("UserID", typeof(string));
|
||||||
|
dt.Columns.Add("RowID", typeof(string));
|
||||||
|
|
||||||
foreach (AnnotataionItem item in lstSelected.Items.OfType<AnnotataionItem>())
|
foreach (AnnotataionItem item in lstSelected.Items.OfType<AnnotataionItem>())
|
||||||
mschill marked this conversation as resolved
mschill
commented
see comments in SQL --- shouldn't need RowID see comments in SQL --- shouldn't need RowID
|
|||||||
{
|
{
|
||||||
dt.Rows.Add(item.TypeID, item.NameStr, userid);
|
++RowID;
|
||||||
|
dt.Rows.Add(item.TypeID, item.NameStr, userid, RowID);
|
||||||
}
|
}
|
||||||
return dt;
|
return dt;
|
||||||
}
|
}
|
||||||
|
@@ -24104,15 +24104,10 @@ CREATE TABLE [dbo].[AnnotationTypeSelections](
|
|||||||
[Config] [nvarchar](max) NULL,
|
[Config] [nvarchar](max) NULL,
|
||||||
[DTS] [datetime] NULL,
|
[DTS] [datetime] NULL,
|
||||||
[UserID] [nvarchar](100) NULL,
|
[UserID] [nvarchar](100) NULL,
|
||||||
mschill marked this conversation as resolved
mschill
commented
Would suggest not having columns named both UserID and UserID in the same table as it is confusing which is the function of each, Would suggest not having columns named both UserID and UserID in the same table as it is confusing which is the function of each,
Would suggest renaming UserID as something like CreatedBy.
|
|||||||
[LastChanged] [timestamp] NULL,
|
[LastChanged] [timestamp] NULL
|
||||||
[IsEPAnnotationType] [bit] NULL
|
|
||||||
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||||||
GO
|
GO
|
||||||
|
|
||||||
--CREATE UNIQUE INDEX idx_AnnotationTypeSelections_Usrid
|
|
||||||
--ON AnnotationTypeSelections (TypeID, Name, UsrID);
|
|
||||||
--GO
|
|
||||||
|
|
||||||
IF EXISTS (SELECT * FROM sys.indexes WHERE name='idx_AnnotationTypeSelections_UsrID'
|
IF EXISTS (SELECT * FROM sys.indexes WHERE name='idx_AnnotationTypeSelections_UsrID'
|
||||||
AND object_id = OBJECT_ID('[dbo].[AnnotationTypeSelections]'))
|
AND object_id = OBJECT_ID('[dbo].[AnnotationTypeSelections]'))
|
||||||
mschill marked this conversation as resolved
Outdated
mschill
commented
if commented out, should be removed or reason given why commented out? if commented out, should be removed or reason given why commented out?
plarsen
commented
Comment removed. Comment removed.
|
|||||||
begin
|
begin
|
||||||
@@ -24124,17 +24119,6 @@ CREATE NONCLUSTERED INDEX idx_AnnotationTypeSelections_UsrID
|
|||||||
INCLUDE (TypeID, Name)
|
INCLUDE (TypeID, Name)
|
||||||
mschill marked this conversation as resolved
Outdated
mschill
commented
remove: , OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF This was what we caught was not compatible with SQL 2016 remove:
, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF
This was what we caught was not compatible with SQL 2016
|
|||||||
GO
|
GO
|
||||||
|
|
||||||
--CREATE NONCLUSTERED INDEX [idx_AnnotationTypeSelections_Usrid] ON [dbo].[AnnotationTypeSelections]
|
|
||||||
--(
|
|
||||||
-- [UsrID] ASC
|
|
||||||
--)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
|
|
||||||
--GO
|
|
||||||
--CREATE NONCLUSTERED INDEX [idx_AnnotationTypeSelections_TypeID] ON [dbo].[AnnotationTypeSelections]
|
|
||||||
--(
|
|
||||||
-- [TypeID] ASC
|
|
||||||
--)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
|
|
||||||
--GO
|
|
||||||
|
|
||||||
-- C2025-027 Annotation Type Filtering
|
-- C2025-027 Annotation Type Filtering
|
||||||
mschill marked this conversation as resolved
Outdated
mschill
commented
Wouldn't you want the index on UsrID,TypeID? I also thought name was being removed from this table? see previous notes / wouldn;t this be UNIQUE by UsrID, TypeID Wouldn't you want the index on UsrID,TypeID?
I also thought name was being removed from this table?
see previous notes / wouldn;t this be UNIQUE by UsrID, TypeID
plarsen
commented
Added an index. Added an index.
mschill
commented
Comment still valid: index should be UNIQUE by for whether it should be (1) or (2), I suggest trying each individually and looking at the execution plan to see which is grabbed / better --- if you need assistance with this, please let me know and I can give assistance as I am quite familiar with looking at the execution plans in SQL, Comment still valid:
index should be UNIQUE by
(1) UsrID, TypeID
or
(2) TypeID, UsrID
and INCLUDE other columns pulled back like:
ASTypeID
for whether it should be (1) or (2), I suggest trying each individually and looking at the execution plan to see which is grabbed / better --- if you need assistance with this, please let me know and I can give assistance as I am quite familiar with looking at the execution plans in SQL,
mschill
commented
There is another comment around line 24235that is related to this. It just moved since there have been changes since that comment was made. That one should have likely the exact index needed. There is another comment around line 24235that is related to this. It just moved since there have been changes since that comment was made. That one should have likely the exact index needed.
|
|||||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getAnnotationSelectListTypes]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getAnnotationSelectListTypes]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
DROP PROCEDURE [getAnnotationSelectListTypes];
|
DROP PROCEDURE [getAnnotationSelectListTypes];
|
||||||
@@ -24162,7 +24146,6 @@ AS
|
|||||||
[IsEPAnnotationType]
|
[IsEPAnnotationType]
|
||||||
FROM [AnnotationTypes] --A
|
FROM [AnnotationTypes] --A
|
||||||
WHERE TypeID NOT IN (SELECT TypeID FROM AnnotationTypeSelections WHERE UsrID = @UserID)
|
WHERE TypeID NOT IN (SELECT TypeID FROM AnnotationTypeSelections WHERE UsrID = @UserID)
|
||||||
|
|
||||||
GO
|
GO
|
||||||
|
|
||||||
-- C2025-027 Annotation Type Filtering
|
-- C2025-027 Annotation Type Filtering
|
||||||
@@ -24187,26 +24170,23 @@ CREATE PROC [dbo].[getAnnotationstypeSelections]
|
|||||||
AS
|
AS
|
||||||
BEGIN
|
BEGIN
|
||||||
SELECT [ASTypeID]
|
SELECT [ASTypeID]
|
||||||
,[TypeID]
|
,ATS.[TypeID]
|
||||||
,[UsrID]
|
,[UsrID]
|
||||||
,[Name]
|
,AT.[Name]
|
||||||
,[Config]
|
,AT.[Config]
|
||||||
,[DTS]
|
,ATS.[DTS]
|
||||||
,[UserID]
|
,AT.[UserID]
|
||||||
,[IsEPAnnotationType]
|
,AT.[IsEPAnnotationType]
|
||||||
FROM [dbo].[AnnotationTypeSelections]
|
FROM [dbo].[AnnotationTypeSelections] ATS
|
||||||
|
INNER JOIN AnnotationTypes AT ON AT.TypeID = ATS.TypeID
|
||||||
WHERE UsrID = @UsrID
|
WHERE UsrID = @UsrID
|
||||||
END
|
END
|
||||||
GO
|
|
||||||
|
|
||||||
|
GO
|
||||||
-- C2025-027 Annotation Type Filtering
|
-- C2025-027 Annotation Type Filtering
|
||||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getAnnotationstypeFiltered]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getAnnotationstypeFiltered]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
DROP PROCEDURE [getAnnotationstypeFiltered];
|
DROP PROCEDURE [getAnnotationstypeFiltered];
|
||||||
GO
|
GO
|
||||||
SET ANSI_NULLS ON
|
|
||||||
GO
|
|
||||||
SET QUOTED_IDENTIFIER ON
|
|
||||||
GO
|
|
||||||
|
|
||||||
-- =============================================
|
-- =============================================
|
||||||
-- Author: Paul Larsen
|
-- Author: Paul Larsen
|
||||||
@@ -24223,14 +24203,15 @@ BEGIN
|
|||||||
IF((SELECT count(TypeID) FROM AnnotationTypeSelections WHERE UsrID = @UsrID) > 0)
|
IF((SELECT count(TypeID) FROM AnnotationTypeSelections WHERE UsrID = @UsrID) > 0)
|
||||||
BEGIN
|
BEGIN
|
||||||
SELECT [ASTypeID]
|
SELECT [ASTypeID]
|
||||||
,[TypeID]
|
,ATS.[TypeID]
|
||||||
,[UsrID]
|
,[UsrID]
|
||||||
,[Name]
|
,AT.[Name]
|
||||||
,[Config]
|
,AT.[Config]
|
||||||
,[DTS]
|
,ATS.[DTS]
|
||||||
,[UserID]
|
,AT.[UserID]
|
||||||
,[IsEPAnnotationType]
|
,AT.[IsEPAnnotationType]
|
||||||
FROM [dbo].[AnnotationTypeSelections]
|
FROM [dbo].[AnnotationTypeSelections] ATS
|
||||||
|
INNER JOIN AnnotationTypes AT ON AT.TypeID = ATS.TypeID
|
||||||
WHERE UsrID = @UsrID
|
WHERE UsrID = @UsrID
|
||||||
END
|
END
|
||||||
ELSE
|
ELSE
|
||||||
@@ -24249,28 +24230,12 @@ BEGIN
|
|||||||
END
|
END
|
||||||
|
|
||||||
GO
|
GO
|
||||||
-- C2025-027 Annotation Type Filtering
|
|
||||||
--IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[TableValAnnotTypeSelections]') AND OBJECTPROPERTY(id,N'IsType') = 1)
|
|
||||||
|
|
||||||
-- Type --
|
|
||||||
|
|
||||||
--IF NOT EXISTS (SELECT * FROM sys.types WHERE is_table_type = 1 AND name ='TableValAnnotTypeSelections')
|
|
||||||
-- DROP PROCEDURE [TableValAnnotTypeSelections];
|
|
||||||
--GO
|
|
||||||
|
|
||||||
--/****** Object: UserDefinedTableType [dbo].[TableValAnnotTypeSelections] Script Date: 7/21/2025 8:06:11 PM ******/
|
|
||||||
--CREATE TYPE [dbo].[TableValAnnotTypeSelections] AS TABLE(
|
|
||||||
-- [TypeID] [int] NOT NULL,
|
|
||||||
-- [NameStr] [varchar](200) NULL,
|
|
||||||
-- [UserID] [varchar](50) NULL
|
|
||||||
--)
|
|
||||||
--GO
|
|
||||||
|
|
||||||
-- C2025-027 Annotation Type Filtering
|
-- C2025-027 Annotation Type Filtering
|
||||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[UpdateAnnotationstypeSelections2]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[UpdateAnnotationstypeSelections]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||||
mschill marked this conversation as resolved
Outdated
mschill
commented
Should this table have any other indexes? Would think that there could be a lot of joins by TypeID and User... Also, what is the difference between: Added an index Should this table have any other indexes?
Would think that there could be a lot of joins by TypeID and User...
Also, what is the difference between:
UsrID
and
UserID?
Added an index
plarsen
commented
UsrID is the id of the PROMS user. Userid is the user id that created the annotation type. UsrID is the id of the PROMS user. Userid is the user id that created the annotation type.
plarsen
commented
Added indexes Added indexes
mschill
commented
I would add them as 1 combined index as I don't think you would ever be providing one without the other ----- also, what should the included columns be for the index? Should there be a unique index for UsrID, TypeID? Also, should we check if Index exists before we create (i.e. if it already exists will this cause PROMSFixes to error)? Done I would add them as 1 combined index as I don't think you would ever be providing one without the other ----- also, what should the included columns be for the index?
Should there be a unique index for UsrID, TypeID?
Also, should we check if Index exists before we create (i.e. if it already exists will this cause PROMSFixes to error)?
Done
mschill
commented
can we either --- use something else like CreatedBy or add a comment in the SQL. > UsrID is the id of the PROMS user. Userid is the user id that created the annotation type.
can we either --- use something else like CreatedBy or add a comment in the SQL.
mschill
commented
Would need to figure out what is needed in include columns first (review where selecting from AnnotationTypeSelections and determine/update to be the minimum columns needed) --- but index should be similar to: CREATE UNIQUE INDEX [idx_AnnotationTypeSelections_UsridTypeID] ON [dbo].[AnnotationTypeSelections] > I would add them as 1 combined index as I don't think you would ever be providing one without the other ----- also, what should the included columns be for the index?
>
> Should there be a unique index for UsrID, TypeID?
>
> Also, should we check if Index exists before we create (i.e. if it already exists will this cause PROMSFixes to error)?
Would need to figure out what is needed in include columns first (review where selecting from AnnotationTypeSelections and determine/update to be the minimum columns needed) --- but index should be similar to:
CREATE UNIQUE INDEX [idx_AnnotationTypeSelections_UsridTypeID] ON [dbo].[AnnotationTypeSelections]
(
[UsrID] ASC,
[TypeID] ASC
)
INCLUDE (ASTypeID, ...)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
mschill
commented
As FYI - still valid As FYI - still valid
|
|||||||
DROP PROCEDURE [UpdateAnnotationstypeSelections2];
|
DROP PROCEDURE [UpdateAnnotationstypeSelections];
|
||||||
|
|
||||||
-- Need to drop UpdateAnnotationstypeSelections2 SP first so script can drop and recreate the TableValAnnotTypeSelections table type
|
-- Need to drop UpdateAnnotationstypeSelections SP first so script can drop and recreate the TableValAnnotTypeSelections table type
|
||||||
|
|
||||||
IF EXISTS( SELECT * FROM INFORMATION_SCHEMA.DOMAINS WHERE Domain_Name = 'TableValAnnotTypeSelections' )
|
IF EXISTS( SELECT * FROM INFORMATION_SCHEMA.DOMAINS WHERE Domain_Name = 'TableValAnnotTypeSelections' )
|
||||||
DROP TYPE [dbo].[TableValAnnotTypeSelections]
|
DROP TYPE [dbo].[TableValAnnotTypeSelections]
|
||||||
@@ -24278,63 +24243,46 @@ IF EXISTS( SELECT * FROM INFORMATION_SCHEMA.DOMAINS WHERE Domain_Name = 'TableVa
|
|||||||
CREATE TYPE [dbo].[TableValAnnotTypeSelections] AS TABLE(
|
CREATE TYPE [dbo].[TableValAnnotTypeSelections] AS TABLE(
|
||||||
[TypeID] [int] NOT NULL,
|
[TypeID] [int] NOT NULL,
|
||||||
[NameStr] [varchar](200) NULL,
|
[NameStr] [varchar](200) NULL,
|
||||||
mschill marked this conversation as resolved
Outdated
mschill
commented
Shouldn't need NameStr or RowID unless I am missing something as these are not columns in AnnotationSelections Shouldn't need NameStr or RowID unless I am missing something as these are not columns in AnnotationSelections
|
|||||||
[UserID] [varchar](50) NULL
|
[UserID] [varchar](50) NULL,
|
||||||
|
[RowID] [int] NOT NULL,
|
||||||
|
PRIMARY KEY CLUSTERED
|
||||||
|
(
|
||||||
mschill marked this conversation as resolved
Outdated
mschill
commented
shouldn't need a primary key on a type? shouldn't need a primary key on a type?
|
|||||||
|
[RowID] ASC
|
||||||
|
)WITH (IGNORE_DUP_KEY = OFF)
|
||||||
)
|
)
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
/****** Object: StoredProcedure [dbo].[UpdateAnnotationstypeSelections] Script Date: 7/21/2025 8:51:42 PM ******/
|
||||||
/****** Object: StoredProcedure [dbo].[UpdateAnnotationstypeSelections2] Script Date: 7/21/2025 8:51:42 PM ******/
|
|
||||||
SET ANSI_NULLS ON
|
|
||||||
GO
|
|
||||||
|
|
||||||
SET QUOTED_IDENTIFIER ON
|
|
||||||
GO
|
|
||||||
|
|
||||||
-- =============================================
|
-- =============================================
|
||||||
-- Author: Paul Larsen
|
-- Author: Paul Larsen
|
||||||
-- Create date: 07/21/2025
|
-- Create date: 07/21/2025
|
||||||
-- Description: Manage user choice annotation types
|
-- Description: Manage user choice annotation types
|
||||||
-- =============================================
|
-- =============================================
|
||||||
CREATE PROC [dbo].[UpdateAnnotationstypeSelections2]
|
CREATE PROC [dbo].[UpdateAnnotationstypeSelections]
|
||||||
mschill marked this conversation as resolved
Outdated
mschill
commented
If commented out, would remove or give reason why commented out? If commented out, would remove or give reason why commented out?
plarsen
commented
Removed it Removed it
|
|||||||
(
|
(
|
||||||
@TempTable AS dbo.TableValAnnotTypeSelections READONLY
|
@TempTable AS dbo.TableValAnnotTypeSelections READONLY
|
||||||
)
|
)
|
||||||
AS
|
AS
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
--INSERT INTO CUSTOMER (CustomerId,CustomerName ,Isdeleted )
|
DECLARE @cnt integer = 0
|
||||||
--SELECT CustomerId, CustomerName, 0 AS Isdeleted FROM @TempTable
|
DECLARE @cnt2 integer = 0
|
||||||
|
SET @cnt = (SELECT count(*) from @TempTable)
|
||||||
|
DECLARE @UserID VARCHAR(50) = (SELECT TOP 1 UserID FROM @TempTable)
|
||||||
|
DELETE FROM AnnotationTypeSelections WHERE usrID = @UserID;
|
||||||
mschill marked this conversation as resolved
Outdated
mschill
commented
only need to delete the ones not already in the table. If we delete and re-add then will lose history of when truely added --- see comment below (around line 24278) for more complete, only need to delete the ones not already in the table. If we delete and re-add then will lose history of when truely added --- see comment below (around line 24278) for more complete,
|
|||||||
|
|
||||||
MERGE AnnotationTypeSelections AS TARGET
|
declare @i int
|
||||||
USING @TempTable AS SOURCE
|
select @i = min(RowID) from @TempTable
|
||||||
|
declare @max int
|
||||||
|
select @max = max(RowID) from @TempTable
|
||||||
mschill marked this conversation as resolved
Outdated
mschill
commented
So, shouldn't NameStr not be part of the AnnotationTypeSelections and instead pull from AnnotationTypes? (As could have situation where the Names become out of sink if it is stored multiple places) So, shouldn't NameStr not be part of the AnnotationTypeSelections and instead pull from AnnotationTypes?
(As could have situation where the Names become out of sink if it is stored multiple places)
plarsen
commented
I left it in the table. I left it in the table.
mschill
commented
would not loop through this is will perform poorly and should not be necessary. It looks like my previous comment got removed with this change as it is now past the end of this file, so I will reply to this shortly with that same comment again. would not loop through this is will perform poorly and should not be necessary. It looks like my previous comment got removed with this change as it is now past the end of this file, so I will reply to this shortly with that same comment again.
mschill
commented
would think would want to do something like: --this would delete only the ones for this User that are not in the uploaded table --this would insert all the ones that are in the uploaded table and not already in AnnotationTypeSelections would think would want to do something like:
--this would delete only the ones for this User that are not in the uploaded table
DELETE FROM AnnotationTypeSelections where UsrID in
(Select UsrID From @TempTable tmp)
AND
TypeID not in
(Select TypeID From @TempTable tmp)
--this would insert all the ones that are in the uploaded table and not already in AnnotationTypeSelections
Insert INTO AnnotationTypeSelections (TypeID, UsrID)
Select TypeID, UserID
FROM
@TempTable tmp
LEFT OUTER JOIN
AnnotationTypeSelections ATS on ATS.TypeID = tmp.TypeID
AND ATS.UsrID = tmp.UsrID
where
ATS.ASTypeID IS NULL
mschill
commented
Also as a heads up - I sent an email with an attachment --- looks like there is a side consequence to having Userid be part of the table type and not separate --- that side consequence occurs if you have items selected and then want to de-select all of the items. Also as a heads up - I sent an email with an attachment --- looks like there is a side consequence to having Userid be part of the table type and not separate --- that side consequence occurs if you have items selected and then want to de-select all of the items.
|
|||||||
|
|
||||||
/* 1. Performing the UPDATE operation */
|
WHILE @i <= @max
|
||||||
|
BEGIN
|
||||||
/* If the P_ID is same,
|
INSERT INTO AnnotationTypeSelections (TypeID, Name, Usrid)
|
||||||
check for change in P_NAME or P_PRICE */
|
select TypeID, NameStr, UserID from @TempTable where RowID = @i
|
||||||
ON (TARGET.TypeID = SOURCE.TypeID)
|
set @i = @i + 1
|
||||||
WHEN MATCHED
|
END
|
||||||
AND TARGET.Name <> SOURCE.NameStr
|
|
||||||
|
|
||||||
/* Update the records in TARGET */
|
|
||||||
THEN UPDATE
|
|
||||||
SET TARGET.Name = SOURCE.NameStr,
|
|
||||||
TARGET.UsrID = SOURCE.UserID
|
|
||||||
|
|
||||||
/* 2. Performing the INSERT operation */
|
|
||||||
|
|
||||||
/* When no records are matched with TARGET table
|
|
||||||
Then insert the records in the target table */
|
|
||||||
WHEN NOT MATCHED BY TARGET
|
|
||||||
THEN INSERT (TypeID, Name, UsrID)
|
|
||||||
VALUES (SOURCE.TypeID, SOURCE.NameStr,SOURCE.UserID)
|
|
||||||
|
|
||||||
/* 3. Performing the DELETE operation */
|
|
||||||
|
|
||||||
/* When no records are matched with SOURCE table
|
|
||||||
Then delete the records from the target table */
|
|
||||||
WHEN NOT MATCHED BY SOURCE
|
|
||||||
THEN DELETE;
|
|
||||||
END
|
END
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
@@ -158,6 +158,11 @@
|
|||||||
<Compile Include="dlgAnnotationsSelect.Designer.cs">
|
<Compile Include="dlgAnnotationsSelect.Designer.cs">
|
||||||
<DependentUpon>dlgAnnotationsSelect.cs</DependentUpon>
|
<DependentUpon>dlgAnnotationsSelect.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="dlgAnnotationsSelect.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>dlgAnnotationsSelect.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="dlgApproveProcedure.cs">
|
<Compile Include="dlgApproveProcedure.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -346,7 +351,6 @@
|
|||||||
<EmbeddedResource Include="dlgAnnotationsSelect.resx">
|
<EmbeddedResource Include="dlgAnnotationsSelect.resx">
|
||||||
<DependentUpon>dlgAnnotationsSelect.cs</DependentUpon>
|
<DependentUpon>dlgAnnotationsSelect.cs</DependentUpon>
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>dlgAnnotationsSelect2.Designer.cs</LastGenOutput>
|
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="dlgMSWordMessage.resx">
|
<EmbeddedResource Include="dlgMSWordMessage.resx">
|
||||||
<DependentUpon>dlgMSWordMessage.cs</DependentUpon>
|
<DependentUpon>dlgMSWordMessage.cs</DependentUpon>
|
||||||
|
@@ -39,6 +39,8 @@ namespace VEPROMS
|
|||||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||||
this.btnCancel = new System.Windows.Forms.Button();
|
this.btnCancel = new System.Windows.Forms.Button();
|
||||||
this.lblMessage = new System.Windows.Forms.Label();
|
this.lblMessage = new System.Windows.Forms.Label();
|
||||||
|
this.lblAvailableTypes = new System.Windows.Forms.Label();
|
||||||
|
this.lblSelected = new System.Windows.Forms.Label();
|
||||||
this.tableLayoutPanel1.SuspendLayout();
|
this.tableLayoutPanel1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
@@ -47,12 +49,12 @@ namespace VEPROMS
|
|||||||
this.lstUnselected.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.lstUnselected.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.lstUnselected.FormattingEnabled = true;
|
this.lstUnselected.FormattingEnabled = true;
|
||||||
this.lstUnselected.IntegralHeight = false;
|
this.lstUnselected.IntegralHeight = false;
|
||||||
this.lstUnselected.ItemHeight = 20;
|
this.lstUnselected.ItemHeight = 16;
|
||||||
this.lstUnselected.Location = new System.Drawing.Point(3, 3);
|
this.lstUnselected.Location = new System.Drawing.Point(3, 3);
|
||||||
this.lstUnselected.Name = "lstUnselected";
|
this.lstUnselected.Name = "lstUnselected";
|
||||||
this.tableLayoutPanel1.SetRowSpan(this.lstUnselected, 4);
|
this.tableLayoutPanel1.SetRowSpan(this.lstUnselected, 4);
|
||||||
this.lstUnselected.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
|
this.lstUnselected.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
|
||||||
this.lstUnselected.Size = new System.Drawing.Size(287, 359);
|
this.lstUnselected.Size = new System.Drawing.Size(287, 347);
|
||||||
this.lstUnselected.TabIndex = 0;
|
this.lstUnselected.TabIndex = 0;
|
||||||
this.lstUnselected.SelectedIndexChanged += new System.EventHandler(this.lst_SelectedIndexChanged);
|
this.lstUnselected.SelectedIndexChanged += new System.EventHandler(this.lst_SelectedIndexChanged);
|
||||||
//
|
//
|
||||||
@@ -61,19 +63,19 @@ namespace VEPROMS
|
|||||||
this.lstSelected.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.lstSelected.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.lstSelected.FormattingEnabled = true;
|
this.lstSelected.FormattingEnabled = true;
|
||||||
this.lstSelected.IntegralHeight = false;
|
this.lstSelected.IntegralHeight = false;
|
||||||
this.lstSelected.ItemHeight = 20;
|
this.lstSelected.ItemHeight = 16;
|
||||||
this.lstSelected.Location = new System.Drawing.Point(334, 3);
|
this.lstSelected.Location = new System.Drawing.Point(334, 3);
|
||||||
this.lstSelected.Name = "lstSelected";
|
this.lstSelected.Name = "lstSelected";
|
||||||
this.tableLayoutPanel1.SetRowSpan(this.lstSelected, 4);
|
this.tableLayoutPanel1.SetRowSpan(this.lstSelected, 4);
|
||||||
this.lstSelected.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
|
this.lstSelected.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
|
||||||
this.lstSelected.Size = new System.Drawing.Size(288, 359);
|
this.lstSelected.Size = new System.Drawing.Size(288, 347);
|
||||||
this.lstSelected.TabIndex = 1;
|
this.lstSelected.TabIndex = 1;
|
||||||
this.lstSelected.SelectedIndexChanged += new System.EventHandler(this.lst_SelectedIndexChanged);
|
this.lstSelected.SelectedIndexChanged += new System.EventHandler(this.lst_SelectedIndexChanged);
|
||||||
//
|
//
|
||||||
// btnSelect
|
// btnSelect
|
||||||
//
|
//
|
||||||
this.btnSelect.Anchor = System.Windows.Forms.AnchorStyles.None;
|
this.btnSelect.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||||
this.btnSelect.Location = new System.Drawing.Point(298, 34);
|
this.btnSelect.Location = new System.Drawing.Point(298, 32);
|
||||||
this.btnSelect.Name = "btnSelect";
|
this.btnSelect.Name = "btnSelect";
|
||||||
this.btnSelect.Size = new System.Drawing.Size(28, 23);
|
this.btnSelect.Size = new System.Drawing.Size(28, 23);
|
||||||
this.btnSelect.TabIndex = 2;
|
this.btnSelect.TabIndex = 2;
|
||||||
@@ -84,9 +86,9 @@ namespace VEPROMS
|
|||||||
// btnSelectAll
|
// btnSelectAll
|
||||||
//
|
//
|
||||||
this.btnSelectAll.Anchor = System.Windows.Forms.AnchorStyles.None;
|
this.btnSelectAll.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||||
this.btnSelectAll.Location = new System.Drawing.Point(298, 125);
|
this.btnSelectAll.Location = new System.Drawing.Point(296, 120);
|
||||||
this.btnSelectAll.Name = "btnSelectAll";
|
this.btnSelectAll.Name = "btnSelectAll";
|
||||||
this.btnSelectAll.Size = new System.Drawing.Size(28, 23);
|
this.btnSelectAll.Size = new System.Drawing.Size(32, 23);
|
||||||
this.btnSelectAll.TabIndex = 3;
|
this.btnSelectAll.TabIndex = 3;
|
||||||
this.btnSelectAll.Text = ">>";
|
this.btnSelectAll.Text = ">>";
|
||||||
this.btnSelectAll.UseVisualStyleBackColor = true;
|
this.btnSelectAll.UseVisualStyleBackColor = true;
|
||||||
@@ -95,9 +97,9 @@ namespace VEPROMS
|
|||||||
// btnDeselectAll
|
// btnDeselectAll
|
||||||
//
|
//
|
||||||
this.btnDeselectAll.Anchor = System.Windows.Forms.AnchorStyles.None;
|
this.btnDeselectAll.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||||
this.btnDeselectAll.Location = new System.Drawing.Point(298, 216);
|
this.btnDeselectAll.Location = new System.Drawing.Point(297, 207);
|
||||||
this.btnDeselectAll.Name = "btnDeselectAll";
|
this.btnDeselectAll.Name = "btnDeselectAll";
|
||||||
this.btnDeselectAll.Size = new System.Drawing.Size(28, 23);
|
this.btnDeselectAll.Size = new System.Drawing.Size(30, 26);
|
||||||
this.btnDeselectAll.TabIndex = 5;
|
this.btnDeselectAll.TabIndex = 5;
|
||||||
this.btnDeselectAll.Text = "<<";
|
this.btnDeselectAll.Text = "<<";
|
||||||
this.btnDeselectAll.UseVisualStyleBackColor = true;
|
this.btnDeselectAll.UseVisualStyleBackColor = true;
|
||||||
@@ -106,7 +108,7 @@ namespace VEPROMS
|
|||||||
// btnDeselect
|
// btnDeselect
|
||||||
//
|
//
|
||||||
this.btnDeselect.Anchor = System.Windows.Forms.AnchorStyles.None;
|
this.btnDeselect.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||||
this.btnDeselect.Location = new System.Drawing.Point(298, 307);
|
this.btnDeselect.Location = new System.Drawing.Point(298, 297);
|
||||||
this.btnDeselect.Name = "btnDeselect";
|
this.btnDeselect.Name = "btnDeselect";
|
||||||
this.btnDeselect.Size = new System.Drawing.Size(28, 23);
|
this.btnDeselect.Size = new System.Drawing.Size(28, 23);
|
||||||
this.btnDeselect.TabIndex = 4;
|
this.btnDeselect.TabIndex = 4;
|
||||||
@@ -140,14 +142,14 @@ namespace VEPROMS
|
|||||||
this.tableLayoutPanel1.Controls.Add(this.btnDeselectAll, 1, 2);
|
this.tableLayoutPanel1.Controls.Add(this.btnDeselectAll, 1, 2);
|
||||||
this.tableLayoutPanel1.Controls.Add(this.btnSelect, 1, 0);
|
this.tableLayoutPanel1.Controls.Add(this.btnSelect, 1, 0);
|
||||||
this.tableLayoutPanel1.Controls.Add(this.btnSelectAll, 1, 1);
|
this.tableLayoutPanel1.Controls.Add(this.btnSelectAll, 1, 1);
|
||||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 51);
|
this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 62);
|
||||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||||
this.tableLayoutPanel1.RowCount = 4;
|
this.tableLayoutPanel1.RowCount = 4;
|
||||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(625, 365);
|
this.tableLayoutPanel1.Size = new System.Drawing.Size(625, 353);
|
||||||
this.tableLayoutPanel1.TabIndex = 6;
|
this.tableLayoutPanel1.TabIndex = 6;
|
||||||
//
|
//
|
||||||
// btnCancel
|
// btnCancel
|
||||||
@@ -163,28 +165,49 @@ namespace VEPROMS
|
|||||||
// lblMessage
|
// lblMessage
|
||||||
//
|
//
|
||||||
this.lblMessage.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.lblMessage.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.lblMessage.Location = new System.Drawing.Point(50, 18);
|
this.lblMessage.Location = new System.Drawing.Point(43, 12);
|
||||||
this.lblMessage.Name = "lblMessage";
|
this.lblMessage.Name = "lblMessage";
|
||||||
this.lblMessage.Size = new System.Drawing.Size(317, 28);
|
this.lblMessage.Size = new System.Drawing.Size(317, 16);
|
||||||
this.lblMessage.TabIndex = 10;
|
this.lblMessage.TabIndex = 10;
|
||||||
this.lblMessage.Text = "Updates will appear when PROMS is restarted.";
|
this.lblMessage.Text = "Updates will appear when PROMS is restarted.";
|
||||||
//
|
//
|
||||||
// DlgAnnotationsSelect
|
// lblAvailableTypes
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
|
this.lblAvailableTypes.AutoSize = true;
|
||||||
|
this.lblAvailableTypes.Location = new System.Drawing.Point(12, 43);
|
||||||
|
this.lblAvailableTypes.Name = "lblAvailableTypes";
|
||||||
|
this.lblAvailableTypes.Size = new System.Drawing.Size(110, 16);
|
||||||
|
this.lblAvailableTypes.TabIndex = 11;
|
||||||
|
this.lblAvailableTypes.Text = "Types Available ";
|
||||||
|
//
|
||||||
|
// lblSelected
|
||||||
|
//
|
||||||
|
this.lblSelected.AutoSize = true;
|
||||||
|
this.lblSelected.Location = new System.Drawing.Point(343, 43);
|
||||||
|
this.lblSelected.Name = "lblSelected";
|
||||||
|
this.lblSelected.Size = new System.Drawing.Size(104, 16);
|
||||||
|
this.lblSelected.TabIndex = 12;
|
||||||
|
this.lblSelected.Text = "Types Selected";
|
||||||
|
//
|
||||||
|
// dlgAnnotationsSelect
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(653, 466);
|
this.ClientSize = new System.Drawing.Size(653, 466);
|
||||||
|
this.Controls.Add(this.lblSelected);
|
||||||
|
this.Controls.Add(this.lblAvailableTypes);
|
||||||
this.Controls.Add(this.btnCancel);
|
this.Controls.Add(this.btnCancel);
|
||||||
this.Controls.Add(this.tableLayoutPanel1);
|
this.Controls.Add(this.tableLayoutPanel1);
|
||||||
this.Controls.Add(this.btnUpdate);
|
this.Controls.Add(this.btnUpdate);
|
||||||
this.Controls.Add(this.lblMessage);
|
this.Controls.Add(this.lblMessage);
|
||||||
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||||
this.Name = "DlgAnnotationsSelect";
|
this.Name = "dlgAnnotationsSelect";
|
||||||
this.Text = "Select Annotation Types";
|
this.Text = "Select Annotation Types";
|
||||||
this.Load += new System.EventHandler(this.DlgAnnotationsSelect_Load);
|
this.Load += new System.EventHandler(this.DlgAnnotationsSelect_Load);
|
||||||
this.tableLayoutPanel1.ResumeLayout(false);
|
this.tableLayoutPanel1.ResumeLayout(false);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,6 +223,7 @@ namespace VEPROMS
|
|||||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||||
private System.Windows.Forms.Button btnCancel;
|
private System.Windows.Forms.Button btnCancel;
|
||||||
private System.Windows.Forms.Label lblMessage;
|
private System.Windows.Forms.Label lblMessage;
|
||||||
|
private System.Windows.Forms.Label lblAvailableTypes;
|
||||||
|
private System.Windows.Forms.Label lblSelected;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -145,7 +145,33 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void Update(string UserID, int TypeID, int dltFlg, string Name = "")
|
//public static void Update(string UserID, int TypeID, int dltFlg, string Name = "")
|
||||||
mschill marked this conversation as resolved
Outdated
mschill
commented
if commented out, should this be removed? if commented out, should this be removed?
|
|||||||
|
//{
|
||||||
|
// using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
|
// {
|
||||||
|
// using (SqlCommand cm = cn.CreateCommand())
|
||||||
|
// {
|
||||||
|
// try
|
||||||
mschill marked this conversation as resolved
Outdated
mschill
commented
if have a try catch, should there be something in the catch? if have a try catch, should there be something in the catch?
|
|||||||
|
// {
|
||||||
|
// cm.CommandType = CommandType.StoredProcedure;
|
||||||
|
// cm.CommandText = "UpdateAnnotationstypeSelections";
|
||||||
|
// cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
|
// cm.Parameters.AddWithValue("@UserID", UserID);
|
||||||
|
// cm.Parameters.AddWithValue("@TypeID", TypeID);
|
||||||
|
// cm.Parameters.AddWithValue("@dltFlg", dltFlg);
|
||||||
|
// cm.Parameters.AddWithValue("@Name", Name);
|
||||||
|
|
||||||
|
// cm.ExecuteNonQuery();
|
||||||
|
// }
|
||||||
|
// catch (Exception ex)
|
||||||
|
// {
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
|
public static void Update(DataTable dt)
|
||||||
{
|
{
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||||
{
|
{
|
||||||
@@ -156,32 +182,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
cm.CommandType = CommandType.StoredProcedure;
|
cm.CommandType = CommandType.StoredProcedure;
|
||||||
cm.CommandText = "UpdateAnnotationstypeSelections";
|
cm.CommandText = "UpdateAnnotationstypeSelections";
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
cm.CommandTimeout = Database.DefaultTimeout;
|
||||||
cm.Parameters.AddWithValue("@UserID", UserID);
|
|
||||||
cm.Parameters.AddWithValue("@TypeID", TypeID);
|
|
||||||
cm.Parameters.AddWithValue("@dltFlg", dltFlg);
|
|
||||||
cm.Parameters.AddWithValue("@Name", Name);
|
|
||||||
|
|
||||||
cm.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
public static void Update2(DataTable dt)
|
|
||||||
{
|
|
||||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
|
||||||
{
|
|
||||||
using (SqlCommand cm = cn.CreateCommand())
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
cm.CommandType = CommandType.StoredProcedure;
|
|
||||||
cm.CommandText = "UpdateAnnotationstypeSelections2";
|
|
||||||
cm.CommandTimeout = Database.DefaultTimeout;
|
|
||||||
|
|
||||||
//Pass table Valued parameter to Store Procedure
|
//Pass table Valued parameter to Store Procedure
|
||||||
SqlParameter sqlParam = cm.Parameters.AddWithValue("@TempTable", dt);
|
SqlParameter sqlParam = cm.Parameters.AddWithValue("@TempTable", dt);
|
||||||
|
just to check - is there a reason these 2 items (the id and NameStr) are global variables / should stay in memory while the form is open?
It looks like they are only used in 1 function - update?
I moved them