From 297e61160d4a69e5ac0e1c787657de7c2a3cfdee Mon Sep 17 00:00:00 2001 From: Argo-MacBookPro Date: Fri, 2 Nov 2018 22:43:49 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E8=84=9A=E6=9C=AC=EF=BC=9A?= =?UTF-8?q?=E5=88=A0=E9=99=A4SQLServer=E5=AD=98=E5=82=A8=E8=BF=87=E7=A8=8B?= =?UTF-8?q?=EF=BC=8C=E5=85=BC=E5=AE=B9MySQL/SQLite=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E7=BB=9F=E4=B8=80=E4=BD=BF=E7=94=A8SQL=E8=AF=AD?= =?UTF-8?q?=E5=8F=A5=E4=BB=A3=E6=9B=BF=E5=AD=98=E5=82=A8=E8=BF=87=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BootstrapAdmin.sln | 5 +- DatabaseScripts/Install.sql | 2 +- DatabaseScripts/Procedures.sql | 195 --------------------------------- 3 files changed, 3 insertions(+), 199 deletions(-) delete mode 100644 DatabaseScripts/Procedures.sql diff --git a/BootstrapAdmin.sln b/BootstrapAdmin.sln index 40e48b2f..349411f0 100644 --- a/BootstrapAdmin.sln +++ b/BootstrapAdmin.sln @@ -7,7 +7,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SQLServer", "SQLServer", "{ ProjectSection(SolutionItems) = preProject DatabaseScripts\InitData.sql = DatabaseScripts\InitData.sql DatabaseScripts\Install.sql = DatabaseScripts\Install.sql - DatabaseScripts\Procedures.sql = DatabaseScripts\Procedures.sql DatabaseScripts\Readme.txt = DatabaseScripts\Readme.txt EndProjectSection EndProject @@ -58,9 +57,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MySQL", "MySQL", "{084E2E94 DatabaseScripts\MySQL\install.sql = DatabaseScripts\MySQL\install.sql EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bootstrap.DataAccess.MySQL", "Bootstrap.DataAccess.MySQL\Bootstrap.DataAccess.MySQL.csproj", "{B6877AEA-EC65-47DA-BA6E-FD657729C285}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bootstrap.DataAccess.MySQL", "Bootstrap.DataAccess.MySQL\Bootstrap.DataAccess.MySQL.csproj", "{B6877AEA-EC65-47DA-BA6E-FD657729C285}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest", "UnitTest\UnitTest.csproj", "{F301A509-31AE-45EA-9453-CA8C0A73DE99}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest", "UnitTest\UnitTest.csproj", "{F301A509-31AE-45EA-9453-CA8C0A73DE99}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/DatabaseScripts/Install.sql b/DatabaseScripts/Install.sql index b3127305..d996481b 100644 --- a/DatabaseScripts/Install.sql +++ b/DatabaseScripts/Install.sql @@ -175,7 +175,7 @@ CREATE TABLE [dbo].[Navigations]( [Url] [varchar](4000) NULL, [Category] [nvarchar](50) NOT NULL, [Target] [varchar](10) NOT NULL, - [IsResource] [bit] NOT NULL, + [IsResource] [int] NOT NULL, [Application] [nvarchar](200) NOT NULL, CONSTRAINT [PK_Navigations] PRIMARY KEY CLUSTERED ( diff --git a/DatabaseScripts/Procedures.sql b/DatabaseScripts/Procedures.sql deleted file mode 100644 index 9de99456..00000000 --- a/DatabaseScripts/Procedures.sql +++ /dev/null @@ -1,195 +0,0 @@ -USE [BootstrapAdmin] -GO - -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -Drop PROCEDURE Proc_DeleteUsers -GO --- ============================================= --- Author: Argo Zhang --- Create date: 2016-09-06 --- Description: --- ============================================= -Create PROCEDURE Proc_DeleteUsers - -- Add the parameters for the stored procedure here - @ids varchar(max) - WITH ENCRYPTION -AS -BEGIN - -- SET NOCOUNT ON added to prevent extra result sets from - -- interfering with SELECT statements. - SET NOCOUNT ON; - SET XACT_ABORT ON; - -- Insert statements for procedure here - declare @sql varchar(max) - set @sql = 'Delete from UserRole where UserID in (' + @ids + ');' - set @sql += 'delete from UserGroup where UserID in (' + @ids + ');' - set @sql += 'delete from Users where ID in (' + @ids + ');' - exec(@sql) -END -GO - -Drop PROCEDURE Proc_DeleteRoles -GO --- ============================================= --- Author: LiuChun --- Create date: 2016-11-07 --- Description: --- ============================================= -Create PROCEDURE Proc_DeleteRoles - -- Add the parameters for the stored procedure here - @ids varchar(max) - WITH ENCRYPTION -AS -BEGIN - -- SET NOCOUNT ON added to prevent extra result sets from - -- interfering with SELECT statements. - SET NOCOUNT ON; - SET XACT_ABORT ON; - -- Insert statements for procedure here - declare @sql varchar(max) - set @sql = 'delete from UserRole where RoleID in (' + @ids + ');' - set @sql += 'delete from RoleGroup where RoleID in (' + @ids + ');' - set @sql += 'delete from NavigationRole where RoleID in (' + @ids + ');' - set @sql += 'delete from Roles where ID in (' + @ids + ');' - exec(@sql) -END -GO - - -Drop PROCEDURE Proc_DeleteGroups -GO --- ============================================= --- Author: LiuChun --- Create date: 2016-11-07 --- Description: --- ============================================= -Create PROCEDURE Proc_DeleteGroups - -- Add the parameters for the stored procedure here - @ids varchar(max) - WITH ENCRYPTION -AS -BEGIN - -- SET NOCOUNT ON added to prevent extra result sets from - -- interfering with SELECT statements. - SET NOCOUNT ON; - SET XACT_ABORT ON; - -- Insert statements for procedure here - declare @sql varchar(max) - set @sql = 'delete from UserGroup where GroupID in (' + @ids + ');' - set @sql += 'delete from RoleGroup where GroupID in (' + @ids + ');' - set @sql += 'delete from Groups where ID in (' + @ids + ');' - exec(@sql) -END -GO - -Drop PROCEDURE Proc_DeleteMenus -GO --- ============================================= --- Author: LiuChun --- Create date: 2016-11-07 --- Description: --- ============================================= -Create PROCEDURE Proc_DeleteMenus - -- Add the parameters for the stored procedure here - @ids varchar(max) - WITH ENCRYPTION -AS -BEGIN - -- SET NOCOUNT ON added to prevent extra result sets from - -- interfering with SELECT statements. - SET NOCOUNT ON; - SET XACT_ABORT ON; - -- Insert statements for procedure here - declare @sql varchar(max) - set @sql = 'delete from NavigationRole where NavigationID in (' + @ids + ');' - set @sql += 'delete from Navigations where ID in (' + @ids + ');' - exec(@sql) -END -GO - -/****** Object: StoredProcedure [dbo].[Proc_SaveUsers] Script Date: 11/11/2016 08:51:44 ******/ -SET ANSI_NULLS ON -GO - -SET QUOTED_IDENTIFIER ON -GO - -Drop PROCEDURE Proc_SaveUsers -GO --- ============================================= --- Author: LiuChun --- Create date: 2016-11-10 --- Description: --- ============================================= -CREATE PROCEDURE [dbo].[Proc_SaveUsers] - -- Add the parameters for the stored procedure here - @userName varchar(50), - @password varchar(50), - @passSalt varchar(50), - @displayName nvarchar(50), - @approvedBy nvarchar(50) = null, - @description nvarchar(500) - WITH ENCRYPTION -AS -BEGIN - -- SET NOCOUNT ON added to prevent extra result sets from - -- interfering with SELECT statements. - SET NOCOUNT ON; - SET XACT_ABORT ON; - -- Insert statements for procedure here - declare @approvedTime datetime - if @approvedBy is not null set @approvedTime = GETDATE() - - begin - if(not exists (select 1 from Users Where UserName = @userName)) - begin - begin tran - Insert Into Users (UserName, [Password], PassSalt, DisplayName, RegisterTime, ApprovedBy, ApprovedTime, [Description]) values (@userName, @password, @passSalt, @displayName, GETDATE(), @approvedBy, GETDATE(), @description) - insert into UserRole (UserID, RoleID) select @@IDENTITY, ID from Roles where RoleName = N'Default' - commit tran - end - end -END -GO - -Drop PROCEDURE Proc_RejectUsers -GO --- ============================================= --- Author: Argo --- Create date: 2018-09-07 --- Description: --- ============================================= -CREATE PROCEDURE [dbo].[Proc_RejectUsers] - -- Add the parameters for the stored procedure here - @id int, - @rejectedBy varchar(50), - @rejectedReason nvarchar(50) - WITH ENCRYPTION -AS -BEGIN - -- SET NOCOUNT ON added to prevent extra result sets from - -- interfering with SELECT statements. - SET NOCOUNT ON; - SET XACT_ABORT ON; - -- Insert statements for procedure here - begin - declare @registerTime datetime - declare @userName varchar(50) - declare @displayName nvarchar(50) - select @registerTime = Registertime, @userName = UserName, @displayName = DisplayName from Users where ID = @id - - if @userName is not null - begin - begin tran - insert into RejectUsers (UserName, DisplayName, RegisterTime, RejectedBy, RejectedTime, RejectedReason) values (@userName, @displayName, @registerTime, @rejectedBy, GETDATE(), @rejectedReason) - delete from UserRole where UserId = @id - delete from UserGroup where UserId = @id - delete from users where ID = @id - commit tran - end - end -END -GO