USE [master]
GO
/****** Object:  Database [DigitalSignatureDB]    Script Date: 27-08-2020 19:28:27 ******/
CREATE DATABASE [DigitalSignatureDB]
 CONTAINMENT = NONE
 ON  PRIMARY 
( NAME = N'DigitalSignatureDB', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL15.SQLEXPRESS\MSSQL\DATA\DigitalSignatureDB.mdf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB )
 LOG ON 
( NAME = N'DigitalSignatureDB_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL15.SQLEXPRESS\MSSQL\DATA\DigitalSignatureDB_log.ldf' , SIZE = 8192KB , MAXSIZE = 2048GB , FILEGROWTH = 65536KB )
 WITH CATALOG_COLLATION = DATABASE_DEFAULT
GO
ALTER DATABASE [DigitalSignatureDB] SET COMPATIBILITY_LEVEL = 150
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [DigitalSignatureDB].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [DigitalSignatureDB] SET ANSI_NULL_DEFAULT OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET ANSI_NULLS OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET ANSI_PADDING OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET ANSI_WARNINGS OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET ARITHABORT OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET AUTO_CLOSE OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET AUTO_SHRINK OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET AUTO_UPDATE_STATISTICS ON 
GO
ALTER DATABASE [DigitalSignatureDB] SET CURSOR_CLOSE_ON_COMMIT OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET CURSOR_DEFAULT  GLOBAL 
GO
ALTER DATABASE [DigitalSignatureDB] SET CONCAT_NULL_YIELDS_NULL OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET NUMERIC_ROUNDABORT OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET QUOTED_IDENTIFIER OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET RECURSIVE_TRIGGERS OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET  DISABLE_BROKER 
GO
ALTER DATABASE [DigitalSignatureDB] SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET DATE_CORRELATION_OPTIMIZATION OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET TRUSTWORTHY OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET ALLOW_SNAPSHOT_ISOLATION OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET PARAMETERIZATION SIMPLE 
GO
ALTER DATABASE [DigitalSignatureDB] SET READ_COMMITTED_SNAPSHOT OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET HONOR_BROKER_PRIORITY OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET RECOVERY SIMPLE 
GO
ALTER DATABASE [DigitalSignatureDB] SET  MULTI_USER 
GO
ALTER DATABASE [DigitalSignatureDB] SET PAGE_VERIFY CHECKSUM  
GO
ALTER DATABASE [DigitalSignatureDB] SET DB_CHAINING OFF 
GO
ALTER DATABASE [DigitalSignatureDB] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF ) 
GO
ALTER DATABASE [DigitalSignatureDB] SET TARGET_RECOVERY_TIME = 60 SECONDS 
GO
ALTER DATABASE [DigitalSignatureDB] SET DELAYED_DURABILITY = DISABLED 
GO
ALTER DATABASE [DigitalSignatureDB] SET QUERY_STORE = OFF
GO
USE [DigitalSignatureDB]
GO
/****** Object:  Table [dbo].[__EFMigrationsHistory]    Script Date: 27-08-2020 19:28:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[__EFMigrationsHistory](
	[MigrationId] [nvarchar](150) NOT NULL,
	[ProductVersion] [nvarchar](32) NOT NULL,
 CONSTRAINT [PK___EFMigrationsHistory] PRIMARY KEY CLUSTERED 
(
	[MigrationId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Categories]    Script Date: 27-08-2020 19:28:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Categories](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](max) NULL,
	[Description] [nvarchar](max) NULL,
 CONSTRAINT [PK_Categories] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Products]    Script Date: 27-08-2020 19:28:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Products](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](max) NULL,
	[Description] [nvarchar](max) NULL,
	[Price] [nvarchar](max) NULL,
	[CategoryId] [int] NOT NULL,
 CONSTRAINT [PK_Products] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[tbl_Document]    Script Date: 27-08-2020 19:28:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_Document](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[DocumentDetail] [nvarchar](50) NULL,
	[Status] [int] NULL,
	[ProcessId] [int] NULL,
	[OriginatorId] [int] NULL,
 CONSTRAINT [PK_tbl_Document] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[tbl_DocUser]    Script Date: 27-08-2020 19:28:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_DocUser](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[DocumentId] [int] NULL,
	[UserId] [int] NULL,
 CONSTRAINT [PK_tbl_DocUser] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[tbl_Process]    Script Date: 27-08-2020 19:28:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_Process](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[ProcessName] [nvarchar](50) NULL,
	[ProcessDetails] [nvarchar](50) NULL,
	[ProcessStatus] [nvarchar](50) NULL,
 CONSTRAINT [PK_tbl_Process] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[tbl_Roles]    Script Date: 27-08-2020 19:28:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_Roles](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Role] [nvarchar](50) NULL,
	[Isdeleted] [int] NULL,
 CONSTRAINT [PK_tbl_Roles] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[tbl_Sign]    Script Date: 27-08-2020 19:28:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_Sign](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[UserId] [int] NULL,
	[Sign] [nvarchar](max) NULL,
 CONSTRAINT [PK_tbl_Sign] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[tbl_User]    Script Date: 27-08-2020 19:28:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_User](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Username] [nvarchar](50) NULL,
	[Password] [nvarchar](50) NULL,
	[Isactive] [int] NULL,
	[Isdeleted] [int] NULL,
	[Userrole] [int] NULL,
	[Token] [nvarchar](50) NULL,
	[Name] [nvarchar](50) NULL,
	[Email] [nvarchar](50) NULL,
	[Phone] [nvarchar](50) NULL,
	[Address] [nvarchar](100) NULL,
	[Ismale] [int] NULL,
	[CompanyDetail] [nvarchar](50) NULL,
	[ProfileImg] [nvarchar](max) NULL,
	[FbDetail] [nvarchar](50) NULL,
	[GoogleDetail] [nvarchar](50) NULL,
	[MicrosoftDetail] [nvarchar](50) NULL,
	[TwitterDetail] [nvarchar](50) NULL,
 CONSTRAINT [PK_tbl_User] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  StoredProcedure [dbo].[RetrieveProductDetails]    Script Date: 27-08-2020 19:28:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[RetrieveProductDetails]
	-- Add the parameters for the stored procedure here
	 @ProdCode int
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	SELECT P.Id, P.[Name] AS ProductName,C.[Name] AS CategoryName FROM Products P INNER JOIN Categories C ON P.CategoryId=C.Id;
END
GO
USE [master]
GO
ALTER DATABASE [DigitalSignatureDB] SET  READ_WRITE 
GO
