USE [master] GO /****** Object: Database [Aldawha] Script Date: 12/15/2010 16:56:30 ******/ CREATE DATABASE [Aldawha] ON PRIMARY ( NAME = N'Aldawha', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\Aldawha.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) LOG ON ( NAME = N'Aldawha_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\Aldawha_1.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%) GO ALTER DATABASE [Aldawha] SET COMPATIBILITY_LEVEL = 90 GO IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled')) begin EXEC [Aldawha].[dbo].[sp_fulltext_database] @action = 'enable' end GO ALTER DATABASE [Aldawha] SET ANSI_NULL_DEFAULT OFF GO ALTER DATABASE [Aldawha] SET ANSI_NULLS OFF GO ALTER DATABASE [Aldawha] SET ANSI_PADDING OFF GO ALTER DATABASE [Aldawha] SET ANSI_WARNINGS OFF GO ALTER DATABASE [Aldawha] SET ARITHABORT OFF GO ALTER DATABASE [Aldawha] SET AUTO_CLOSE ON GO ALTER DATABASE [Aldawha] SET AUTO_CREATE_STATISTICS ON GO ALTER DATABASE [Aldawha] SET AUTO_SHRINK OFF GO ALTER DATABASE [Aldawha] SET AUTO_UPDATE_STATISTICS ON GO ALTER DATABASE [Aldawha] SET CURSOR_CLOSE_ON_COMMIT OFF GO ALTER DATABASE [Aldawha] SET CURSOR_DEFAULT GLOBAL GO ALTER DATABASE [Aldawha] SET CONCAT_NULL_YIELDS_NULL OFF GO ALTER DATABASE [Aldawha] SET NUMERIC_ROUNDABORT OFF GO ALTER DATABASE [Aldawha] SET QUOTED_IDENTIFIER OFF GO ALTER DATABASE [Aldawha] SET RECURSIVE_TRIGGERS OFF GO ALTER DATABASE [Aldawha] SET DISABLE_BROKER GO ALTER DATABASE [Aldawha] SET AUTO_UPDATE_STATISTICS_ASYNC OFF GO ALTER DATABASE [Aldawha] SET DATE_CORRELATION_OPTIMIZATION OFF GO ALTER DATABASE [Aldawha] SET TRUSTWORTHY OFF GO ALTER DATABASE [Aldawha] SET ALLOW_SNAPSHOT_ISOLATION OFF GO ALTER DATABASE [Aldawha] SET PARAMETERIZATION SIMPLE GO ALTER DATABASE [Aldawha] SET READ_COMMITTED_SNAPSHOT OFF GO ALTER DATABASE [Aldawha] SET HONOR_BROKER_PRIORITY OFF GO ALTER DATABASE [Aldawha] SET READ_WRITE GO ALTER DATABASE [Aldawha] SET RECOVERY SIMPLE GO ALTER DATABASE [Aldawha] SET MULTI_USER GO ALTER DATABASE [Aldawha] SET PAGE_VERIFY CHECKSUM GO ALTER DATABASE [Aldawha] SET DB_CHAINING OFF GO USE [Aldawha] GO /****** Object: Table [dbo].[tbl_Vidio] Script Date: 12/15/2010 16:56:31 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[tbl_Vidio]( [V_ID] [bigint] IDENTITY(1,1) NOT NULL, [V_EName] [nvarchar](500) NULL, [V_Date] [datetime] NULL, [V_Link] [nvarchar](500) NULL, [V_NOVisitor] [int] NULL, CONSTRAINT [PK_tbl_Vidio] PRIMARY KEY CLUSTERED ( [V_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[tbl_Images] Script Date: 12/15/2010 16:56:31 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[tbl_Images]( [IM_ID] [bigint] IDENTITY(1,1) NOT NULL, [IG_ID] [int] NULL, [IM_Description] [nvarchar](500) NULL, [IM_File] [nvarchar](250) NULL, [InsertUserID] [int] NULL, [InsertDate] [datetime] NULL, [UpdateUserID] [int] NULL, [UpdateDate] [datetime] NULL, CONSTRAINT [PK_tbl_Images] PRIMARY KEY CLUSTERED ( [IM_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[tbl_ImageCategory] Script Date: 12/15/2010 16:56:31 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[tbl_ImageCategory]( [IG_ID] [int] IDENTITY(1,1) NOT NULL, [IG_Name] [nvarchar](500) NULL, [InsertUserID] [int] NULL, [InsertDate] [datetime] NULL, [UpdateUserID] [int] NULL, [UpdateDate] [datetime] NULL, CONSTRAINT [PK_tbl_ImageCategory] PRIMARY KEY CLUSTERED ( [IG_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[tbl_General_Data] Script Date: 12/15/2010 16:56:31 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[tbl_General_Data]( [GD_ID] [int] IDENTITY(1,1) NOT NULL, [GD_Name] [nvarchar](350) NULL, [GD_Description] [ntext] NULL, CONSTRAINT [PK_tbl_General_Data] PRIMARY KEY CLUSTERED ( [GD_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO /****** Object: Table [dbo].[tbl_Gallery] Script Date: 12/15/2010 16:56:31 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[tbl_Gallery]( [G_ID] [bigint] IDENTITY(1,1) NOT NULL, [GT_ID] [bigint] NOT NULL, [G_EName] [nvarchar](500) NULL, [G_Image] [nvarchar](500) NULL, CONSTRAINT [PK_tbl_Gallery] PRIMARY KEY CLUSTERED ( [G_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[tbl_GallaryType] Script Date: 12/15/2010 16:56:31 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[tbl_GallaryType]( [GT_ID] [int] IDENTITY(1,1) NOT NULL, [GT_EName] [nvarchar](500) NULL, [GT_Date] [datetime] NULL, [GT_Image] [nvarchar](500) NULL, CONSTRAINT [PK_tbl_GallaryType] PRIMARY KEY CLUSTERED ( [GT_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[tbl_Events] Script Date: 12/15/2010 16:56:31 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[tbl_Events]( [E_ID] [int] IDENTITY(1,1) NOT NULL, [E_Name] [nvarchar](500) NULL, [E_Date] [datetime] NULL, [E_BriefDesc] [ntext] NULL, [E_Desc] [ntext] NULL, [E_Image] [nvarchar](500) NULL, [E_ShowInHome] [int] NULL, [E_Type] [int] NULL, [E_Lang] [int] NULL, CONSTRAINT [PK_tbl_Events] PRIMARY KEY CLUSTERED ( [E_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO /****** Object: Table [dbo].[tbl_Comments] Script Date: 12/15/2010 16:56:31 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[tbl_Comments]( [C_ID] [bigint] IDENTITY(1,1) NOT NULL, [E_ID] [bigint] NULL, [C_Name] [nvarchar](250) NULL, [C_Text] [ntext] NULL, [C_Active] [int] NULL, [C_Date] [datetime] NULL, CONSTRAINT [PK_tbl_Comments] PRIMARY KEY CLUSTERED ( [C_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO /****** Object: Table [dbo].[tbl_Category] Script Date: 12/15/2010 16:56:31 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[tbl_Category]( [C_ID] [int] IDENTITY(1,1) NOT NULL, [C_EName] [nvarchar](250) NOT NULL, [C_AName] [nvarchar](250) NOT NULL, CONSTRAINT [PK_tbl_Category] PRIMARY KEY CLUSTERED ( [C_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[tbl_AGENCIES] Script Date: 12/15/2010 16:56:31 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[tbl_AGENCIES]( [Company_name] [varchar](100) NULL, [Company_country] [varchar](50) NULL, [Company_description] [varchar](1000) NULL, [Company_ID] [int] IDENTITY(1,1) NOT NULL, [Company_image] [varchar](100) NULL, [Company_url] [varchar](200) NULL, [FAMILY] [int] NULL, CONSTRAINT [PK_tbl_AGENCIES] PRIMARY KEY CLUSTERED ( [Company_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO /****** Object: Table [dbo].[tbl_ads] Script Date: 12/15/2010 16:56:31 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[tbl_ads]( [id] [int] IDENTITY(1,1) NOT NULL, [image] [nvarchar](150) NULL, [url] [nvarchar](250) NULL, CONSTRAINT [PK_tbl_ads1] PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[tbl_Admins] Script Date: 12/15/2010 16:56:31 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[tbl_Admins]( [A_ID] [int] IDENTITY(1,1) NOT NULL, [A_FullName] [nvarchar](250) NOT NULL, [A_UserName] [nvarchar](250) NOT NULL, [A_Password] [nvarchar](250) NOT NULL, [A_Status] [int] NOT NULL, CONSTRAINT [PK_tbl_Admins] PRIMARY KEY CLUSTERED ( [A_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: Table [dbo].[tb_Customers] Script Date: 12/15/2010 16:56:31 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[tb_Customers]( [customer_ID] [int] IDENTITY(1,1) NOT NULL, [customer_name] [nvarchar](100) NULL, [customer_description] [nvarchar](300) NULL, [customer_image] [varchar](100) NULL, [customer_url] [varchar](200) NULL, CONSTRAINT [PK_tb_Customers] PRIMARY KEY CLUSTERED ( [customer_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO /****** Object: StoredProcedure [dbo].[sp_Branches_Update] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[sp_Branches_Update] ( @id int, @AName nvarchar(250), @EName nvarchar(250), @AAdress nvarchar(250), @EAdress nvarchar(250), @Tel nvarchar(250), @Mob nvarchar(250) ) as UPDATE tbl_Branches SET AName = @AName , EName = @EName , AAdress = @AAdress , EAdress = @EAdress , Tel = @Tel , Mob = @Mob WHERE id=@id GO /****** Object: StoredProcedure [dbo].[sp_Branches_SelectOne] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[sp_Branches_SelectOne] ( @id int ) as select * from tbl_Branches where id=@id GO /****** Object: Table [dbo].[E_CompanyData] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[E_CompanyData]( [CD_ID] [int] NOT NULL, [CD_EDataTypeName] [nvarchar](250) NULL, [CD_EDataTypeText] [ntext] NULL, [CD_Image] [nvarchar](500) NULL, [CD_Parant] [int] NULL, [CD_Active] [int] NULL, [CD_Arrange] [int] NULL, CONSTRAINT [PK_E_CompanyData] PRIMARY KEY CLUSTERED ( [CD_ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO /****** Object: Table [dbo].[Depertement] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Depertement]( [ID] [int] NULL, [EName] [nvarchar](250) NULL, [AName] [nvarchar](250) NULL ) ON [PRIMARY] GO /****** Object: Table [dbo].[Agency_family] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Agency_family]( [id] [int] NOT NULL, [Family] [nvarchar](500) NULL, CONSTRAINT [PK_Agency_family] PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO /****** Object: StoredProcedure [dbo].[updateAds] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[updateAds] ( @id int, @Image nvarchar(150), @url nvarchar(250) ) as update tbl_ads set [Image]=@Image, url=@url where id=@id GO /****** Object: StoredProcedure [dbo].[update_agency] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[update_agency] @cid int, @comp_name varchar(50), @country varchar(50), @comp_description varchar(500), @comp_image varchar(50), @comp_url varchar(50), @comp_Famly int AS update tbl_AGENCIES set Company_name=@comp_name , Company_country=@country,Company_description=@comp_description ,Company_image=@comp_image,Company_url=@comp_url ,FAMILY=@comp_Famly where Company_ID=@cid RETURN GO /****** Object: StoredProcedure [dbo].[Agenciey_Update] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[Agenciey_Update] @id int, @name varchar(50), @comp varchar(50), @desc varchar(500) AS update tbl_AGENCIES set Company_name=@name,Company_country=@comp, Company_description=@desc where Company_ID=@id RETURN GO /****** Object: StoredProcedure [dbo].[Agenciey_Delete] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[Agenciey_Delete] @CID int AS delete from tbl_AGENCIES where Company_ID=@CID RETURN GO /****** Object: StoredProcedure [dbo].[add_customer] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[add_customer] @customer_name varchar(50), @customer_description varchar(500), @customer_image varchar(50), @customer_url varchar(50) AS insert into tb_Customers(customer_name,customer_description,customer_image,customer_url) values (@customer_name,@customer_description,@customer_image,@customer_url) RETURN GO /****** Object: StoredProcedure [dbo].[add_agenciy] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[add_agenciy] @comp_name varchar(50), @country varchar(50), @comp_description varchar(500), @comp_image varchar(50), @comp_url varchar(50), @comp_Famly int AS insert into tbl_AGENCIES(Company_name,Company_country,Company_description,Company_image,Company_url,FAMILY) values (@comp_name,@country,@comp_description,@comp_image,@comp_url,@comp_Famly) RETURN GO /****** Object: StoredProcedure [dbo].[DeleteAds] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[DeleteAds] ( @id int ) as Delete tbl_ads where id=@id GO /****** Object: StoredProcedure [dbo].[customer_update] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[customer_update] @cid int, @customer_name varchar(50), @customer_description varchar(500), @customer_image varchar(50), @customer_url varchar(50) AS update tb_Customers set customer_name=@customer_name ,customer_description=@customer_description ,customer_image=@customer_image,customer_url=@customer_url where customer_ID=@cid RETURN GO /****** Object: StoredProcedure [dbo].[Customer_Delete] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[Customer_Delete] @Customer_ID int AS delete from tb_Customers where Customer_ID=@Customer_ID RETURN GO /****** Object: StoredProcedure [dbo].[selectoneagency] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[selectoneagency] @id int AS /* SET NOCOUNT ON */ select * from tbl_AGENCIES where Company_ID=@id RETURN GO /****** Object: StoredProcedure [dbo].[selectoneag] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[selectoneag] @id int AS select * from tbl_AGENCIES where Company_ID =@ID RETURN GO /****** Object: StoredProcedure [dbo].[selectallagen] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[selectallagen] AS select * from tbl_AGENCIES RETURN GO /****** Object: StoredProcedure [dbo].[select_sub_menu] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[select_sub_menu] @id int AS select * from E_CompanyData where CD_Parant in(select CD_Parant from E_CompanyData where CD_ID=@id and CD_Parant!=0) GO /****** Object: StoredProcedure [dbo].[select_one_flash] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[select_one_flash] @id int AS select * from Agency_family where id =@id RETURN GO /****** Object: StoredProcedure [dbo].[select_one_customer] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[select_one_customer] @id int AS select * from tb_Customers where customer_ID =@ID RETURN GO /****** Object: StoredProcedure [dbo].[select_grid_agency] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[select_grid_agency] ( @FAMILY int ) AS select * from tbl_AGENCIES where FAMILY=@FAMILY RETURN GO /****** Object: StoredProcedure [dbo].[select_all_customer] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[select_all_customer] AS select * from tb_Customers RETURN GO /****** Object: StoredProcedure [dbo].[search_all] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[search_all] @keyword varchar(50) AS select CD_EDataTypeName as Result_title,CD_ID as link ,'' as description,'pages.aspx?id=' as pagelink from E_CompanyData as typee where CD_EDataTypeName like '%'+@keyword+'%' or CD_EDataTypeText like '%'+@keyword+'%' union all select Company_name as Result_title,FAMILY as link,'Family of Principals' as description,'flash.aspx?id=' as pagelink from tbl_AGENCIES where Company_name like '%'+@keyword+'%' or Company_description like '%'+@keyword+'%' union all select customer_name as Result_title,customer_ID as link,'Clients' as description,'CUSTOMERS.aspx?id=' as pagelink from tb_Customers where customer_name like '%'+@keyword+'%' or customer_description like '%'+@keyword+'%' union all select E_Name as Result_title,E_ID as link,'Events' as description,'EventsDetails.aspx?type=1&id=' as pagelink from tbl_Events where E_Type=1 and E_Lang=2 and ( E_Name like '%'+@keyword+'%' or E_Desc like '%'+@keyword+'%') union all select E_Name as Result_title,E_ID as link,'Blogs' as description,'EventsDetails.aspx?type=2&id=' as pagelink from tbl_Events where E_Type=2 and E_Lang=2 and ( E_Name like '%'+@keyword+'%' or E_Desc like '%'+@keyword+'%') GO /****** Object: StoredProcedure [dbo].[IsAdmin] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create procedure [dbo].[IsAdmin] ( @A_UserName nvarchar(250), @A_Password nvarchar(250) ) as if exists (select A_ID from tbl_Admins where A_UserName=@A_UserName and A_Password=@A_Password and A_Status=1) begin select A_ID from tbl_Admins where A_UserName=@A_UserName and A_Password=@A_Password and A_Status=1 end else begin select'0' end GO /****** Object: StoredProcedure [dbo].[InsertAds] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[InsertAds] ( @Image nvarchar(150), @url nvarchar(250) ) as insert into tbl_ads ([Image],url) values(@Image,@url) GO /****** Object: StoredProcedure [dbo].[GetNews] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[GetNews] as select E_ID,E_Name,E_Image from tbl_Events where E_ShowInHome=1 and E_Type=1 and E_Lang=2 order by E_ID desc GO /****** Object: StoredProcedure [dbo].[GetAGENCIESForhome] Script Date: 12/15/2010 16:56:52 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[GetAGENCIESForhome] as select top 3 FAMILY,Company_image,Company_url,Company_ID,SUBSTRING(Company_description,0,300) as Company_description from tbl_AGENCIES where Company_image is not null and Company_image!='' and Company_url is not null and Company_url!='' order by NEWID() GO /****** Object: StoredProcedure [dbo].[getAds] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[getAds] ( @id int=null ) as select * from tbl_ads where id=isnull(@id,id) GO /****** Object: StoredProcedure [dbo].[Events_Update] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[Events_Update] ( @E_ID int, @E_Name nvarchar(500), @E_Date datetime, @E_BriefDesc ntext, @E_Desc ntext, @E_ShowInHome int, @E_Image nvarchar(500)=null, @E_Lang int ) as update tbl_Events set E_Name=@E_Name ,E_Date=@E_Date ,E_Desc=@E_Desc ,E_BriefDesc=@E_BriefDesc ,E_ShowInHome=@E_ShowInHome ,E_Image=isnull(@E_Image,E_Image) ,E_Lang=@E_Lang where E_ID=@E_ID GO /****** Object: StoredProcedure [dbo].[Events_SelectAll] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[Events_SelectAll] ( @E_ShowInHome int = null, @E_Type int, @E_Lang int ) as select * from tbl_Events where E_ShowInHome=isnull(@E_ShowInHome,E_ShowInHome) and E_Type=@E_Type and E_Lang=@E_Lang order by E_ID desc GO /****** Object: StoredProcedure [dbo].[Events_Add] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[Events_Add] ( @E_Name nvarchar(500), @E_Date datetime, @E_BriefDesc ntext, @E_Desc ntext, @E_Image nvarchar(500), @E_ShowInHome int, @E_Type int, @E_Lang int ) as INSERT INTO tbl_Events (E_Name ,E_Date ,E_BriefDesc ,E_Desc ,E_Image ,E_ShowInHome ,E_Lang ,E_Type) VALUES (@E_Name, @E_Date , @E_BriefDesc, @E_Desc , @E_Image, @E_ShowInHome ,@E_Lang ,@E_Type ) select @@identity GO /****** Object: StoredProcedure [dbo].[E_CompanyData_Update] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE procedure [dbo].[E_CompanyData_Update] ( @CD_ID int, @CD_EDataTypeName nvarchar(250), @CD_EDataTypeText ntext, @CD_Image nvarchar(500)=null ) as update E_CompanyData set CD_EDataTypeName=@CD_EDataTypeName, CD_EDataTypeText=@CD_EDataTypeText , CD_Image=isnull(@CD_Image ,CD_Image) where CD_ID=@CD_ID GO /****** Object: StoredProcedure [dbo].[E_CompanyData_SelectOne] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create procedure [dbo].[E_CompanyData_SelectOne] ( @CD_ID int ) as select * from E_CompanyData where CD_ID=@CD_ID GO /****** Object: StoredProcedure [dbo].[E_CompanyData_SelectAll] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE procedure [dbo].[E_CompanyData_SelectAll] ( @CD_Parant int ) as select * from E_CompanyData GO /****** Object: StoredProcedure [dbo].[sp_Vidio_SelectOne] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create procedure [dbo].[sp_Vidio_SelectOne] ( @V_ID bigint ) as select * from tbl_Vidio where V_ID =@V_ID GO /****** Object: StoredProcedure [dbo].[sp_Vidio_SelectAll] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE procedure [dbo].[sp_Vidio_SelectAll] as select * from tbl_Vidio order by V_ID desc GO /****** Object: StoredProcedure [dbo].[sp_Vidio_Delete] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create procedure [dbo].[sp_Vidio_Delete] ( @V_ID bigint ) as delete from tbl_Vidio where V_ID=@V_ID GO /****** Object: StoredProcedure [dbo].[sp_Vidio_Add] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE procedure [dbo].[sp_Vidio_Add] ( @V_Link nvarchar(500), @V_EName nvarchar(500) ) as insert into tbl_Vidio ( V_Date ,V_Link ,V_EName) values ( getdate(), @V_Link, @V_EName ) GO /****** Object: StoredProcedure [dbo].[SP_Menu_Move] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create PROCEDURE [dbo].[SP_Menu_Move] ( @ID int, @down bit ) as declare @oldoid int set @oldoid=(select CD_Arrange from E_CompanyData where CD_ID=@id and CD_Parant=1) declare @pid int if(@down=1) begin if exists (select CD_Arrange from E_CompanyData where CD_Arrange>@oldoid and CD_Parant=1) begin set @pid=(select top 1 CD_ID from E_CompanyData where CD_Arrange>@oldoid and CD_Parant=1 order by CD_Arrange asc) update E_CompanyData set CD_Arrange=(select CD_Arrange from E_CompanyData where CD_ID=@pid and CD_Parant=1) where CD_ID=@id update E_CompanyData set CD_Arrange=@oldoid where CD_ID=@pid end end else begin if exists (select CD_Arrange from E_CompanyData where CD_Arrange<@oldoid and CD_Parant=1) begin set @pid=(select top 1 CD_ID from E_CompanyData where CD_Arrange<@oldoid and CD_Parant=1 order by CD_Arrange desc) update E_CompanyData set CD_Arrange=(select CD_Arrange from E_CompanyData where CD_ID=@pid and CD_Parant=1)where CD_ID=@id update E_CompanyData set CD_Arrange=@oldoid where CD_ID=@pid end end GO /****** Object: StoredProcedure [dbo].[sp_Images_SelectAll] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[sp_Images_SelectAll] ( @IM_Description nvarchar(500), @IG_ID int=null ) as select * from tbl_Images,tbl_ImageCategory where tbl_Images.IG_ID=tbl_ImageCategory.IG_ID and IM_Description like ('%'+@IM_Description+'%') and tbl_Images.IG_ID=isnull(@IG_ID,tbl_Images.IG_ID) order by IM_ID desc GO /****** Object: StoredProcedure [dbo].[sp_Images_Delete] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[sp_Images_Delete] ( @IM_ID nvarchar(250) ) as if exists (select G_Image from tbl_Gallery where G_Image=@IM_ID) begin select 'no' end else if exists (select GT_Image from tbl_GallaryType where GT_Image=@IM_ID) begin select 'no' end else if exists (select E_Image from tbl_Events where E_Image=@IM_ID) begin select 'no' end else if exists (select CD_Image from E_CompanyData where CD_Image=@IM_ID) begin select 'no' end else begin DELETE FROM tbl_Images WHERE IM_File=@IM_ID select 'yes' end GO /****** Object: StoredProcedure [dbo].[sp_Images_Add] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[sp_Images_Add] ( @IM_Description nvarchar(500), @IM_File nvarchar(250), @IG_ID int, @InsertUserID int ) as INSERT INTO tbl_Images (IM_Description ,IM_File, IG_ID, InsertUserID ,InsertDate) VALUES (@IM_Description , @IM_File, @IG_ID, @InsertUserID, getdate() ) GO /****** Object: StoredProcedure [dbo].[sp_ImageCategory_Update] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[sp_ImageCategory_Update] ( @IG_ID int, @IG_Name nvarchar(500), @UpdateUserID int ) as UPDATE tbl_ImageCategory SET IG_Name = @IG_Name ,UpdateUserID = @UpdateUserID ,UpdateDate = getdate() WHERE IG_ID=@IG_ID GO /****** Object: StoredProcedure [dbo].[sp_ImageCategory_SelectAll] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[sp_ImageCategory_SelectAll] as select * from tbl_ImageCategory order by IG_ID desc GO /****** Object: StoredProcedure [dbo].[sp_ImageCategory_Delete] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[sp_ImageCategory_Delete] ( @IG_ID int ) as if exists (select IM_ID from tbl_Images where tbl_Images.IG_ID=@IG_ID) begin select 'no' end else begin DELETE FROM tbl_ImageCategory where IG_ID=@IG_ID select 'yes' end GO /****** Object: StoredProcedure [dbo].[sp_ImageCategory_Add] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[sp_ImageCategory_Add] ( @IG_Name nvarchar(500), @InsertUserID int ) as INSERT INTO tbl_ImageCategory (IG_Name ,InsertUserID ,InsertDate ) VALUES (@IG_Name , @InsertUserID , getdate() ) GO /****** Object: StoredProcedure [dbo].[SP_General_Data_Save] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[SP_General_Data_Save] ( @GD_ID int, @GD_Description ntext ) as UPDATE tbl_General_Data SET GD_Description = @GD_Description WHERE GD_ID=@GD_ID GO /****** Object: StoredProcedure [dbo].[sp_Gallery_SelectAll] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create procedure [dbo].[sp_Gallery_SelectAll] ( @GT_ID bigint ) as select * from tbl_Gallery where GT_ID=@GT_ID GO /****** Object: StoredProcedure [dbo].[sp_Gallery_Delete] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create procedure [dbo].[sp_Gallery_Delete] ( @G_ID bigint ) as delete from tbl_Gallery where G_ID=@G_ID GO /****** Object: StoredProcedure [dbo].[sp_Gallery_add] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[sp_Gallery_add] ( @GT_ID bigint, @G_Image nvarchar(500), @G_EName nvarchar(500) ) as INSERT INTO tbl_Gallery (GT_ID ,G_Image ,G_EName) VALUES ( @GT_ID , @G_Image , @G_EName ) GO /****** Object: StoredProcedure [dbo].[sp_GallaryType_Update] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE procedure [dbo].[sp_GallaryType_Update] ( @GT_ID bigint, @GT_Name nvarchar(500) ) as update tbl_GallaryType set GT_EName=@GT_Name where GT_ID=@GT_ID GO /****** Object: StoredProcedure [dbo].[sp_GallaryType_SelectOne] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create procedure [dbo].[sp_GallaryType_SelectOne] ( @GT_ID bigint ) as select * from tbl_GallaryType where GT_ID =@GT_ID GO /****** Object: StoredProcedure [dbo].[sp_GallaryType_SelectAll] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create procedure [dbo].[sp_GallaryType_SelectAll] as select * from tbl_GallaryType order by GT_ID desc GO /****** Object: StoredProcedure [dbo].[sp_GallaryType_Delete] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE procedure [dbo].[sp_GallaryType_Delete] ( @GT_ID bigint ) as delete from tbl_GallaryType where GT_ID=@GT_ID delete from tbl_Gallery where GT_ID=@GT_ID GO /****** Object: StoredProcedure [dbo].[sp_GallaryType_Add] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE procedure [dbo].[sp_GallaryType_Add] ( @GT_Image nvarchar(500), @GT_EName nvarchar(500) ) as insert into tbl_GallaryType ( GT_Date ,GT_Image ,GT_EName) values ( getdate(), @GT_Image, @GT_EName ) GO /****** Object: StoredProcedure [dbo].[sp_delete_static_page] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[sp_delete_static_page] @id int AS delete from E_CompanyData where CD_ID =@id RETURN GO /****** Object: StoredProcedure [dbo].[sp_CompanyData_Add] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[sp_CompanyData_Add] ( @CD_EDataTypeName nvarchar(250), @CD_EDataTypeText ntext, @CD_Image nvarchar(500) ) as declare @Max int set @Max= (select max(CD_Arrange) from E_CompanyData where CD_Parant=1) + 1 INSERT INTO E_CompanyData (CD_EDataTypeName ,CD_EDataTypeText ,CD_Image ,CD_Parant ,CD_Active ,CD_Arrange) VALUES ( @CD_EDataTypeName , @CD_EDataTypeText , @CD_Image, 1 , 1 , @Max ) GO /****** Object: StoredProcedure [dbo].[sp_Comments_SelectAll] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE proc [dbo].[sp_Comments_SelectAll] ( @E_ID int=null, @C_Active int=null ) as select C_ID,tbl_Comments.E_ID,C_Name,C_Text,C_Active,C_Date,E_Name from tbl_Comments,tbl_Events where tbl_Comments.E_ID=isnull( @E_ID,tbl_Comments.E_ID) and C_Active=isnull(@C_Active,C_Active) and E_Type=2 and tbl_Comments.E_ID=tbl_Events.E_ID GO /****** Object: StoredProcedure [dbo].[sp_Comments_Add] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create proc [dbo].[sp_Comments_Add] ( @E_ID bigint, @C_Name nvarchar(250), @C_Text ntext, @C_Active int ) as INSERT INTO tbl_Comments (E_ID ,C_Name ,C_Text ,C_Active) VALUES ( @E_ID , @C_Name , @C_Text , @C_Active ) GO /****** Object: StoredProcedure [dbo].[SP_Category_SelectAll] Script Date: 12/15/2010 16:56:53 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO create procedure [dbo].[SP_Category_SelectAll] as select * from tbl_Category GO /****** Object: Default [DF_tbl_Vidio_V_NOVisitor] Script Date: 12/15/2010 16:56:31 ******/ ALTER TABLE [dbo].[tbl_Vidio] ADD CONSTRAINT [DF_tbl_Vidio_V_NOVisitor] DEFAULT ((0)) FOR [V_NOVisitor] GO /****** Object: Default [DF_tbl_Events_E_Type] Script Date: 12/15/2010 16:56:31 ******/ ALTER TABLE [dbo].[tbl_Events] ADD CONSTRAINT [DF_tbl_Events_E_Type] DEFAULT ((0)) FOR [E_Type] GO /****** Object: Default [DF_tbl_Comments_C_Date] Script Date: 12/15/2010 16:56:31 ******/ ALTER TABLE [dbo].[tbl_Comments] ADD CONSTRAINT [DF_tbl_Comments_C_Date] DEFAULT (getdate()) FOR [C_Date] GO