C2025-027-AnnotationsTypeSelect #574

Merged
jjenko merged 10 commits from C2025-027-AnnotationsTypeSelect into Development 2025-07-30 08:23:07 -04:00
13 changed files with 2293 additions and 1277 deletions
Showing only changes of commit 1ebf67233b - Show all commits

View File

@@ -95,6 +95,7 @@ namespace VEPROMS
{ {
DataTable dt2 = coverToTable(); DataTable dt2 = coverToTable();
VEPROMS.CSLA.Library.AnnotationstypeSelections.Update(dt2, UserID); VEPROMS.CSLA.Library.AnnotationstypeSelections.Update(dt2, UserID);
this.Close();
} }
public class AnnotataionItem public class AnnotataionItem
mschill marked this conversation as resolved Outdated

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

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

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.

Delete and reinsert works very well. Updates in this scenario are nightmares.

Delete and reinsert works very well. Updates in this scenario are nightmares.

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...

Would remove dltFlg and commented out code since no longer used.

Would remove dltFlg and commented out code since no longer used.

As FYI - still valid

As FYI - still valid

Flag removed

Flag removed
{ {

View File

@@ -24075,10 +24075,6 @@ ELSE
GO GO
-- C2025-027 Annotation Type Filtering -- C2025-027 Annotation Type Filtering
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[AnnotationTypeSelections]') AND type in (N'U'))
DROP TABLE [dbo].[AnnotationTypeSelections]
GO
/****** Object: Table [dbo].[AnnotationTypeSelections] Script Date: 7/10/2025 2:38:23 PM ******/ /****** Object: Table [dbo].[AnnotationTypeSelections] Script Date: 7/10/2025 2:38:23 PM ******/
SET ANSI_NULLS ON SET ANSI_NULLS ON
GO GO
@@ -24149,7 +24145,10 @@ AS
(SELECT COUNT(*) FROM [Annotations] WHERE [Annotations].[TypeID]= [TypeID]) [AnnotationCount], (SELECT COUNT(*) FROM [Annotations] WHERE [Annotations].[TypeID]= [TypeID]) [AnnotationCount],
[IsEPAnnotationType] [IsEPAnnotationType]
FROM [AnnotationTypes] --A FROM [AnnotationTypes] --A
WHERE TypeID NOT IN (SELECT TypeID FROM AnnotationTypeSelections ATS WHERE ATS.UserID = @UserID) LEFT OUTER JOIN AnnotationTypeSelections ON AnnotationTypeSelections.TypeID = AnnotationTypes.TypeID
WHERE AnnotationTypeSelections.UserID = @UserID
AND
AnnotationTypeSelections.ASTypeID IS NULL
GO GO
-- C2025-027 Annotation Type Filtering -- C2025-027 Annotation Type Filtering

View File

@@ -149,6 +149,8 @@ namespace VEPROMS.CSLA.Library
using (SqlConnection cn = Database.VEPROMS_SqlConnection) using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{ {
using (SqlCommand cm = cn.CreateCommand()) using (SqlCommand cm = cn.CreateCommand())
{
try
{ {
mschill marked this conversation as resolved Outdated

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.CommandType = CommandType.StoredProcedure;
cm.CommandText = "UpdateAnnotationstypeSelections"; cm.CommandText = "UpdateAnnotationstypeSelections";
@@ -160,6 +162,11 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@UserID", UserID); cm.Parameters.AddWithValue("@UserID", UserID);
cm.ExecuteNonQuery(); cm.ExecuteNonQuery();
} }
catch (Exception ex)
{
throw new DbCslaException("Error in UpdateAnnotationstypeSelections: update failed", ex);
}
}
} }
} }