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 2324 additions and 1277 deletions
Showing only changes of commit 99445406fc - Show all commits

View File

@@ -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()
{ {
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
{ {
@@ -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();
dt.Columns.Add("TypeID", typeof(Int32)); dt.Columns.Add("TypeID", typeof(Int32));
dt.Columns.Add("NameStr", typeof(string)); dt.Columns.Add("NameStr", typeof(string));
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
Review

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;
} }

View File

@@ -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
Review

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.

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]'))
begin begin
@@ -24124,17 +24119,6 @@ CREATE NONCLUSTERED INDEX idx_AnnotationTypeSelections_UsrID
INCLUDE (TypeID, Name) INCLUDE (TypeID, Name)
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
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];
@@ -24161,8 +24145,7 @@ 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 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)
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,
[UserID] [varchar](50) NULL [UserID] [varchar](50) NULL,
[RowID] [int] NOT NULL,
PRIMARY KEY CLUSTERED
(
[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]
( (
@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;
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
/* 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

View File

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

View File

@@ -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;
} }
} }

View File

@@ -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 = "")
//{
// using (SqlConnection cn = Database.VEPROMS_SqlConnection)
// {
// using (SqlCommand cm = cn.CreateCommand())
// {
// try
// {
// 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);