insert into [dbo].[Property_Feature_Mapping](FeatureId, PropertyId, FeatureValue)values(@hoaid,@rndnmb,@hoa)

if(isnull(@garageid,'')<>'' and isnull(@garage,'')<>'')
insert into [dbo].[Property_Feature_Mapping](FeatureId, PropertyId, FeatureValue)values(@garageid,@rndnmb,@garage)
end

----------------------------------------------------
if(@@ERROR>0)
begin
Rollback transaction t
end
else
begin
commit transaction t
end
----------------------------------------------------
set @x=@x+1
end

end




insert into [dbo].[Property_tbl]([PropertyId],[MLSNumber],[DateOnMarker],[Address],[City],[State],[PostCode],[Price],[Area],[AreaUnit],[PropertyTypeId],PerAreaPrice,PerAreaUnit,YearBuilt,[LOTArea],[LOTAreaUnit],Property_Status,Propertyfor)
select @rndnmb,[MLSNumber],DateOnMarker,[Address],[City],[State],[Zip],ListingPrice,SqrFt,@tmpUnit,@ptypeid,Listing_Price_Per_SqrFt,@tmpUnit,YearBuilt,Lot_Sqrft,@tmpUnit,0,@Propertyfor from @temp where [Row]=@x




GO
/****** Object:  StoredProcedure [dbo].[insertUsrType]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[insertUsrType]
(
@Uid int,
@UserTypeName varchar(50)=null
)
as
begin
insert into dbo.User_Type(Uid,UserTypeName)
values(@Uid,@UserTypeName)
end





GO
/****** Object:  StoredProcedure [dbo].[InvocePublicMarketDetailsForPayment]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[InvocePublicMarketDetailsForPayment]
(
@InvoiceId varchar(50)
)
as
begin
declare @FromDate datetime,@ToDate datetime,@UserId varchar(50)
if Exists(Select * from [dbo].[InvocePublicMarket_tbl] where [InvoiceId]=@InvoiceId)
begin
select @FromDate=[FromDate],@ToDate=[ToDate],@UserId=UserId from [dbo].[InvocePublicMarket_tbl] where [InvoiceId]=@InvoiceId

--Update dbo.InvocePublicMarket_tbl set IsPaid=1 where [InvoiceId]=@InvoiceId
insert into InvocePublicMarketDetails 
select @InvoiceId,R.Product_Id,R.Order_Id,Isnull(R.Total,0),'ProductInOrder','HandToHand',1,R.Price,R.Qty  
from dbo.View_OrderListForProduct R where 1=1 and UploadBy_Id=@UserId
and (Convert(Date,[Order_Date]) between Convert(Date,@FromDate) and  Convert(Date,@ToDate)) 
and 
( (Order_Id not in (select Order_Id from InvocePublicMarketDetails where Ispaid=1)) and
(Product_Id not in (select Product_Id from InvocePublicMarketDetails where Ispaid=1)) )
end
end
GO
/****** Object:  StoredProcedure [dbo].[PageWiseQuery_FullTxtSearch]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create Procedure [dbo].[PageWiseQuery_FullTxtSearch]
(
@Qry nvarchar(max)='',
@OrderBy nvarchar(Max),
@Page bigint=1,
@rowsPerPage  bigint=10,
@Search varchar(500)=null,
@SearchOnColumns varchar(500)=null,
@UniqueColId varchar(200)=null,
@Schema varchar(100)=null,
@TableName varchar(100)=null

)
as
begin
declare @SQLQuery AS NVARCHAR(MAX)
declare @TOTALPage as bigint;
declare @TOTAL as bigint;
declare @ParaDefination nvarchar(Max)
declare @pageNum as bigint; 
set @pageNum=@Page; 

if(isnull(@Search,'')<>'' and isnull(@SearchOnColumns,'')<>'' and isnull(@UniqueColId,'')<>'')
begin
set @Qry=@Qry+' and ['+@UniqueColId+'] in'+'('+dbo.MyFullTextSearchNew(@Search,@Schema,@TableName,@UniqueColId,@SearchOnColumns)+')'
end
--select @TOTAL=COUNT(Restaurant_Id) from view_RestaurantList where Status=1 and Restaurant_Type=@Restaurant_Type and (Address like '%'+@Address+'%' or City like '%'+@Address+'%' or State like '%' + @Address + '%' or Country like '%' + @Address + '%');
set @ParaDefination='@TOTAL bigint=0 output'
--Set @SQLQuery='select @TOTAL=COUNT(Restaurant_Id) from view_RestaurantList where Status=1 and Restaurant_Type=@Restaurant_Type and  (Address like ''%'+@Address+'%'' or City like ''%'+@Address+'%'' or State like ''%' + @Address + '%'' or Country like ''%' + @Address + '%'')'+ @Filter;


set @SQLQuery ='Select @TOTAL=Count(*) from ('+@Qry+') A'

print @SQLQuery
EXECUTE sp_executesql @SQLQuery,@ParaDefination,@TOTAL output;
print @TOTAL

Set @SQLQuery='With SQLPaging As   ( 
    Select Top(@rowsPerPage * @pageNum) ROW_NUMBER() OVER (ORDER BY '+@OrderBy+') 
    as RowNum, * 
    FROM ('+@Qry+') A' 
	
	set @SQLQuery=@SQLQuery+') select * from SQLPaging with (nolock) where RowNum > ((@pageNum - 1) * @rowsPerPage) order by RowNum ASC'
	set @ParaDefination='@rowsPerPage bigint,@pageNum bigint'		
	EXECUTE sp_executesql @SQLQuery,@ParaDefination,@rowsPerPage,@pageNum;

---------------------------------------------Calculate Pages-------------------------
set @TOTALPage=@TOTAL%@rowsPerPage
		if(@TOTALPage=0)
		begin
			set @TOTALPage=@TOTAL/@rowsPerPage

		end
		else
		begin
			set @TOTALPage=(@TOTAL/@rowsPerPage)+1
		
		end
			SELECT @TOTAL as Total,@TOTALPage as TotalPage
--------------------------------------------------------------------------------------

end




GO
/****** Object:  StoredProcedure [dbo].[PageWiseQuery_FullTxtSearch_Inquery]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

Create Procedure [dbo].[PageWiseQuery_FullTxtSearch_Inquery]
(
@Qry nvarchar(max)='',
@OrderBy nvarchar(Max),
@Page bigint=1,
@rowsPerPage  bigint=10,
@Search varchar(500)=null,
@SearchOnColumns varchar(500)=null,
@UniqueColId varchar(200)=null
--@Schema varchar(100)=null,
--@TableName varchar(100)=null
)
as
begin
declare @SQLQuery AS NVARCHAR(MAX)
declare @TOTALPage as bigint
declare @TOTAL as bigint
declare @ParaDefination nvarchar(Max)
declare @pageNum as bigint
declare @tmpqry as varchar(Max)
set @pageNum=@Page; 

set @tmpqry=@Qry


if(isnull(@Search,'')<>'' and isnull(@SearchOnColumns,'')<>'' and isnull(@UniqueColId,'')<>'')
begin

set @Qry=@Qry+' and ['+@UniqueColId+'] in'+'('+dbo.FullTextSearchInquery(@Search,@tmpqry,@UniqueColId,@SearchOnColumns)+')'
end
--select @TOTAL=COUNT(Restaurant_Id) from view_RestaurantList where Status=1 and Restaurant_Type=@Restaurant_Type and (Address like '%'+@Address+'%' or City like '%'+@Address+'%' or State like '%' + @Address + '%' or Country like '%' + @Address + '%');
set @ParaDefination='@TOTAL bigint=0 output'
--Set @SQLQuery='select @TOTAL=COUNT(Restaurant_Id) from view_RestaurantList where Status=1 and Restaurant_Type=@Restaurant_Type and  (Address like ''%'+@Address+'%'' or City like ''%'+@Address+'%'' or State like ''%' + @Address + '%'' or Country like ''%' + @Address + '%'')'+ @Filter;


set @SQLQuery ='Select @TOTAL=Count(*) from ('+@Qry+') A'

print @SQLQuery
EXECUTE sp_executesql @SQLQuery,@ParaDefination,@TOTAL output;
print @TOTAL

Set @SQLQuery='With SQLPaging As   ( 
    Select Top(@rowsPerPage * @pageNum) ROW_NUMBER() OVER (ORDER BY '+@OrderBy+') 
    as RowNum, * 
    FROM ('+@Qry+') A' 
	
	set @SQLQuery=@SQLQuery+') select * from SQLPaging with (nolock) where RowNum > ((@pageNum - 1) * @rowsPerPage) order by RowNum ASC'
	set @ParaDefination='@rowsPerPage bigint,@pageNum bigint'		
	EXECUTE sp_executesql @SQLQuery,@ParaDefination,@rowsPerPage,@pageNum;

---------------------------------------------Calculate Pages-------------------------
set @TOTALPage=@TOTAL%@rowsPerPage
		if(@TOTALPage=0)
		begin
			set @TOTALPage=@TOTAL/@rowsPerPage

		end
		else
		begin
			set @TOTALPage=(@TOTAL/@rowsPerPage)+1
		
		end
			SELECT @TOTAL as Total,@TOTALPage as TotalPage
--------------------------------------------------------------------------------------

end




GO
/****** Object:  StoredProcedure [dbo].[Ptype_Pfor_Mapping]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[Ptype_Pfor_Mapping]
(
@PropertyTypeId varchar(50),
@PropertyFor  nvarchar(100)
)
as
begin
if(isnull(@PropertyFor,'')<>'')
begin
Delete [dbo].[PropertyType_Pfor_mapping] where PropertyTypeId=@PropertyTypeId
insert into [dbo].PropertyType_Pfor_mapping(PropertyTypeId, PropertyFor) select @PropertyTypeId,item from dbo.Splitmaster(@PropertyFor,',') where isnull(item,'')<>''
end
end

GO
/****** Object:  StoredProcedure [dbo].[Reset_Password]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[Reset_Password]
(
 @UserId nvarchar(50),
 @Password nvarchar(50)=null

)
as
begin
update dbo.Login_Table set [Password]=@Password where [UserId]=@UserId 
end




GO
/****** Object:  StoredProcedure [dbo].[Save_Property]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[Save_Property]
(

@LoginId	bigint=null,
@PropertyId	varchar(50)=null	
)
as
begin
if Not Exists(Select * from dbo.SavedProperty_tbl where LoginId=@LoginId and PropertyId=@PropertyId)
insert into dbo.SavedProperty_tbl(LoginId, PropertyId)values(@LoginId,@PropertyId)
end


GO
/****** Object:  StoredProcedure [dbo].[SaveClassifiedCategory]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[SaveClassifiedCategory]
(
@Catid varchar(50),
@CategoryName nvarchar(50) = null,
@Image varchar(100) = null
)
as
begin
if Exists(Select * from ClassifiedCategory where [Catid]=@Catid)
begin
update ClassifiedCategory set [Catid]=@Catid, [CategoryName]=@CategoryName,[Image]=@Image
where [Catid] = @Catid
end
else
begin
insert into ClassifiedCategory ([Catid],[CategoryName],[Image],[IsActive],EntryDate)values(@Catid,@CategoryName,@Image,1,GetDate())
end
end

GO
/****** Object:  StoredProcedure [dbo].[SavedFollow]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create Procedure [dbo].[SavedFollow]
(
@AgentId	varchar(50)	,
@FollowedBy	varchar(50)	
)
As
begin
if Exists (select * from Follow where AgentId=@AgentId and FollowedBy=@FollowedBy)
begin
Delete Follow where AgentId=@AgentId and FollowedBy=@FollowedBy
end
else
begin
insert into Follow (AgentId,FollowedBy)values(@AgentId,@FollowedBy)
end
end

GO
/****** Object:  StoredProcedure [dbo].[SaveInvoice]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create Procedure [dbo].[SaveInvoice]
(
@InvoiceId	varchar(50)	,
@FromDate	date,
@ToDate	date,
@UserId	varchar(50)	,
@ComsnPer decimal(18, 2)
)
as
begin
declare
@TotalAmt	decimal(18, 2)=0,
@ComsnAmt	decimal(18, 2)=0,
@PaidAmt	decimal(18, 2)=0

select @TotalAmt=Sum(ISNULL(Total,0)) from dbo.View_OrderListForProduct R where 1=1 and UploadBy_Id=@UserId 
and (Convert(Date,[Order_Date]) between Convert(Date,@FromDate) and  
Convert(Date,@ToDate)) and 
( (Order_Id not in (select Order_Id from InvocePublicMarketDetails where Ispaid=1)) 
and (Product_Id not in (select Product_Id from InvocePublicMarketDetails where Ispaid=1)) )
-----------Calculate Tax Amt-------------
set @ComsnAmt=(@ComsnPer/100)*@TotalAmt
set @PaidAmt =isnull(@TotalAmt,0)-isnull(@ComsnAmt,0)
-----------------------------------------
if(@PaidAmt>0 and @TotalAmt>0)
begin
if not Exists(Select * from [dbo].[InvocePublicMarket_tbl] where UserId=@UserId and FromDate=@FromDate and ToDate=@ToDate and IsPaid=1)
insert into [dbo].[InvocePublicMarket_tbl]
(InvoiceId, InvoiceDate, FromDate, ToDate, UserId, TotalAmt, ComsnAmt, ComsnPer, PaidAmt, IsPaid)
values
(@InvoiceId, GETDATE(), @FromDate, @ToDate, @UserId, @TotalAmt, @ComsnAmt, @ComsnPer, @PaidAmt, 0)

execute InvocePublicMarketDetailsForPayment @InvoiceId

end
select @PaidAmt
end
GO
/****** Object:  StoredProcedure [dbo].[SaveProperty]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[SaveProperty]
(
@PropertyId varchar(50),
@PropertyTitle nvarchar(200)=null,
@PropertyFor nvarchar(50) = null,
@PropertyTypeId varchar(50) = null,
@FrontImage varchar(200) = null,
@Price decimal = null,
@PriceUnit varchar(50) = null,
@Area decimal(18,2) = null,
@AreaUnit varchar(50) = null,
@PAgeId varchar(50) = null,
@Description nvarchar(Max) = null,
@Address varchar(500) = null,
@City nvarchar(100) = null,
@State nvarchar(50) = null,
@PostCode nvarchar(50) = null,
@Latitude float = null,
@Longitude float = null,
@Video varchar(50) = null,
@Contact varchar(50) = null,
@CreatedBy varchar(50) = null,
@FurnishedStatus nvarchar(50) = null,
@Features nvarchar(MAX)=null,
@PropertyImages varchar(MAx)=null,
@MLSNumber nvarchar(50)=null,
@LOTArea decimal(18,2)=null,
@LOTAreaUnit varchar(50)=null,
@YearBuilt int=null
)
as
begin

if Not Exists(Select * from  Property_tbl where PropertyId=@PropertyId)
begin
insert into Property_tbl
([PropertyId],[Property_Title],[PropertyFor],[PropertyTypeId],[FrontImage],[Price],[PriceUnit],[Area],[AreaUnit],[PAgeId],[Description],[Address],[City],[State],[PostCode],[Latitude],[Longitude],[Video],[Contact],[CreatedBy],[CreatedOn],[FurnishedStatus],Property_Status,[Featured],[IsSold],MLSNumber,LOTArea,LOTAreaUnit,YearBuilt)
values
(@PropertyId,@PropertyTitle,@PropertyFor,@PropertyTypeId,@FrontImage,@Price,@PriceUnit,@Area,@AreaUnit,@PAgeId,@Description,@Address,@City,@State,@PostCode,@Latitude,@Longitude,@Video,@Contact,@CreatedBy,GETDATE(),@FurnishedStatus,0,'True','False',@MLSNumber,@LOTArea,@LOTAreaUnit,@YearBuilt)
if(@Features<>'')
begin
Delete dbo.Property_Feature_Mapping where PropertyId=@PropertyId
Insert into dbo.Property_Feature_Mapping Select  Substring(Item, 1,Charindex('#', Item)-1) , @PropertyId,Substring(Item, Charindex('#', Item)+1, LEN(Item)) from dbo.Splitmaster(@Features,',')
end
if(@PropertyImages<>'')
begin
insert into [dbo].[Property_Images](PropertyId, PrpertyImage)select @PropertyId,item from dbo.Splitmaster(@PropertyImages,',')
end
end
end

GO
/****** Object:  StoredProcedure [dbo].[SavePropertyApi]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[SavePropertyApi]
(
@PropertyId varchar(50),
@PropertyTitle nvarchar(200)=null,
@PropertyFor nvarchar(50) = null,
@PropertyTypeId varchar(50) = null,
@FrontImage varchar(200) = null,
@Price decimal(18,2) = null,
@PriceUnit varchar(50) = null,
@Area decimal(18,2) = null,
@AreaUnit varchar(50) = null,
@PAgeId varchar(50) = null,
@Description nvarchar(Max) = null,
@Address varchar(500) = null,
@City nvarchar(100) = null,
@State nvarchar(50) = null,
@PostCode nvarchar(50) = null,
@Latitude float = null,
@Longitude float = null,
@Video varchar(50) = null,
@Contact varchar(50) = null,
@CreatedBy varchar(50) = null,
@FurnishedStatus nvarchar(50) = null,
@Features nvarchar(MAX)=null,
@PropertyImages varchar(MAx)=null,
@MLSNumber nvarchar(50)=null,
@LOTArea decimal(18,2)=null,
@LOTAreaUnit varchar(50)=null,
@YearBuilt int=null,
@Address2 nvarchar(max)=null
)
as
begin
declare @ReturnStatus nvarchar(50)=null
if exists(select UserId from [dbo].[Login_Table] where [UserId]=@CreatedBy)
begin
if Not Exists(Select * from  Property_tbl where PropertyId=@PropertyId)
begin

insert into Property_tbl
([PropertyId],[Property_Title],[PropertyFor],[PropertyTypeId],[FrontImage],[Price],[PriceUnit],[Area],[AreaUnit],[PAgeId],[Description],[Address],[City],[State],[PostCode],[Latitude],[Longitude],[Video],[Contact],[CreatedBy],[CreatedOn],[FurnishedStatus],Property_Status,[Featured],[IsSold],MLSNumber,LOTArea,LOTAreaUnit,YearBuilt,[Address2])
values
(@PropertyId,@PropertyTitle,@PropertyFor,@PropertyTypeId,@FrontImage,@Price,@PriceUnit,@Area,@AreaUnit,@PAgeId,@Description,@Address,@City,@State,@PostCode,@Latitude,@Longitude,@Video,@Contact,@CreatedBy,GETDATE(),@FurnishedStatus,0,'True','False',@MLSNumber,@LOTArea,@LOTAreaUnit,@YearBuilt,@Address2)

if(@Features<>'')
begin
Delete dbo.Property_Feature_Mapping where PropertyId=@PropertyId
Insert into dbo.Property_Feature_Mapping Select  Substring(Item, 1,Charindex('#', Item)-1) , @PropertyId,Substring(Item, Charindex('#', Item)+1, LEN(Item)) from dbo.Splitmaster(@Features,',')
end

if(@PropertyImages<>'')
begin
insert into [dbo].[Property_Images](PropertyId, PrpertyImage)select @PropertyId,item from dbo.Splitmaster(@PropertyImages,',')
end


set @ReturnStatus='Data saved successfully'
select @ReturnStatus as ReturnStatus,@PropertyId as PropertyId
end
else
begin
	set @ReturnStatus='Failed to save data'
	select @ReturnStatus as ReturnStatus,'' as PropertyId
end
end
else
begin
set @ReturnStatus='Invalid user id'
select @ReturnStatus as ReturnStatus,'' as PropertyId
end

end

GO
/****** Object:  StoredProcedure [dbo].[SavePTypeFeatureMapping]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[SavePTypeFeatureMapping]
(
@PropertyTypeId varchar(50),
@features nvarchar(Max)
)
as
begin
Delete [dbo].[ProprtyType_Feature_Mapping] where [PropertyTypeId]=@PropertyTypeId
insert into [dbo].[ProprtyType_Feature_Mapping](PropertyTypeId,FeatureId) select @PropertyTypeId,item from dbo.Splitmaster(@features,',')

end

GO
/****** Object:  StoredProcedure [dbo].[SaveRecentSearch]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[SaveRecentSearch]
(
@UniqueId	nvarchar(500)	,
@SearchId	varchar(50)	,
@SearchType	nvarchar(50)	,
@SearchName	nvarchar(500)
)
as
begin

if not Exists(Select * from dbo.RecentSearchTbl where UniqueId=@UniqueId and SearchId=@SearchId and SearchType=@SearchType)
begin
insert into dbo.RecentSearchTbl( UniqueId, SearchId, SearchType, SearchName)values(@UniqueId, @SearchId, @SearchType, @SearchName)
end

end

GO
/****** Object:  StoredProcedure [dbo].[SaveSearch]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[SaveSearch]
(
@uniqueId	nvarchar(500)	,
@Location	nvarchar(500)	,
@MinPrice	bigint	,
@MaxPrice	bigint	,
@MinBed	int	
)
as
begin
if Exists(Select uniqueid from dbo.Search_tbl where uniqueId=@uniqueId)
begin
Update dbo.Search_tbl set  Location=@Location, MinPrice=@MinPrice, MaxPrice=@MaxPrice, MinBed=@MinBed where uniqueId=@uniqueId
end
else
begin 
insert into dbo.Search_tbl(uniqueId, Location, MinPrice, MaxPrice, MinBed)values(@uniqueId, @Location, @MinPrice, @MaxPrice, @MinBed)
end

end

GO
/****** Object:  StoredProcedure [dbo].[sp_Admin_login]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  proc [dbo].[sp_Admin_login]
@username nvarchar(50) ,
@password  nvarchar(50)
as 
begin 
 select * from dbo.Admin where username=@username and password=@password
end





GO
/****** Object:  StoredProcedure [dbo].[sp_FindStringInTable]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
 
 CREATE PROCEDURE [dbo].[sp_FindStringInTable] @stringToFind VARCHAR(100), @schema sysname, @table sysname 
AS

BEGIN TRY
   DECLARE @sqlCommand varchar(max) = 'SELECT * FROM [' + @schema + '].[' + @table + '] WHERE ' 
	   
   SELECT @sqlCommand = @sqlCommand + '[' + COLUMN_NAME + '] LIKE ''' + @stringToFind + ''' OR '
   FROM INFORMATION_SCHEMA.COLUMNS 
   WHERE TABLE_SCHEMA = @schema
   AND TABLE_NAME = @table 
   AND DATA_TYPE IN ('char','nchar','ntext','nvarchar','text','varchar')

   SET @sqlCommand = left(@sqlCommand,len(@sqlCommand)-3)
   EXEC (@sqlCommand)
   PRINT @sqlCommand
END TRY

BEGIN CATCH 
   PRINT 'There was an error. Check to make sure object exists.'
   PRINT error_message()
END CATCH




GO
/****** Object:  StoredProcedure [dbo].[spp_Add_Category]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[spp_Add_Category]
(

@MCId varchar(50),
@MCName varchar(100),
@MCImage varchar(100)=null
)
as
begin 
insert into [dbo].[Categories_tbl] (MCId,MCName,MCImage) values (@MCId,@MCName,@MCImage)
end

GO
/****** Object:  StoredProcedure [dbo].[spp_addArea]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_addArea]
( 
@Area nvarchar(50)
)
AS
BEGIN
	insert into dbo.Area_tbl (Area)
     values (@Area)
  END

GO
/****** Object:  StoredProcedure [dbo].[spp_addSlide]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_addSlide]
(
 @Slide_Name nvarchar(50),
 @Title nvarchar(250),
 @Image nvarchar(500)
)
as
begin
 insert into dbo.Slide (Slide_Name, Title, [Image]) values (@Slide_Name,@Title,@Image)
end

GO
/****** Object:  StoredProcedure [dbo].[spp_AddSubCategory]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_AddSubCategory]
(
 @SubCatId varchar(50),
 @SubCName varchar(100),
 @SubCImage varchar(100)=null,
 @MCId varchar(50)
)
as
begin
insert into dbo.SubCategory_tbl (SubCatId,SubCName,[SubCImage],MCId)
values (@SubCatId,@SubCName,@SubCImage,@MCId)
end

GO
/****** Object:  StoredProcedure [dbo].[spp_changePassword]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_changePassword] 
(
 @username nvarchar(50),  
 @OldPassword nvarchar(50),
 @NewPass1 nvarchar(50),
 @NewPass2 nvarchar(50)
)
as
begin
    declare @OldPass nvarchar(50)
    
    select @OldPass=Password  from dbo.Admin where username=@username
    if(@OldPass<>@OldPassword)
    begin
     select 'Enter correct old password'
    end
    if(@NewPass1<>@NewPass2)
    begin
     select 'Password did not match'
    end
    else if(@OldPass<>@OldPassword)
    begin 
      
     select 'Incorrect Old Password'
    end
    else
    begin
     update dbo.Admin set password=@NewPass1 where username=@username
     select 'Password Changed Sucessfully'
    end
end





GO
/****** Object:  StoredProcedure [dbo].[spp_changePasswordAPI]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_changePasswordAPI]
(
 @UserId varchar(50),
 @OldPassword nvarchar(500)=null,
 @ConfirmPassword nvarchar(500)=null,
 @NewPassword nvarchar(500)=null
)
as
begin
    declare @OldPass varchar(50)
    declare @Status varchar(50)
    select @OldPass=[Password]  from [dbo].[Login_Table] where [UserId]=@UserId
    if(@NewPassword<>@ConfirmPassword)
    begin
    set @Status='FAILED'
     select 'Password did not match' as Msg,@Status  as [Status]
    end
    else if(@OldPass<>@OldPassword)
    begin 
      set @Status='FAILED'
     select 'Incorrect Old Password' as Msg,@Status  as [Status]
    end
    else
    begin
     update [dbo].[Login_Table] set [Password]=@NewPassword where [UserId]=@UserId
     set @Status='SUCCESS'
     select 'Password Changed Sucessfully' as Msg,@Status  as [Status]
    end   
end
GO
/****** Object:  StoredProcedure [dbo].[spp_changeQtyToCart]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_changeQtyToCart]
(
 @Userid nvarchar(50)=null,
 @Product_Id nvarchar(50)=null,
 @Qty varchar(50)
)
as
begin
declare @tempqty bigint=0
select @tempqty = Qty from [dbo].[Cart_tbl] where [UserId]=@Userid and [Product_Id]=@Product_Id
if(@Qty='plus')
begin
Set @tempqty=@tempqty + 1
if(@tempqty>0)
  begin
  update [dbo].[Cart_tbl] set Qty=@tempqty,Total=Price*@tempqty where [UserId]=@Userid and [Product_Id]=@Product_Id
  end
end
else
begin
Set @tempqty=@tempqty - 1
if(@tempqty>0)
begin
  update [dbo].[Cart_tbl] set Qty=@tempqty,Total=Price*@tempqty where [UserId]=@Userid and [Product_Id]=@Product_Id
  end 
  else
  begin
  delete [dbo].[Cart_tbl] where [UserId]=@Userid and [Product_Id]=@Product_Id
  end
end
end

GO
/****** Object:  StoredProcedure [dbo].[spp_ChangeUserPasswordAPI]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_ChangeUserPasswordAPI]
(
@UserId nvarchar(500)=null,
@Password nvarchar(500)=null
)
as
begin
begin transaction t
Update [dbo].[Login_Table] set [Password]=@Password where [UserId]=@UserId
Update [dbo].[EmailVerfied_Flag_Tbl] set [EmailVerified_Flag]='False' where [UserId]=@UserId
if(@@ERROR>0)
begin
Rollback Transaction t
end
else
begin
commit Transaction t
end
end

GO
/****** Object:  StoredProcedure [dbo].[spp_Characteristic]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_Characteristic]
( 
@Characteristic nvarchar(50)
)
AS
BEGIN

	insert into dbo.PropertyCharacteristics (Characteristic)
     values (@Characteristic)
  END

GO
/****** Object:  StoredProcedure [dbo].[spp_delete_agent]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_delete_agent]
(
@UserId varchar(50)
)
as
begin
delete [dbo].[Profile_Info] where [Profile_Id]=@UserId
delete [dbo].[Login_Table] where [UserId]=@UserId
delete [dbo].[Property_tbl]  where [CreatedBy]=@UserId
delete [dbo].[Property_Images] where Propertyid in (SELECT PropertyId From [dbo].[Property_tbl] p WHERE [CreatedBy]=@UserId)
end

GO
/****** Object:  StoredProcedure [dbo].[spp_Delete_Agent_Pic]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create proc [dbo].[spp_Delete_Agent_Pic]
(
@PhotoId varchar(50)
)
as
begin
delete from [dbo].[Agent_Picture] where [PhotoId]=@PhotoId
end




GO
/****** Object:  StoredProcedure [dbo].[spp_Delete_Agent_video]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create proc [dbo].[spp_Delete_Agent_video]
(
@VideoId varchar(50)
)
as
begin
Delete from [dbo].[Agent_Video] where [VideoId]=@VideoId
end




GO
/****** Object:  StoredProcedure [dbo].[spp_Delete_Classifiedtbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create proc [dbo].[spp_Delete_Classifiedtbl]
(
@ClassifiedId varchar(50)
)
as
begin
Delete from [dbo].[ClassifiedPostImg_tbl] where [ClassifiedId]=@ClassifiedId
Delete from [dbo].[ClassifiedFeature_tbl] where [ClassifiedId]=@ClassifiedId
Delete from [dbo].[ClassifiedAds_tbl] where [ClassifiedId]=@ClassifiedId
end




GO
/****** Object:  StoredProcedure [dbo].[spp_Delete_Product_video]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_Delete_Product_video]
(
@VideoId varchar(50)
)
as
begin
Delete from [dbo].[Product_video] where [VideoId]=@VideoId 
end


GO
/****** Object:  StoredProcedure [dbo].[spp_Delete_Property_video]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create proc [dbo].[spp_Delete_Property_video]
(
@VideoId varchar(50)
)
as
begin
Delete from [dbo].[Property_video] where [VideoId]=@VideoId 
end




GO
/****** Object:  StoredProcedure [dbo].[spp_Delete_Propertytbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_Delete_Propertytbl]
(
@PropertyId varchar(50)=null
)
as
begin
Delete [dbo].[Property_tbl] where [PropertyId]=@PropertyId
Delete [dbo].[Property_Images] where [PropertyId]=@PropertyId
Delete [dbo].[Property_Feature_Mapping] where [PropertyId]=@PropertyId
end




GO
/****** Object:  StoredProcedure [dbo].[spp_Delete_propertytyp]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_Delete_propertytyp]
(
@PropertyTypeId varchar(50)
)
as
begin
delete from [dbo].[PropertyType_tbl] where [PropertyTypeId]=@PropertyTypeId
end




GO
/****** Object:  StoredProcedure [dbo].[spp_delete_sociallink]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_delete_sociallink]
(
@SMID varchar(50),
@UserId nvarchar(200) = null
)
as
begin
delete [dbo].[SociallinkMapping_tbl] where [SMID]=@SMID 
end

GO
/****** Object:  StoredProcedure [dbo].[spp_Delete_Testimonial]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create proc [dbo].[spp_Delete_Testimonial]
(
@Tid varchar(50)
)
as
begin
Delete from [dbo].[Testimonial] where [Tid] = @Tid
end




GO
/****** Object:  StoredProcedure [dbo].[spp_delete_user]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_delete_user]
(
@UserId varchar(50)
)
as
begin
begin transaction t
	declare @OrderId varchar(50)=null
	select @OrderId=[Order_Id] from [dbo].[Orderdetail_tbl] where [UserId]=@UserId
	delete from [dbo].[Login_Table] where [UserId]=@UserId
	delete from [dbo].[Profile_Info] where [Profile_Id]=@UserId
	delete from [dbo].[Agent_Review_tbl] where [UserId]=@UserId
	delete from [dbo].[AgentComments] where [UserId]=@UserId
	delete from [dbo].[Cart_tbl] where [UserId]=@UserId
	delete from [dbo].[ClassifiedComments] where [UserId]=@UserId
	delete from [dbo].[Comments_tbl] where [UserId]=@UserId
	delete from [dbo].[Follow] where [FollowedBy]=@UserId
	delete from [dbo].[Friends_tbl] where ([From]=@UserId or [To]=@UserId)
	delete from [dbo].[Message] where ([msg_from_user_id]=@UserId or [Msg_To_User_Id]=@UserId)
	delete from [dbo].[Orderdetail_tbl] where [UserId]=@UserId
	delete from [dbo].[Order_Itemdetail_tbl] where [Order_Id]=@OrderId
	delete from [dbo].[PaymentMethod] where [UserId]=@UserId
	delete from [dbo].[Product_Chat] where ([Msg_From_User_Id]=@UserId or [Msg_To_User_Id]=@UserId)
	delete from [dbo].[Product_WishList] where [UserId]=@UserId
	delete from [dbo].[ProductComments] where [UserId]=@UserId
	delete from [dbo].[Favourite_Property] where [Profile_Id]=@UserId
	delete from [dbo].[Events_Table] where [CreatedBy]=@UserId
	delete from [dbo].[EmailVerfied_Flag_Tbl] where [UserId]=@UserId
if(@@ERROR>0)
begin
	rollback transaction t
end
else
begin
	commit transaction t
end
end


GO
/****** Object:  StoredProcedure [dbo].[spp_DeleteFromCart]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_DeleteFromCart]
(
@id int=null,
@userid varchar(50)=null
)
as
begin
begin transaction t
declare @TempTotPoint float=0
declare @tempproductid varchar(50)=null
select @tempproductid=[Product_Id] from [dbo].[Cart_tbl] where [Id]=@id
delete [dbo].[Cart_tbl] where [Id]=@id


	if exists(select UserId from [dbo].[Point_tbl] where [UserId]=@userid)
	begin
		select @TempTotPoint=isnull([TotalPoint],'0') from [dbo].[Point_tbl] where [UserId]=@userid
		set @TempTotPoint=@TempTotPoint-5
		update [dbo].[Point_tbl] set [TotalPoint]=@TempTotPoint where [UserId]=@userid
	end
	else
	begin
		set @TempTotPoint='0'
		insert into [dbo].[Point_tbl]
		(UserId, TotalPoint)
		values
		(@userid,@TempTotPoint)
	end
	insert into [dbo].[PointTransaction_tbl]
	(UserId, Point, [Type], Note, PointFrom, To_Id ,PointTransaction_EntryDate, PointTransaction_Status)
	Values
	(@userid,'5','d','Point is deduct from account, due to removal of product from cart in public market','Public Market',@tempproductid,GetUTCDATE(),'True')

if(@@ERROR>0)
begin
	rollback transaction t
end
else
begin
	commit transaction t
end
end
GO
/****** Object:  StoredProcedure [dbo].[spp_deleteSlide]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_deleteSlide]
(
 @id int
)
as
begin
 delete from dbo.Slide where id=@id
end

ROLLBACK





GO
/****** Object:  StoredProcedure [dbo].[spp_EditCategory]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_EditCategory]
(
@MCId varchar(50),
@MCName varchar(100),
@MCImage varchar(100)
)
as
begin
update [dbo].[Categories_tbl] set MCName=@MCName,MCImage=@MCImage where [MCId]=@MCId
end

GO
/****** Object:  StoredProcedure [dbo].[spp_EditClassifiedPostImg1]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_EditClassifiedPostImg1]
(
@Id bigint=null,
@ClassifiedId varchar(50) = null,
@Post_Images varchar(MAX) = null,
@HasTag nvarchar(500)=null
)
as
begin
Update [dbo].[ClassifiedPostImg_tbl] set [Post_Images]=@Post_Images,[HasTag]=@HasTag
where [Id]=@Id
end

GO
/****** Object:  StoredProcedure [dbo].[spp_EditEventsAPI]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_EditEventsAPI]
(

@EventId varchar(100),
@EventTitle nvarchar(100) = null,
@Description nvarchar(Max) = null,
@ShownType nvarchar(50) = null,
@ShowingDay int = null,
@Start_Date date = null,
@End_Date date = null,
@Start_Time time = null,
@End_Time time = null,
@CreatedBy varchar(100) = null,
@Event_Type varchar(50) = null,
@PropertyId	varchar(50)	=null
)
as
begin
begin transaction t
if Exists(Select EventId from Events_Table where EventId=@EventId)
begin
update Events_Table set [EventTitle]=isnull(@EventTitle,[EventTitle]), 
[Description]=isnull(@Description,[Description]), [ShownType]=isnull(@ShownType,[ShownType]),
[ShowingDay]=isnull(@ShowingDay,[ShowingDay]), [Start_Date]=isnull(@Start_Date,[Start_Date]),
[End_Date]=isnull(@End_Date,[End_Date]), [Start_Time]=isnull(@Start_Time,[Start_Time]),
[End_Time]=isnull(@End_Time,[End_Time]), [Event_Type]=isnull(@Event_Type,[Event_Type]),
PropertyId=isnull(@PropertyId,[PropertyId])
where [EventId] = @EventId
end
if(@@ERROR>0)
begin
	rollback transaction t
end
else
begin
	commit transaction t
end
end
GO
/****** Object:  StoredProcedure [dbo].[spp_EditProfileAPI]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_EditProfileAPI]
(
@userId nvarchar(200)=null,
@firstName nvarchar(100)=null,
@lastName nvarchar(100)=null,
@screenName varchar(50)=null,
@phone varchar(12)=null,
@gender varchar(50)=null,
@address nvarchar(500)=null,
@city varchar(50)=null,
@state varchar(50)=null,
@country varchar(50)=null,
@zip varchar(10)=null,
@aboutMe nvarchar(MAX)=null,
@latitude float=null,
@longitude float=null
)
as
begin
begin transaction t
Update [dbo].[Login_Table] set [FirstName]=isnull(@firstName,[FirstName]),[LastName]=isnull(@lastName,[LastName])
where [UserId]=@userId
Update [dbo].[Profile_Info] set [ScreenName]=isnull(@screenName,[ScreenName]),[ContactNo]=isnull(@phone,[ContactNo]),
[Gender]=isnull(@gender,[Gender]),[Address]=isnull(@address,[Address]),[City]=isnull(@city,[City]),
[State]=isnull(@state,[State]),[Country]=isnull(@country,[Country]),[Zip]=isnull(@zip,[Zip]),
[AboutMe]=isnull(@aboutMe,[AboutMe]),[Latitude]=isnull(@latitude,[Latitude]),
[Longitude]=isnull(@longitude,[Longitude])
where [Profile_Id]=@userId
if(@@ERROR>0)
begin
	rollback transaction t
end
else
begin
	commit transaction t
end
end
GO
/****** Object:  StoredProcedure [dbo].[spp_EditSponsoredAdv]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_EditSponsoredAdv]
(
@SponsoreAd_Id nvarchar(50),
@SAd_Title nvarchar(500) = null,
@Ad_Image nvarchar(50) = null,
@Link nvarchar(500) = null,
@SA_Price decimal(18,2) = null,
@SA_Position int = null,
@SA_Modified_Id nvarchar(50) = null
)
as
begin

update SponserAd_tbl set  [SAd_Title]=@SAd_Title, [Ad_Image]=@Ad_Image, 
[Link]=@Link, [SA_Price]=@SA_Price, [SA_Position]=@SA_Position, [SA_Modified_Id]=@SA_Modified_Id, 
[SA_ModifiedDate]=GETUTCDATE()
where [SponsoreAd_Id] = @SponsoreAd_Id

end

GO
/****** Object:  StoredProcedure [dbo].[spp_EditSubCategory]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_EditSubCategory]
(
 @SubCatId varchar(50),
 @SubCName varchar(100),
 @SubCImage varchar(100)=null,
 @MCId varchar(50)
)
as
begin
update dbo.SubCategory_tbl set SubCName=@SubCName,SubCImage=@SubCImage, MCId=@MCId where SubCatId=@SubCatId
end

GO
/****** Object:  StoredProcedure [dbo].[spp_Feature]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_Feature]
( 
@FeatureId varchar(50),
@FeatureName nvarchar(50),
@FeatureType	nvarchar(50)	,
@FeatureCatId varchar(50)
)
AS
BEGIN
	insert into dbo.FeatureMaster (FeatureName,FeatureId,FeatureType,FeatureCatId,IsDefault)
     values (@FeatureName,@FeatureId,@FeatureType,@FeatureCatId,0)
END

GO
/****** Object:  StoredProcedure [dbo].[spp_getLogin]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_getLogin]
(
 @EmailId nvarchar(50),
 @Password nvarchar(50)
)
as
begin
if exists(select * from [dbo].[Login_Table] where   [EmailId] COLLATE SQL_Latin1_General_CP1_CI_AS=@EmailId and [Password] COLLATE SQL_Latin1_General_CP1_CI_AS=@Password)
begin
update [dbo].[Login_Table] set [Last_visited]=GETDATE() where   [EmailId] COLLATE SQL_Latin1_General_CP1_CI_AS=@EmailId and [Password] COLLATE SQL_Latin1_General_CP1_CI_AS=@Password
 end
select * from [dbo].[Login_Table] where   [EmailId] COLLATE SQL_Latin1_General_CP1_CI_AS=@EmailId and [Password] COLLATE SQL_Latin1_General_CP1_CI_AS=@Password
end




GO
/****** Object:  StoredProcedure [dbo].[spp_getMessage]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_getMessage]
(
@Msg_From_User_Id varchar(100) = null,
@Msg_To_User_Id varchar(100) = null
)
as
begin
Select * from 
(select * from dbo.[Message] where Msg_From_User_Id=@Msg_From_User_Id and Msg_To_User_Id=@Msg_To_User_Id and  isnull(Deleted_By,'NA')<>@Msg_To_User_Id
 union 
 select * from dbo.[Message] where Msg_From_User_Id=@Msg_To_User_Id and Msg_To_User_Id=@Msg_From_User_Id and  isnull(Deleted_By,'NA')<>@Msg_To_User_Id
 )A 
  order by A.Msg_Date ASc 
end

GO
/****** Object:  StoredProcedure [dbo].[Spp_Google_Login]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE Procedure [dbo].[Spp_Google_Login]
(
@Uid   int=null,
@UserId	nvarchar(200)=null,
@EmailId	nvarchar(500),
@FirstName	nvarchar(100)=null,
@LastName	nvarchar(100)=null,
@googleId varchar(100)
)
as
begin
declare @Status	bit	
if Exists(Select * from Login_Table where EmailId=@EmailId)
begin
select * from Login_Table where EmailId=@EmailId
end
else 
begin
begin transaction t
set @Status=1
insert into Login_Table( Uid, UserId, EmailId, FirstName, LastName, Status,[Email_verified],googleId)values(@Uid, @UserId, @EmailId, @FirstName, @LastName, @Status,1,@googleId)
insert Into dbo.Profile_Info(Profile_Id)values(@UserId)
if(@@Error>0)
begin
Rollback transaction t
end
else
begin
Commit transaction t
end

select * from Login_Table where EmailId=@EmailId

end
end




GO
/****** Object:  StoredProcedure [dbo].[spp_insert_Ads_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_Ads_tbl]
(
@AdId varchar(50),
@Ad_Image varchar(50) = null,
@Ad_Description nvarchar(10) = null,
@City nvarchar(50) = null,
@ZipCode nvarchar(50) = null,
@Link nvarchar(500) = null,
@Ad_Section nvarchar(50)=null,

@UploadedBy nvarchar(100)=null,
@Sub_Category_Id nvarchar(50)=null
)

as
begin
If exists(select * from [dbo].[Ads_tbl] where [AdId]=@AdId)
begin

update Ads_tbl set  [Ad_Image]=@Ad_Image, [Ad_Description]=@Ad_Description, [City]=@City, [ZipCode]=@ZipCode,[Link]=@Link,
[Ad_Section]=@Ad_Section
where [AdId] = @AdId

if isnull(@Sub_Category_Id,'')<>''
begin
delete [dbo].[Ad_Mapping_SubCategory] where [AdId] = @AdId
insert into [dbo].[Ad_Mapping_SubCategory]
([AdId], [Sub_Category_Id])
values
(@AdId,@Sub_Category_Id)
end
else 
begin
if exists(select * from [dbo].[Ad_Mapping_SubCategory] where [AdId] = @AdId)
begin
delete [dbo].[Ad_Mapping_SubCategory] where [AdId] = @AdId
end
end
end
else
begin
insert into Ads_tbl
([AdId],[Ad_Image],[Ad_Description],[City],[ZipCode],[Link],[EntryDate],[Status],[Ad_Section],[UploadedBy],[PaymentStatus])
values
(@AdId,@Ad_Image,@Ad_Description,@City,@ZipCode,@Link,GETDATE(),1,@Ad_Section,@UploadedBy,'True')

if isnull(@Sub_Category_Id,'')<>''
begin
insert into [dbo].[Ad_Mapping_SubCategory]
([AdId], [Sub_Category_Id])
values
(@AdId,@Sub_Category_Id)
end
end
end

GO
/****** Object:  StoredProcedure [dbo].[spp_insert_Agent_Picture]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_Agent_Picture]
(
@PhotoId varchar(50),
@ProfileId varchar(50) = null,
@Photo_Title varchar(200) = null,
@Photo varchar(50) = null
)
as
begin
insert into Agent_Picture
([PhotoId],[Profile_Id],[Photo_Title],[Photo],[Photo_Entrydate])
values
(@PhotoId,@ProfileId,@Photo_Title,@Photo,GETDATE())
end




GO
/****** Object:  StoredProcedure [dbo].[spp_insert_Agent_Review_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_Agent_Review_tbl]
(
@Rating int = null,
@ReviewText nvarchar(MAX) = null,
@AgentId varchar(50) = null,
@UserId varchar(50) = null
)
as
begin
If Exists(Select * from [dbo].[Agent_Review_tbl] where [UserId]=@UserId and [AgentId]=@AgentId)
begin
update Agent_Review_tbl set [Rating]=@Rating, [ReviewText]=@ReviewText, [AgentId]=@AgentId, [UserId]=@UserId
where [UserId]=@UserId and [AgentId]=@AgentId
end
else
begin
insert into Agent_Review_tbl
([Rating],[ReviewText],[AgentId],[UserId],[ReviewDate])
values
(@Rating,@ReviewText,@AgentId,@UserId,GETDATE())
end
end

GO
/****** Object:  StoredProcedure [dbo].[spp_insert_Agent_Video]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_Agent_Video]
(
@VideoId varchar(50),
@ProfileId varchar(50)=null,
@Video_Title nvarchar(50) = null,
@File_Type nvarchar(20) = null,
@Video varchar(50) = null
)
as
begin
insert into Agent_Video
([VideoId],[Profile_Id],[Video_Title],[File_Type],[Video],[Video_Entrydate])
values
(@VideoId,@ProfileId,@Video_Title,@File_Type,@Video,GETDATE())
end

GO
/****** Object:  StoredProcedure [dbo].[spp_insert_AgentContact_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_AgentContact_tbl]
(
@AgentContact_Id varchar(50) = null,
@Name nvarchar(100) = null,
@Phone varchar(20) = null,
@Email nvarchar(100) = null,
@Message nvarchar(500) = null,
@PropertyId varchar(50) = null,
@Profile_Id varchar(50)=null
)
as
begin
insert into AgentContact_tbl
([AgentContact_Id],[Name],[Phone],[Email],[Message],[PropertyId],[Profile_Id],[Entry_Date],[Status])
values
(@AgentContact_Id,@Name,@Phone,@Email,@Message,@PropertyId,@Profile_Id,GETDATE(),'True')
end

GO
/****** Object:  StoredProcedure [dbo].[spp_insert_Cart_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_Cart_tbl]
(
@Product_Id varchar(50) = null,
@UserId varchar(50) = null,
@Qty bigint = null,
@Price float = null,
@Total float = null
)
as
begin
declare @TempTotPoint float=0
If not exists (select * from [dbo].[Cart_tbl] where [UserId]=@UserId)
begin
insert into Cart_tbl
([Product_Id],[UserId],[Qty],[Price],[Total],[Entry_Date],[Cart_Status])
values
(@Product_Id,@UserId,@Qty,@Price,@Total,GETDATE(),1)
end
else
begin
--update Cart_tbl set  [Qty]=@Qty, [Price]=@Price, [Total]=@Total
--where [Product_Id]=@Product_Id and [UserId]=@UserId

delete Cart_tbl where [UserId]=@UserId
insert into Cart_tbl
([Product_Id],[UserId],[Qty],[Price],[Total],[Entry_Date],[Cart_Status])
values
(@Product_Id,@UserId,@Qty,@Price,@Total,GETDATE(),1)

end




	--if exists(select UserId from [dbo].[Point_tbl] where [UserId]=@UserId)
	--begin
	--	select @TempTotPoint=isnull([TotalPoint],'0') from [dbo].[Point_tbl] where [UserId]=@UserId
	--	set @TempTotPoint=@TempTotPoint+5
	--	update [dbo].[Point_tbl] set [TotalPoint]=@TempTotPoint where [UserId]=@UserId
	--end
	--else
	--begin
	--	set @TempTotPoint='0'
	--	set @TempTotPoint=@TempTotPoint+5
	--	insert into [dbo].[Point_tbl]
	--	(UserId, TotalPoint)
	--	values
	--	(@UserId,@TempTotPoint)
	--end
	--insert into [dbo].[PointTransaction_tbl]
	--(UserId, Point, [Type], Note, PointFrom, To_Id ,PointTransaction_EntryDate, PointTransaction_Status)
	--Values
	--(@UserId,'5','c','Point is added in account, from purchase of product from public market','Public Market',@Product_Id,GetUTCDATE(),'True')
end

GO
/****** Object:  StoredProcedure [dbo].[spp_insert_Classified_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_Classified_tbl]
(
@ClassifiedId varchar(50),
@Info nvarchar(MAX) = null
)
as
begin
insert into Classified_tbl
([ClassifiedId],[Info],[Entry_date],[Status])
values
(@ClassifiedId,@Info,GETDATE(),1)
end

GO
/****** Object:  StoredProcedure [dbo].[spp_insert_ClassifiedAds_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_ClassifiedAds_tbl]

(

@ClassifiedId varchar(50),

@Title nvarchar(100) = null,

@Pay_Type varchar(10) = null,

@Amount decimal = null,

@Image varchar(50)=null,

@Description nvarchar(Max) = null,

@Contact_Name nvarchar(100) = null,

@Contact_Email nvarchar(100) = null,

@Contact_Phone varchar(20) = null,

@Contact_location nvarchar(100) = null,

@Catid varchar(50)= null,

@Latitude float = null,

@Longitude float = null,
@HasTag nvarchar(500)=null,
@Sponsored_Ad bit=null,
@Featured_Banner bit=null,
@ScreenName nvarchar(500)=null

)

as

begin

insert into ClassifiedAds_tbl

([ClassifiedId],[Title],[Pay_Type],[Amount],[Image],[Description],[Contact_Name],[Contact_Email],[Contact_Phone],[Contact_location],[ClassifiedEntry_Date],[ClassifiedStatus],Catid,[Latitude],[Longitude],[HasTag],[Sponsored_Ad],[Featured_Banner],[ScreenName])

values

(@ClassifiedId,@Title,@Pay_Type,@Amount,@Image,@Description,@Contact_Name,@Contact_Email,@Contact_Phone,@Contact_location,GETDATE(),1,@Catid,@Latitude,@Longitude,@HasTag,@Sponsored_Ad,@Featured_Banner,@ScreenName)

end

GO
/****** Object:  StoredProcedure [dbo].[spp_insert_ClassifiedFeature_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_ClassifiedFeature_tbl]
(
@CFeatureid varchar(50),
@ClassifiedId varchar(50) = null,
@Feature_Detail nvarchar(100) = null,
@Feature_Value nvarchar(100) = null
)
as
begin
insert into ClassifiedFeature_tbl
([CFeatureid],[ClassifiedId],[Feature_Detail],[Feature_Value],[FeatureEntry_Date],[Feature_Status])
values
(@CFeatureid,@ClassifiedId,@Feature_Detail,@Feature_Value,GetDate(),1)
end

GO
/****** Object:  StoredProcedure [dbo].[spp_insert_ClassifiedPostImg_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_ClassifiedPostImg_tbl]
(
@ClassifiedId varchar(50) = null,
@Post_Images varchar(MAX) = null
)
as
begin
If exists(Select * from [dbo].[ClassifiedPostImg_tbl] where [ClassifiedId]=@ClassifiedId)
begin
--Delete from [dbo].[ClassifiedPostImg_tbl] where [ClassifiedId]=@ClassifiedId
insert into [dbo].[ClassifiedPostImg_tbl](ClassifiedId, Post_Images)select @ClassifiedId,item from dbo.Splitmaster(@Post_Images,',')
end
else
begin
insert into [dbo].[ClassifiedPostImg_tbl](ClassifiedId, Post_Images)select @ClassifiedId,item from dbo.Splitmaster(@Post_Images,',')
end
end




GO
/****** Object:  StoredProcedure [dbo].[spp_insert_ClassifiedPostImg_tbl1]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_ClassifiedPostImg_tbl1]
(
@ClassifiedId varchar(50) = null,
@Post_Images varchar(MAX) = null,
@HasTag nvarchar(MAX)=null
)
as
begin
 Insert Into [dbo].[ClassifiedPostImg_tbl](ClassifiedId, Post_Images, HasTag)
 Values
 (@ClassifiedId,@Post_Images,@HasTag)

end

GO
/****** Object:  StoredProcedure [dbo].[spp_Insert_CMS_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_Insert_CMS_tbl]
(
@Id int,
@Image varchar(50)=null,
@Title nvarchar(100)=null,
@Sub_Title nvarchar(100)=null
)
as
begin
update [dbo].[CMS_tbl] set [Image]=@Image,[Title]=@Title,[Sub_Title]=@Sub_Title where Id =@Id
end

GO
/****** Object:  StoredProcedure [dbo].[spp_insert_Contact_Tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_Contact_Tbl]
(
@ContactId varchar(50) = null,
@Name nvarchar(50) = null,
@Email nvarchar(50) = null,
@Contact nvarchar(20) = null,
@Subject nvarchar(100) = null,
@Message nvarchar(500) = null
)
as
begin
insert into Contact_Tbl
([ContactId],[Name],[Email],[Contact],[Subject],[Message],[Entrydate],[Status])
values
(@ContactId,@Name,@Email,@Contact,@Subject,@Message,GETDATE(),1)
end

GO
/****** Object:  StoredProcedure [dbo].[spp_insert_Favourite_Property]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_Favourite_Property]
(
@Profile_Id varchar(50) = null,
@PropertyId varchar(50) = null
)
as
begin
If  Exists (Select * from [dbo].[Favourite_Property] where [Profile_Id]=@Profile_Id and [PropertyId]=@PropertyId )
begin
Delete from [dbo].[Favourite_Property] where [Profile_Id]=@Profile_Id and [PropertyId]=@PropertyId
end
else
begin
insert into Favourite_Property
([Profile_Id],[PropertyId],[Entrydate])
values
(@Profile_Id,@PropertyId,GETDATE())
end
end




GO
/****** Object:  StoredProcedure [dbo].[spp_insert_Holiday_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_Holiday_tbl]
(
@HolidayId varchar(50),
@Holiday_Name nvarchar(100) = null,
@Holiday_On varchar(20) = null,
@Holiday_Date date = null,
@Start_Date date = null,
@End_Date date = null,
@About_Holiday nvarchar(200) = null
)
as
begin
If exists (Select [HolidayId] from [dbo].[Holiday_tbl] where [HolidayId]=@HolidayId)
begin
update Holiday_tbl set [Holiday_Name]=@Holiday_Name, [Holiday_On]=@Holiday_On, [Holiday_Date]=@Holiday_Date, [Start_Date]=@Start_Date, [End_Date]=@End_Date, [About_Holiday]=@About_Holiday
where [HolidayId] = @HolidayId
end
else
begin
insert into Holiday_tbl
([HolidayId],[Holiday_Name],[Holiday_On],[Holiday_Date],[Start_Date],[End_Date],[About_Holiday],[Entry_Date])
values
(@HolidayId,@Holiday_Name,@Holiday_On,@Holiday_Date,@Start_Date,@End_Date,@About_Holiday,GETDATE())
end
end

GO
/****** Object:  StoredProcedure [dbo].[spp_insert_Notes_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_Notes_tbl]
(
@Id varchar(50),
@NoteText nvarchar(Max) = null,
@IsPublic bit = null,
@PropertyId	varchar(50)	=null,
@CreatedBy	varchar(50)	=null,
@Position	nvarchar(50)	=null,
@posX	varchar(50)	=null,
@PosY	varchar(50)	=null
)
as
begin
if Exists(Select Id from Notes_tbl where id=@Id )
begin
update Notes_tbl set  [NoteText]=@NoteText,Position=@Position,posX=@posX,PosY=@PosY
where [Id] = @Id
end
else
begin
insert into Notes_tbl
([Id],[NoteText],[IsPublic],PropertyId,CreatedBy,CreatedDate,Position,posX,PosY)
values
(@Id,@NoteText,@IsPublic,@PropertyId,@CreatedBy,GetDate(),@Position,@posX,@PosY)
end

end

GO
/****** Object:  StoredProcedure [dbo].[spp_insert_Orderdetail_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_Orderdetail_tbl]
(
@Order_Id varchar(50) = null,
@UserId varchar(50) = null,
@First_Name varchar(100) = null,
@Last_Name varchar(100) = null,
@Mobile_No varchar(50) = null,
@Address nvarchar(100) = null,
@Email varchar(100) = null,
@City varchar(50) = null,
@State nvarchar(50) = null,
@Zip_Code varchar(50) = null,
@Order_Date datetime = null,
@Sub_Total float = null,
@Payment_Method varchar(100) = null,
@Country varchar(100) = null,
@SFirst_Name varchar(100) = null,
@SLast_Name varchar(100) = null,
@SMobile_No varchar(50) = null,
@SEmail varchar(100) = null,
@SAddress varchar(100) = null,
@SCity varchar(50) = null,
@SState varchar(50) = null,
@SCountry nvarchar(50) = null,
@SZip_Code nvarchar(50) = null,
@Order_Status varchar(50)=null,
@Payement_Status bit=null,
@Payment_TokenKey nvarchar(500)=null,
@Coupon_Code nvarchar(200)=null,
@TotalBeforeSubTot float=null,
@DiscountedAmt float=null,
@Point float=null
)
as
begin
Begin Transaction t
begin Try

declare @TotQty int=0 
declare @CID nvarchar(200)=null
if(isnull(@Coupon_Code,'')<>'')
begin
select @CID=[Coupon_Id] from [dbo].[Coupon_tbl] where [Coupon_Code]=@Coupon_Code
insert into [dbo].[Coupon_Tracking]
(Coupon_Id, UserId)
Values
(@CID,@UserId)
end
else
begin
set @CID=''
end
insert into Orderdetail_tbl
([Order_Id],[UserId],[First_Name],[Last_Name],[Mobile_No],[Address],[Email],[City],[State],[Zip_Code],[Order_Date],[Sub_Total],[Payment_Method],[Country],[SFirst_Name],[SLast_Name],[SMobile_No],[SEmail],[SAddress],[SCity],[SState],[SCountry],[SZip_Code],[Payement_Status],[Payment_TokenKey],[Coupon_Code],[TotalBeforeSubTot],[DiscountedAmt],[Coupon_CodeId],[Point])
values
(@Order_Id,@UserId,@First_Name,@Last_Name,@Mobile_No,@Address,@Email,@City,@State,@Zip_Code,GETDATE(),@Sub_Total,@Payment_Method,@Country,@SFirst_Name,@SLast_Name,@SMobile_No,@SEmail,@SAddress,@SCity,@SState,@SCountry,@SZip_Code,@Payement_Status,@Payment_TokenKey,@Coupon_Code,@TotalBeforeSubTot,@DiscountedAmt,@CID,@Point)

delete [dbo].[Order_Itemdetail_tbl] where [Order_Id]=@Order_Id

insert into Order_Itemdetail_tbl
select @Order_Id,Product_Id,Price,Product_Name,Qty,Total,@Order_Status,'','','' from  [dbo].[View_Product_Cart] where [UserId]=@UserId

select @TotQty=Sum(Qty) from [dbo].[Order_Itemdetail_tbl] where Order_Id=@Order_Id
Update [dbo].[Orderdetail_tbl] set [TotQty]=@TotQty where Order_Id=@Order_Id

delete [dbo].[Cart_tbl] where [UserId]=@UserId
declare @TempTotPoint float=0
if(@Point!='0')
begin
if exists(select UserId from [dbo].[Point_tbl] where [UserId]=@UserId)
	begin
		select @TempTotPoint=isnull([TotalPoint],'0') from [dbo].[Point_tbl] where [UserId]=@UserId
		set @TempTotPoint=@TempTotPoint-@Point
		update [dbo].[Point_tbl] set [TotalPoint]=@TempTotPoint where [UserId]=@UserId
	end
	else
	begin
		set @TempTotPoint='0'
		insert into [dbo].[Point_tbl]
		(UserId, TotalPoint)
		values
		(@UserId,@TempTotPoint)
	end
	insert into [dbo].[PointTransaction_tbl]
	(UserId, Point, [Type], Note, PointFrom, To_Id ,PointTransaction_EntryDate, PointTransaction_Status)
	Values
	(@UserId,@Point,'d','Point is deduct from account, due to purchase of product','Product Purchase',@Order_Id,GetUTCDATE(),'True')
end

declare @tempproductPoint float=0,@tempProductId nvarchar(50)=null
declare @TempTotPointforadd float=0, @tempqty int=0
select @tempProductId=[Product_Id],@tempqty=[Qty] from [dbo].[Order_Itemdetail_tbl] where [Order_Id]=@Order_Id
if exists( select [Product_Id] from [dbo].[Product] where [Product_Id]=@tempProductId and [UploadBy_Id]='Admin')
begin
select @tempproductPoint=isnull([Point],'0') from [dbo].[Product] where [Product_Id]=@tempProductId and [UploadBy_Id]='Admin'
set @tempproductPoint=@tempproductPoint*@tempqty
	if(@tempproductPoint!='0')
	begin
		if exists(select UserId from [dbo].[Point_tbl] where [UserId]=@UserId)
			begin
				select @TempTotPointforadd=isnull([TotalPoint],'0') from [dbo].[Point_tbl] where [UserId]=@UserId
				set @TempTotPointforadd=@TempTotPointforadd+@tempproductPoint
				update [dbo].[Point_tbl] set [TotalPoint]=@TempTotPointforadd where [UserId]=@UserId
			end
		else
			begin
				set @TempTotPointforadd='0'
				set @TempTotPointforadd=@TempTotPointforadd+@tempproductPoint
				insert into [dbo].[Point_tbl]
				(UserId, TotalPoint)
				values
				(@UserId,@TempTotPointforadd)
			end
	insert into [dbo].[PointTransaction_tbl]
	(UserId, Point, [Type], Note, PointFrom, To_Id ,PointTransaction_EntryDate, PointTransaction_Status)
	Values
	(@UserId,@tempproductPoint,'c','Point is added in account, for purchase of product from public market','Public Market',@tempProductId,GetUTCDATE(),'True')
	end
end
Commit Transaction t
end Try
begin catch 
Rollback transaction t
end catch
end


GO
/****** Object:  StoredProcedure [dbo].[spp_insert_PriceHistory_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_PriceHistory_tbl]
(
@PriceId varchar(50),
@Date datetime = null,
@Event nvarchar(50) = null,
@Price decimal(18,3) = null,
@Price_Sqft decimal(18,3) = null,
@Source nvarchar(50) = null,
@PropertyId varchar(50) = null
)
as
begin
insert into PriceHistory_tbl
([PriceId],[Date],[Event],[Price],[Price_Sqft],[Source],[PropertyId],[Entry_Date])
values
(@PriceId,@Date,@Event,@Price,@Price_Sqft,@Source,@PropertyId,GETDATE())
end

GO
/****** Object:  StoredProcedure [dbo].[spp_insert_Product_video]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_insert_Product_video]
(
@VideoId varchar(50),
@Product_Id varchar(50) = null,
@Video_Title nvarchar(100) = null,
@File_Type nvarchar(20) = null,
@Video varchar(50) = null
)
as
begin
insert into Product_video
([VideoId],[Product_Id],[Video_Title],[File_Type],[Video],[Video_Entrydate])
values
(@VideoId,@Product_Id,@Video_Title,@File_Type,@Video,GETDATE())
end

GO
/****** Object:  StoredProcedure [dbo].[spp_insert_Property_video]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_Property_video]
(
@VideoId varchar(50),
@PropertyId varchar(50) = null,
@Video_Title nvarchar(100) = null,
@File_Type nvarchar(20) = null,
@Video varchar(50) = null
)
as
begin
insert into Property_video
([VideoId],[PropertyId],[Video_Title],[File_Type],[Video],[Video_Entrydate])
values
(@VideoId,@PropertyId,@Video_Title,@File_Type,@Video,GETDATE())
end

GO
/****** Object:  StoredProcedure [dbo].[spp_insert_Social]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_insert_Social]
(
@Id bigint,
@Facebook nvarchar(100) = null,
@Twitter nvarchar(100) = null,
@Instagram nvarchar(100) = null,
@Googleplus nvarchar(100) = null,
@Youtube nvarchar(100) = null,
@Linkedin nvarchar(100) = null
)
as
begin
update Social set [Facebook]=@Facebook, [Twitter]=@Twitter, [Instagram]=@Instagram, [Googleplus]=@Googleplus, [Youtube]=@Youtube, [Linkedin]=@Linkedin
where [Id] = @Id
end




GO
/****** Object:  StoredProcedure [dbo].[spp_insert_SociallinkMapping_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_SociallinkMapping_tbl]



(


@SMID varchar(50),

@SocialId bigint = null,
@UserId nvarchar(200) = null,
@Social_link nvarchar(200) = null
)



as

begin



insert into SociallinkMapping_tbl



(SMID ,[SocialId],[UserId],[Social_link],[Entrydate])



values



(@SMID,@SocialId,@UserId,@Social_link,GETDATE())



end

GO
/****** Object:  StoredProcedure [dbo].[spp_insert_SociallinkYellowPageMapping_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE proc [dbo].[spp_insert_SociallinkYellowPageMapping_tbl]
(
@SMID varchar(50),
@SocialId bigint = null,
@PageId nvarchar(200) = null,
@Social_link nvarchar(200) = null
)
as
begin
insert into [SociallinkYellowPagesMapping_tbl]
(SMID ,[SocialId],[PageId],[Social_link],[Entrydate])
values
(@SMID,@SocialId,@PageId,@Social_link,GETDATE())
end


GO
/****** Object:  StoredProcedure [dbo].[spp_insert_Subscription_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_Subscription_tbl]
(
@SubscripId varchar(50) = null,
@Email nvarchar(100) = null
)
as
begin
insert into Subscription_tbl
([SubscripId],[Email],[IsSuscribed],[Entrydate])
values
(@SubscripId,@Email,0,GETDATE())
end

GO
/****** Object:  StoredProcedure [dbo].[spp_insert_TaxHistory_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insert_TaxHistory_tbl]
(
@TaxId varchar(50),
@Year bigint=null,
@PropertyTax decimal = null,
@PTax_Changes decimal = null,
@TaxAssessmnt decimal = null,
@TaxAssessmnt_Changes decimal = null,
@PropertyId varchar(50) = null
)
as
begin
insert into TaxHistory_tbl
([TaxId],[Year],[PropertyTax],[PTax_Changes],[TaxAssessmnt],[TaxAssessmnt_Changes],[PropertyId],[Entry_Date])
values
(@TaxId,@Year,@PropertyTax,@PTax_Changes,@TaxAssessmnt,@TaxAssessmnt_Changes,@PropertyId,GETDATE())
end




GO
/****** Object:  StoredProcedure [dbo].[spp_insert_tblCMS]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


CREATE proc [dbo].[spp_insert_tblCMS]

(

@Id int,

@Page_Name nvarchar(50) = null,

@Page_Title nvarchar(50) = null,

@Page_Heading nvarchar(MAX) = null,

@Page_Content nvarchar(MAX) = null

)

as

begin

update tblCMS set  [Page_Name]=@Page_Name, [Page_Title]=@Page_Title, [Page_Heading]=@Page_Heading, [Page_Content]=@Page_Content

where [Id] = @Id

end

GO
/****** Object:  StoredProcedure [dbo].[spp_insertArrangeViewing]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_insertArrangeViewing]
(
@Title nvarchar(50) = null,
@Name nvarchar(100) = null,
@EmailId nvarchar(500) = null,
@Primary_Telephone nvarchar(50) = null,
@Work_Telephone nvarchar(50) = null,
@MobileNo nvarchar(50) = null,
@Viewing_Date date = null,
@Time_of_Day nvarchar(50) = null,
@Other_Requirement nvarchar(500) = null,
@UserId nvarchar(200) = null,
@PropertyId  varchar(50) = null
)
as
begin
insert into dbo.Arrange_Viewing
([Title],[Name],[EmailId],[Primary_Telephone],[Work_Telephone],[MobileNo],[Viewing_Date],[Time_of_Day],[Other_Requirement],[UserId],[PropertyId])
values
(@Title,@Name,@EmailId,@Primary_Telephone,@Work_Telephone,@MobileNo,@Viewing_Date,@Time_of_Day,@Other_Requirement,@UserId,@PropertyId)
end





GO
/****** Object:  StoredProcedure [dbo].[spp_insertGallery]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insertGallery]
(
@id nvarchar(50),
@Title nvarchar(50),
@Image nvarchar(50)
)
as
begin
insert into Gallery
([id],[Title],[Image])
values
(@id,@Title,@Image)
end

GO
/****** Object:  StoredProcedure [dbo].[spp_insertProperty_Photo]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create proc [dbo].[spp_insertProperty_Photo]
(
@PropertyId varchar(50),
@PrpertyImage nvarchar(max) = null
)
as
begin
insert into Property_Images
([PropertyId],[PrpertyImage])
values
(@PropertyId,@PrpertyImage)
end





GO
/****** Object:  StoredProcedure [dbo].[spp_insertTestimonial]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_insertTestimonial]
(
@Tid varchar(50),
@Name nvarchar(100) = null,
@Designation nvarchar(50) = null,
@Comment nvarchar(200) = null,
@Photo varchar(50) = null
)
as
begin
insert into Testimonial
([Tid],[Name],[Designation],[Comment],[Photo],[Status],[Entry_Date])
values
(@Tid,@Name,@Designation,@Comment,@Photo,'TRUE',GETDATE())
end

GO
/****** Object:  StoredProcedure [dbo].[spp_insertYellowPageVideo]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_insertYellowPageVideo]
(
@VideoId varchar(50),
@ClassifiedId varchar(50)=null,
@Video_Title nvarchar(50) = null,
@File_Type nvarchar(20) = null,
@Video varchar(50) = null
)
as
begin
insert into [dbo].[ClassifiedAds_Video]
([VideoId],[ClassifiedId],[Video_Title],[File_Type],[Video],[Video_Entrydate])
values
(@VideoId,@ClassifiedId,@Video_Title,@File_Type,@Video,GETDATE())
end

GO
/****** Object:  StoredProcedure [dbo].[spp_login_tbl__info_Info]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_login_tbl__info_Info]
(

@Profile_Id nvarchar(50)=null,
@Uid int ,
@LoginId	bigint=0,
@FirstName nvarchar(100) = null,
@LastName nvarchar(100) = null,
@ContactNo varchar(12) = null,
@Address nvarchar(500) = null,
@City nvarchar(50) = null,
@State nvarchar(50) = null,
@Country nvarchar(50) = null,
@Zip nvarchar(10) = null,
@Photo nvarchar(500) = null,
@UserId nvarchar(200) = null,
@DOB date = null,
@Gender varchar(50) = null,
@EmailId nvarchar(500)=null,
@Password  nvarchar(500)=null,
@Status bit = null,
@CreatedBy nvarchar(50)=null
)
as
begin
if (Exists(Select LoginId from  Login_Table where [LoginId]=@LoginId ))
begin
begin Transaction t
begin try 
update Profile_Info set Profile_Id=@Profile_Id, [LoginId]=@LoginId, [ContactNo]=@ContactNo, [Address]=@Address, [City]=@City, [State]=@State, [Country]=@Country, [Zip]=@Zip, [Photo]=@Photo, [DOB]=@DOB, [Gender]=@Gender,[Last_Modified_Date]=GETDATE(),[CreatedBy]=@CreatedBy
where [LoginId]=@LoginId
Update Login_Table Set FirstName=@FirstName,LastName=@LastName,EmailId=@EmailId,[Password]=@Password,UserId=@UserId where LoginId=@LoginId
commit transaction t
end try
begin catch
Rollback transaction t
end catch

end
else
begin
insert into Login_Table( Uid, UserId, EmailId, FirstName, LastName,[Password], Status)values(@Uid, @UserId, @EmailId, @FirstName, @LastName,@Password, @Status)
Select @LoginId=ISNULL(MAX(LoginId),0) from dbo.Login_Table 
insert into dbo.Profile_Info (Profile_Id,[LoginId],[ContactNo],[Address],[City],[State],[Country],[Zip],[Photo],[DOB],[Gender],[Entry_Date],[Last_Modified_Date],[CreatedBy])
values(@Profile_Id,@LoginId,@ContactNo,@Address,@City,@State,@Country,@Zip,@Photo,@DOB,@Gender,GETDATE(),GETDATE(),@CreatedBy)
end
end





GO
/****** Object:  StoredProcedure [dbo].[spp_LogInApi]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_LogInApi]
(
 @EmailId nvarchar(500)=null,
 @Password nvarchar(500),
 @Login_Type int
)
as
begin

if @Login_Type=0
begin
select *,
(select count(*) from [dbo].[AgentComments] AC where AC.[AgentId]=UserId) as totalComment
from [dbo].[View_Login_Profile] 
where [EmailId]=@EmailId and [Password]=@Password
end
else if @Login_Type=1
begin
if exists(select [EmailId] from [dbo].[Login_Table] where [EmailId]=@EmailId and [googleId]=@Password)
 begin
 	select *,
	(select count(*) from [dbo].[AgentComments] AC where AC.[AgentId]=UserId) as totalComment
	 from [dbo].[View_Login_Profile] 
	where [EmailId]=@EmailId and [googleId]=@Password
 end
 else if exists (select [EmailId] from [dbo].[Login_Table] where [EmailId]=@EmailId)
	update [dbo].[Login_Table] set [googleId]=@Password where [EmailId]=@EmailId
	select *,
	(select count(*) from [dbo].[AgentComments] AC where AC.[AgentId]=UserId) as totalComment 
	from [dbo].[View_Login_Profile] 
	where [EmailId]=@EmailId and [googleId]=@Password
  end
else if @Login_Type=2
begin
 if exists(select [EmailId] from [dbo].[Login_Table] where [EmailId]=@EmailId and [FaceBookId]=@Password)
 begin
	select *,
	(select count(*) from [dbo].[AgentComments] AC where AC.[AgentId]=UserId) as totalComment 
	from [dbo].[View_Login_Profile] 
	where [EmailId]=@EmailId and [FaceBookId]=@Password
  end
 else if exists (select [EmailId] from [dbo].[Login_Table] where [EmailId]=@EmailId)
	 update [dbo].[Login_Table] set [FaceBookId]=@Password where [EmailId]=@EmailId
	 select * ,
		(select count(*) from [dbo].[AgentComments] AC where AC.[AgentId]=UserId) as totalComment 
		from [dbo].[View_Login_Profile] 
	 where [EmailId]=@EmailId and [FaceBookId]=@Password
 end
end





GO
/****** Object:  StoredProcedure [dbo].[spp_PropertyAge]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_PropertyAge]
( 
@PropertyAge nvarchar(50)
)
AS
BEGIN

	insert into dbo.PropertyAgeMaster_tbl (PropertyAge)
     values (@PropertyAge)
  END

GO
/****** Object:  StoredProcedure [dbo].[spp_PropertyType_tbl_Add]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_PropertyType_tbl_Add]
( 
@PropertyTypeId varchar(50),
@PropertyType nvarchar(50),
@PropertyTyp_Image nvarchar(50)=null ,
@PropertyTypeCode nvarchar(50)=null
)
AS
BEGIN
insert into dbo.PropertyType_tbl (PropertyTypeId,PropertyType,[PropertyTyp_Image],PropertyTypeCode) values (@PropertyTypeId,@PropertyType,@PropertyTyp_Image,@PropertyTypeCode)
END

GO
/****** Object:  StoredProcedure [dbo].[spp_propertytype_update]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  proc [dbo].[spp_propertytype_update] 

@PropertyTypeId varchar(50),

@PropertyType nvarchar(50)=null,

@PropertyTyp_Image varchar(50)=null,

@PropertyTypeCode nvarchar(50)=null

as 

begin 

   update  PropertyType_tbl  set PropertyType=@PropertyType,PropertyTypeCode=@PropertyTypeCode,

   PropertyTyp_Image=@PropertyTyp_Image where PropertyTypeId=@PropertyTypeId

end

GO
/****** Object:  StoredProcedure [dbo].[spp_RegisterUsingFacebook]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[spp_RegisterUsingFacebook]
(
@Uid   int=null,
@UserId	nvarchar(200)=null,
@EmailId	nvarchar(500),
@FirstName	nvarchar(100)=null,
@LastName	nvarchar(100)=null,
@googleId varchar(100)
)
as

begin
declare @Status	bit	
if Exists(Select * from Login_Table where EmailId=@EmailId)
begin
select * from Login_Table where EmailId=@EmailId
end
else 
begin
begin transaction t
set @Status=1
insert into Login_Table( Uid, UserId, EmailId, FirstName, LastName,[Status],[Email_verified],[FaceBookId])
values
(@Uid, @UserId, @EmailId, @FirstName, @LastName, @Status,1,@googleId)
insert Into dbo.Profile_Info(Profile_Id)values(@UserId)
if(@@Error>0)
begin

Rollback transaction t
end
else
begin
Commit transaction t
end
select * from Login_Table where EmailId=@EmailId
end
end

GO
/****** Object:  StoredProcedure [dbo].[spp_Save_AdsComments]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_Save_AdsComments]
(
@Commentid varchar(50) =null,
@UserId varchar(50) = null,
@ClassifiedId varchar(50) = null,
@Comments nvarchar(Max) = null,
@Image varchar(100)=''
)
as
begin
declare @TempTotPoint float=0

if Exists(Select * from ClassifiedComments where Commentid=@Commentid)
begin
update ClassifiedComments set  [Comments]=@Comments,[Image]=@Image
where Commentid=@Commentid
end
else
begin
insert into ClassifiedComments
(Commentid,[UserId],[ClassifiedId],[Comments],EntryDate,[Image])
values
(@Commentid,@UserId,@ClassifiedId,@Comments,GetDate(),@Image)
end

if(isnull(@Image,'')<>'')
begin
	if exists(select UserId from [dbo].[Point_tbl] where [UserId]=@UserId)
	begin
		select @TempTotPoint=isnull([TotalPoint],'0') from [dbo].[Point_tbl] where [UserId]=@UserId
		set @TempTotPoint=@TempTotPoint+5
		update [dbo].[Point_tbl] set [TotalPoint]=@TempTotPoint where [UserId]=@UserId
	end
	else
	begin
		set @TempTotPoint='0'
		set @TempTotPoint=@TempTotPoint+5
		insert into [dbo].[Point_tbl]
		(UserId, TotalPoint)
		values
		(@UserId,@TempTotPoint)
	end
	insert into [dbo].[PointTransaction_tbl]
	(UserId, Point, [Type], Note, PointFrom, To_Id ,PointTransaction_EntryDate, PointTransaction_Status)
	Values
	(@UserId,'5','c','Point is added in account, from KP Yellow Pages image upload in comment section','KP Yellow Pages',@ClassifiedId,GetUTCDATE(),'True')

end
end

GO
/****** Object:  StoredProcedure [dbo].[spp_Save_AreaUnit_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_Save_AreaUnit_tbl]
(
@UnitId varchar(50),
@AreaUnitName nvarchar(50) = null,
@EqvUnitValueinSqrFt decimal = null,
@UnitOfLenth nvarchar(50) = null
)
as
begin
if Exists(select * from AreaUnit_tbl where [UnitId] = @UnitId)
begin
update AreaUnit_tbl set [UnitId]=@UnitId, [AreaUnitName]=@AreaUnitName, [EqvUnitValueinSqrFt]=@EqvUnitValueinSqrFt, [UnitOfLenth]=@UnitOfLenth
where [UnitId] = @UnitId
end
else
begin
insert into AreaUnit_tbl
([UnitId],[AreaUnitName],[EqvUnitValueinSqrFt],[UnitOfLenth])
values
(@UnitId,@AreaUnitName,@EqvUnitValueinSqrFt,@UnitOfLenth)
end
end

GO
/****** Object:  StoredProcedure [dbo].[spp_Save_Comments]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_Save_Comments]
(
@Commentid varchar(50) =null,
@UserId varchar(50) = null,
@PropertyId varchar(50) = null,
@Comments nvarchar(Max) = null,
@Image varchar(100)=null
)
as
begin
declare @TempTotPoint float=0
if Exists(Select * from Comments_tbl where Commentid=@Commentid)
begin
update Comments_tbl set [UserId]=@UserId,[Image]=isnull(@Image,[Image]), [PropertyId]=@PropertyId, [Comments]=@Comments
where Commentid=@Commentid
end
else
begin
insert into Comments_tbl
(Commentid,[UserId],[PropertyId],[Comments],EntryDate,[Image])
values
(@Commentid,@UserId,@PropertyId,@Comments,GetDate(),@Image)
end
if(isnull(@Image,'')<>'')
begin
	if exists(select UserId from [dbo].[Point_tbl] where [UserId]=@UserId)
	begin
		select @TempTotPoint=isnull([TotalPoint],'0') from [dbo].[Point_tbl] where [UserId]=@UserId
		set @TempTotPoint=@TempTotPoint+5
		update [dbo].[Point_tbl] set [TotalPoint]=@TempTotPoint where [UserId]=@UserId
	end
	else
	begin
		set @TempTotPoint='0'
		set @TempTotPoint=@TempTotPoint+5
		insert into [dbo].[Point_tbl]
		(UserId, TotalPoint)
		values
		(@UserId,@TempTotPoint)
	end
	insert into [dbo].[PointTransaction_tbl]
	(UserId, Point, [Type], Note, PointFrom,To_Id ,PointTransaction_EntryDate, PointTransaction_Status)
	Values
	(@UserId,'5','c','Point is added in account, from property comment section of image upload','Property',@PropertyId,GetUTCDATE(),'True')

end
end

GO
/****** Object:  StoredProcedure [dbo].[spp_Save_FeatureCategory]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_Save_FeatureCategory]
(
@FeatureCatId varchar(50),
@FeatureCategory nvarchar(50),
@FeatureId varchar(50),
@FeatureName nvarchar(50),
@FeatureType nvarchar(50)
)
as
begin
begin transaction t

if not Exists(Select FeatureCatId from FeatureCategory where FeatureCategory=@FeatureCategory)
begin
insert into FeatureCategory
([FeatureCatId],[FeatureCategory],[EntryDate])
values
(@FeatureCatId,@FeatureCategory,GETDATE())
if not Exists(Select [FeatureName] from  [dbo].[FeatureMaster] where [FeatureName]=@FeatureName )
begin
insert into [dbo].[FeatureMaster](FeatureId, FeatureName, FeatureType, FeatureCatId)values(@FeatureId,@FeatureName,@FeatureType,@FeatureCatId)
end
end 

if(@@ERROR>0)
begin
Rollback transaction t
end
else
begin
commit transaction t

end

end




GO
/****** Object:  StoredProcedure [dbo].[spp_Save_Friends]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_Save_Friends]
(
@From varchar(50) = null,
@To varchar(50) = null,
@Status varchar(50) = null
)
as
begin

If Exists(Select * from Friends_tbl where ([From]=@From and [To]=@To) or ([From]=@To and [To]=@From))
begin
--Update Friends_tbl set [Status]=@Status where [From]=@From and [To]=@To and [Status]<>'accepted'
Update Friends_tbl set [IsFavorite]='True' where (([From]=@From and [To]=@To) or ([From]=@To and [To]=@From))
end
else
begin
--insert into Friends_tbl
--([From],[To],[Status],[EntryDate])
--values
--(@From,@To,@Status,GetDate())

insert into Friends_tbl
([From],[To],[Status],[EntryDate],[IsFavorite])
values
(@From,@To,'accepted',GetDate(),'False')
end
end

GO
/****** Object:  StoredProcedure [dbo].[spp_Save_Friends1]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE proc [dbo].[spp_Save_Friends1]
(
@From varchar(50) = null,
@To varchar(50) = null,
@Status varchar(50) = null
)
as
begin

If Exists(Select * from Friends_tbl where ([From]=@From and [To]=@To) or ([From]=@To and [To]=@From))
begin
--Update Friends_tbl set [Status]=@Status where [From]=@From and [To]=@To and [Status]<>'accepted'

Update Friends_tbl set [IsFavorite]='True' where (([From]=@From and [To]=@To) or ([From]=@To and [To]=@From))
end
else
begin
--insert into Friends_tbl
--([From],[To],[Status],[EntryDate])
--values
--(@From,@To,@Status,GetDate())

insert into Friends_tbl
([From],[To],[Status],[EntryDate],[IsFavorite])
values
(@From,@To,'accepted',GetDate(),'True')
end
end

GO
/****** Object:  StoredProcedure [dbo].[spp_SaveAgentComments]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_SaveAgentComments]
(
@Commentid varchar(50) =null,
@UserId varchar(50) = null,
@AgentId varchar(50) = null,
@Comments nvarchar(Max) = null,
@Image varchar(100)=''
)
as
begin
declare @TempTotPoint float=0
declare @temapuid int=0
declare @tempNote nvarchar(500)=null,@tempsection nvarchar(50)
if Exists(Select * from AgentComments where Commentid=@Commentid)
begin
update AgentComments set  [Comments]=@Comments,[Image]=@Image
where Commentid=@Commentid
end
else
begin
insert into AgentComments
(Commentid,[UserId],[AgentId],[Comments],EntryDate,[Image])
values
(@Commentid,@UserId,@AgentId,@Comments,GetDate(),@Image)
end

if(isnull(@Image,'')<>'')
begin
	select @temapuid=[Uid] from [dbo].[Login_Table] where [UserId]=@AgentId
	if exists(select UserId from [dbo].[Point_tbl] where [UserId]=@UserId)
	begin
		select @TempTotPoint=isnull([TotalPoint],'0') from [dbo].[Point_tbl] where [UserId]=@UserId
		set @TempTotPoint=@TempTotPoint+5
		update [dbo].[Point_tbl] set [TotalPoint]=@TempTotPoint where [UserId]=@UserId
	end
	else
	begin
		set @TempTotPoint='0'
		set @TempTotPoint=@TempTotPoint+5
		insert into [dbo].[Point_tbl]
		(UserId, TotalPoint)
		values
		(@UserId,@TempTotPoint)
	end
	if(@temapuid='2')
	begin
		set @tempNote='Point is added in account, from Agent comment section of image upload'
		set @tempsection='Agent'
	end
	else
	begin
		set @tempNote='Point is added in account, from Seller comment section of image upload'
		set @tempsection='Seller'
	end
	insert into [dbo].[PointTransaction_tbl]
	(UserId, Point, [Type], Note, PointFrom,To_Id, PointTransaction_EntryDate, PointTransaction_Status)
	Values
	(@UserId,'5','c',@tempNote,@tempsection,@AgentId,GetUTCDATE(),'True')

end

end

GO
/****** Object:  StoredProcedure [dbo].[spp_SaveAndCheckEmailId]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_SaveAndCheckEmailId]
(
@EmailId nvarchar(500)=null
)
as
begin
begin transaction t
declare @UserId varchar(200)
select @UserId=[UserId] from [dbo].[Login_Table] where [EmailId]=@EmailId
if exists (select [UserId] from [dbo].[EmailVerfied_Flag_Tbl] where [UserId]=@UserId)
begin
Update [dbo].[EmailVerfied_Flag_Tbl] set [EmailVerified_Flag]='True' where [UserId]=@UserId
end
else
begin
Insert into [dbo].[EmailVerfied_Flag_Tbl]([UserId],[EmailVerified_Flag])
Values(@UserId,'True')
end
select @UserId as UserId
if(@@ERROR>0)
begin
Rollback Transaction t
end
else
begin
commit Transaction t
end
end

GO
/****** Object:  StoredProcedure [dbo].[spp_saveCategory]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_saveCategory]
(
@Category_Id nvarchar(50),
@Category_Name varchar(max) = null,
@Category_Image varchar(max) = null,
@usserid varchar(50)
)
as
begin 

if exists (select * from [dbo].[ProductCategory] where [Category_Id]=@Category_Id)
begin

Update [dbo].[ProductCategory] set [Category_Name]=@Category_Name,[Category_ModifyDate]=GETUTCDATE(),Category_ModifyById=@usserid,Category_Image=case when (isnull(@Category_Image,'') <> '') then @Category_Image else Category_Image end  where [Category_Id]=@Category_Id

end
else
begin
insert into ProductCategory
([Category_Id],[Category_Name],[Category_EntryDate],[Category_Image],[Category_EntryById])
values
(@Category_Id,@Category_Name,GETUTCDATE(),@Category_Image,@usserid)
end

end

GO
/****** Object:  StoredProcedure [dbo].[spp_SaveCoupon]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_SaveCoupon]
(
@Coupon_Id nvarchar(50),
@UserId nvarchar(200) = null,
@Coupon_Code nvarchar(200) = null,
@Coupon_Amt decimal(18,2) = null,
@Coupon_Type nvarchar(50) = null,
@Coupon_StartDate datetime = null,
@Coupon_EndDate datetime = null
)
as
begin
begin transaction t
insert into Coupon_tbl
([Coupon_Id],[UserId],[Coupon_Code],[Coupon_Amt],[Coupon_Type],[Coupon_StartDate],[Coupon_EndDate],[Coupon_EntryDate],[Coupon_AStatus])
values
(@Coupon_Id,@UserId,@Coupon_Code,@Coupon_Amt,@Coupon_Type,@Coupon_StartDate,@Coupon_EndDate,GETUTCDATE(),'Active')
if(@@ERROR>0)
begin
rollback transaction t
end
else
begin
commit transaction t
end
end

GO
/****** Object:  StoredProcedure [dbo].[spp_SaveEditPostAdvertisement]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_SaveEditPostAdvertisement]
(
@AdId varchar(50)=null,
@Ad_Image varchar(50)=null,
@City nvarchar(50) = null,
@ZipCode nvarchar(50) = null,
@Link nvarchar(500) = null,
@Ad_Section nvarchar(50)=null,
@UploadedBy nvarchar(100)=null,

@Sub_Category_Id nvarchar(50)=null,

@Name nvarchar(500)=null,
@EmailId nvarchar(50)=null,
@Phone nvarchar(50)=null,
@Start_Date datetime=null,
@End_Date datetime=null,
@Paid_Amt decimal(18,2)=null
)
as
begin
begin transaction t

Update [dbo].[Ads_tbl] set [Ad_Image]=@Ad_Image,[City]=@City,[ZipCode]=@ZipCode,[Link]=@Link,
[Ad_Section]=@Ad_Section,[UploadedBy]=@UploadedBy,[Name]=@Name,[EmailId]=@EmailId,
[Phone]=@Phone,[Start_Date]=@Start_Date,[End_Date]=@End_Date,[Paid_Amt]=@Paid_Amt
where [AdId]=@AdId

if isnull(@Sub_Category_Id,'')<>''
begin
insert into [dbo].[Ad_Mapping_SubCategory]
([AdId], [Sub_Category_Id])
values
(@AdId,@Sub_Category_Id)
end
if(@@ERROR>0)
begin
rollback transaction t
end
else
begin
commit transaction t
end
end
GO
/****** Object:  StoredProcedure [dbo].[spp_SaveEvents]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_SaveEvents]
(

@EventId varchar(100),
@EventTitle nvarchar(100) = null,
@Description nvarchar(Max) = null,
@ShownType nvarchar(50) = null,
@ShowingDay int = null,
@Start_Date date = null,
@End_Date date = null,
@Start_Time time = null,
@End_Time time = null,
@CreatedBy varchar(100) = null,
@Event_Type varchar(50) = null,
@PropertyId	varchar(50)	=null
)
as
begin
if Exists(Select EventId from Events_Table where EventId=@EventId)
begin
update Events_Table set [EventId]=@EventId, [EventTitle]=@EventTitle, [Description]=@Description, [ShownType]=@ShownType, [ShowingDay]=@ShowingDay, [Start_Date]=@Start_Date, [End_Date]=@End_Date, [Start_Time]=@Start_Time, [End_Time]=@End_Time, [Event_Type]=@Event_Type,PropertyId=@PropertyId
where [EventId] = @EventId
end
else
begin
insert into Events_Table
([EventId],[EventTitle],[Description],[ShownType],[ShowingDay],[Start_Date],[End_Date],[Start_Time],[End_Time],[IsActive],[Entry_Date],[CreatedBy],[Event_Type],PropertyId)
values
(@EventId,@EventTitle,@Description,@ShownType,@ShowingDay,@Start_Date,@End_Date,@Start_Time,@End_Time,1,GetDate(),@CreatedBy,@Event_Type,@PropertyId)
end
end

GO
/****** Object:  StoredProcedure [dbo].[spp_SaveFavoriteUnFavoritePropertyAPI]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_SaveFavoriteUnFavoritePropertyAPI]
(
@UserId varchar(50) = null,
@PropertyId varchar(50) = null,
@Favorite nvarchar(50)=null
)
as
begin
declare @TempStatus nvarchar(50)=null
if(@Favorite='0')
begin
	If  Exists (Select * from [dbo].[Favourite_Property] where [Profile_Id]=@UserId and [PropertyId]=@PropertyId )
	begin
		Delete from [dbo].[Favourite_Property] where [Profile_Id]=@UserId and [PropertyId]=@PropertyId
	end
set @TempStatus='Property removed from favorite list'
end
else
begin
	If not Exists (Select * from [dbo].[Favourite_Property] where [Profile_Id]=@UserId and [PropertyId]=@PropertyId )
	begin
		insert into Favourite_Property
		([Profile_Id],[PropertyId],[Entrydate])
		values
		(@UserId,@PropertyId,GETDATE())
	end
	set @TempStatus='Property successfully added to favorite list'
end
select @TempStatus as TempStatus
end

GO
/****** Object:  StoredProcedure [dbo].[spp_SaveNote]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_SaveNote]
(
@Note_Id nvarchar(50)=null,
@Note_Text nvarchar(MAX)=null,
@Note_EntryBy_Id nvarchar(50)=null
)
as
begin
begin transaction t
if exists(select [Note_Id] from [dbo].[MyNote_tbl] where [Note_Id]=@Note_Id and Note_EntryBy_Id=@Note_EntryBy_Id)
begin
	Update [dbo].[MyNote_tbl] set [Note_Text]=@Note_Text
	where [Note_Id]=@Note_Id and Note_EntryBy_Id=@Note_EntryBy_Id
end
else
begin
	insert into [dbo].[MyNote_tbl]
	(Note_Id, Note_Text, Note_EntryBy_Id, Note_EntryDate, Note_AStatus)
	Values
	(@Note_Id, @Note_Text, @Note_EntryBy_Id, GETUTCDATE(),'Active')
end
if(@@ERROR>0)
begin
rollback transaction t
end
else
begin
commit transaction t
end
end
GO
/****** Object:  StoredProcedure [dbo].[spp_SavePaymentMethod]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_SavePaymentMethod]
(
@PaymentMethod_Id nvarchar(50),
@UserId nvarchar(200) = null,
@P_Title nvarchar(500) = null,
@P_EmailId nvarchar(50) = null,
@PaymentType nvarchar(50) = null
)
as
begin
begin transaction t
if exists(select [PaymentMethod_Id] from [dbo].[PaymentMethod] where [UserId]=@UserId and [PaymentMethod_Id] = @PaymentMethod_Id)
begin
	update PaymentMethod set [P_Title]=@P_Title, [P_EmailId]=@P_EmailId, [PaymentType]=@PaymentType 
	where [UserId]=@UserId and [PaymentMethod_Id] = @PaymentMethod_Id
end
else
begin
	insert into PaymentMethod
	([PaymentMethod_Id],[UserId],[P_Title],[P_EmailId],[PaymentType],[P_EntryDate],[P_AStatus])
	values
	(@PaymentMethod_Id,@UserId,@P_Title,@P_EmailId,@PaymentType,GETUTCDATE(),'Active')
end
if(@@ERROR>0)
begin
rollback transaction t
end
else
begin
commit transaction t
end
end

GO
/****** Object:  StoredProcedure [dbo].[spp_SavePostAdvertisement]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_SavePostAdvertisement]
(
@AdId varchar(50)=null,
@Ad_Image varchar(50)=null,
@City nvarchar(50) = null,
@ZipCode nvarchar(50) = null,
@Link nvarchar(500) = null,
@Ad_Section nvarchar(50)=null,
@UploadedBy nvarchar(100)=null,

@Sub_Category_Id nvarchar(50)=null,

@Name nvarchar(500)=null,
@EmailId nvarchar(50)=null,
@Phone nvarchar(50)=null,
@Start_Date datetime=null,
@End_Date datetime=null,
@Paid_Amt decimal(18,2)=null
)
as
begin
begin transaction t

insert into Ads_tbl
([AdId],[Ad_Image],[City],[ZipCode],[Link],[EntryDate],[Status],[Ad_Section],[UploadedBy],[PaymentStatus],[Name],[EmailId],[Phone],[Start_Date],[End_Date],[Paid_Amt])
values
(@AdId,@Ad_Image,@City,@ZipCode,@Link,GETDATE(),'False',@Ad_Section,@UploadedBy,'False',@Name,@EmailId,@Phone,@Start_Date,@End_Date,@Paid_Amt)

if isnull(@Sub_Category_Id,'')<>''
begin
insert into [dbo].[Ad_Mapping_SubCategory]
([AdId], [Sub_Category_Id])
values
(@AdId,@Sub_Category_Id)
end
if(@@ERROR>0)
begin
rollback transaction t
end
else
begin
commit transaction t
end
end
GO
/****** Object:  StoredProcedure [dbo].[spp_saveproduct]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_saveproduct]
(
@Product_ID nvarchar(50),
@UploadBy_Id nvarchar(50),
@Category_Id nvarchar(100) =null,
@Sub_Category_Id nvarchar(50) =null,
@Product_Code nvarchar(200) =null,
@Product_Name nvarchar(max) = null,
@Product_Image nvarchar(max) =null,
@Base_Price decimal(18,2) =null,
@Display_Price decimal(18,2) =null,
@Product_Quantity decimal(18,2) =null,
@Description nvarchar(MAX) =null,
@Vat decimal(18,2)=null,
@Package int=null,
@QtyPerPackage int=null,
@QtyType varchar(50)=null,
@Featured bit=null,
@Used_Product bit=null,
@Point int=null
)
as
begin
insert into [dbo].[Product]
(Product_Id,UploadBy_Id,Category_Id,Sub_Category_Id,Product_Code,Product_Name,Product_Font_Image,Base_Price,Display_Price,Product_Stock_Count,Product_Desc,Product_EntryDate,Product_Status,Vat,[Package],[QtyPerPackage],[QtyType],Featured,[Used_Product],[Point])
values
(@Product_ID,@UploadBy_Id,@Category_Id,@Sub_Category_Id,@Product_Code,@Product_Name,@Product_Image,@Base_Price,@Display_Price,@Product_Quantity,@Description,GETUTCDATE(),1,@Vat,@Package,@QtyPerPackage,@QtyType,@Featured,@Used_Product,@Point)
end


GO
/****** Object:  StoredProcedure [dbo].[spp_saveProductAttribute]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_saveProductAttribute]
(
@Prodcut_Attribute_Id nvarchar(50),
@Product_Id nvarchar(50),
@Prodcut_Key varchar(max) =null,
@Product_Value varchar(max) =null,
@Attribute_Desc varchar(max) =null,
@UserId nvarchar(50) =null
)
as
begin
insert into [dbo].[ProdcutAttribute]
(Prodcut_Attribute_Id,Product_Id,Prodcut_Key,Product_Value,Attribute_Desc,Attribute_EntryDate,Attribute_Status,Attribute_EntryById)
values
(@Prodcut_Attribute_Id,@Product_Id,@Prodcut_Key,@Product_Value,@Attribute_Desc,GETUTCDATE(),1,@UserId)
end


GO
/****** Object:  StoredProcedure [dbo].[spp_SaveProductChatMessage]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_SaveProductChatMessage]
(
@Product_Id nvarchar(50) =null,
@Msg_From_User_Id nvarchar(100) = null,
@Msg_To_User_Id nvarchar(100) = null,
@PMessage nvarchar(Max) = null
)
as
begin
insert into [dbo].[Product_Chat]
(Product_Id, Msg_From_User_Id, Msg_To_User_Id, [Message], Msg_Date, Msg_Status)
Values
(@Product_Id, @Msg_From_User_Id, @Msg_To_User_Id, @PMessage, GETUTCDATE(), 'Sent')
end

GO
/****** Object:  StoredProcedure [dbo].[spp_SaveProductComments]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_SaveProductComments]
(
@Commentid varchar(50) =null,
@UserId varchar(50) = null,
@Product_Id nvarchar(50) = null,
@Comments nvarchar(Max) = null,
@Image varchar(100)=''
)
as
begin
if Exists(Select * from ProductComments where Commentid=@Commentid)
begin
update ProductComments set  [Comments]=@Comments,[Image]=@Image
where Commentid=@Commentid
end
else
begin
insert into ProductComments
(Commentid,[UserId],[Product_Id],[Comments],EntryDate,[Image])
values
(@Commentid,@UserId,@Product_Id,@Comments,GetDate(),@Image)
end
end

GO
/****** Object:  StoredProcedure [dbo].[spp_saveProductImage]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_saveProductImage]
(
@Product_Id nvarchar(50),
@Product_Images nvarchar(max) =null
)
as
begin
insert into dbo.ProductMultipleImage (Product_Id,Product_Image) select @Product_Id,item from dbo.splitmaster(@Product_Images,',')  
end


GO
/****** Object:  StoredProcedure [dbo].[spp_saveProductInWishListWeb]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_saveProductInWishListWeb]
(
@UserId varchar(50)=null,
@Product_Id varchar(50)=null
)
as
begin
if exists (select [WID] from [dbo].[Product_WishList] where [UserId]=@UserId and [Product_Id]=@Product_Id)
begin
Update [dbo].[Product_WishList] set [UserId]=@UserId,[Product_Id]=@Product_Id
where [UserId]=@UserId and [Product_Id]=@Product_Id
end
else
begin
insert into [dbo].[Product_WishList]
(UserId, Product_Id)
Values
(@UserId, @Product_Id)
end

end

GO
/****** Object:  StoredProcedure [dbo].[spp_SaveProfile_Info]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_SaveProfile_Info]
(
@Profile_Id nvarchar(50),
@FirstName nvarchar(100) = null,
@LastName nvarchar(100) = null,
@ContactNo varchar(13) = null,
@Address nvarchar(500) = null,
@City nvarchar(50) = null,
@State nvarchar(50) = null,
@Country nvarchar(50) = null,
@Zip nvarchar(10) = null,
@Photo nvarchar(500) = null,
@UserId nvarchar(200) = null,
@DOB date = null,
@Gender varchar(50) = null,
@Status bit = null,
@AboutMe nvarchar(MAX) = null,
@CCode varchar(5)=null,
@Latitude float=null,
@Longitude float=null,
@ScreenName nvarchar(50)=null
)
as
begin
if (Exists(Select Profile_Id from  Profile_Info where Profile_Id=@Profile_Id ))
begin
begin Transaction t
begin try 
update Profile_Info set   [ContactNo]=@ContactNo, [Address]=@Address, [City]=@City, [State]=@State, [Country]=@Country, [Zip]=@Zip, [Photo]=@Photo, [DOB]=@DOB, [Gender]=@Gender,AboutMe=@AboutMe,[Latitude]=@Latitude,[Longitude]=@Longitude,[Last_Modified_Date]=GETDATE()
,CCode=@CCode,[ScreenName]=@ScreenName where Profile_Id=@Profile_Id
Update Login_Table Set FirstName=@FirstName,LastName=@LastName where UserId=@Profile_Id
commit transaction t
end try
begin catch
Rollback transaction t
end catch
end
else
begin
insert into dbo.Profile_Info
(Profile_Id,[ContactNo],[Address],[City],[State],[Country],[Zip],[Photo],[DOB],[Gender],[Entry_Date],[Last_Modified_Date],AboutMe,CCode,[Latitude],[Longitude],[ScreenName])
values
(@Profile_Id,@ContactNo,@Address,@City,@State,@Country,@Zip,@Photo,@DOB,@Gender,GETDATE(),GETDATE(),@AboutMe,@CCode,@Latitude,@Longitude,@ScreenName)
end
end




GO
/****** Object:  StoredProcedure [dbo].[spp_SavePropertyEditExtraFeatureApi]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_SavePropertyEditExtraFeatureApi]
(
@PropertyId varchar(50),
@PropertyTypeId varchar(50) = null,
@PropertyFeatures nvarchar(MAX)=null
)
as
begin
begin transaction t
if(@PropertyFeatures<>'')
begin
Delete dbo.Property_Feature_Mapping where PropertyId=@PropertyId
Insert into dbo.Property_Feature_Mapping Select  Substring(Item, 1,Charindex('#', Item)-1) , @PropertyId,Substring(Item, Charindex('#', Item)+1, LEN(Item)) from dbo.Splitmaster(@PropertyFeatures,',')
end
if(@@ERROR>0)
begin
rollback transaction t
end
else
begin
commit transaction t
end
end
GO
/****** Object:  StoredProcedure [dbo].[spp_SavePropertyExtraFeatureApi]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_SavePropertyExtraFeatureApi]
(
@PropertyId varchar(50),
@PropertyTypeId varchar(50) = null,
@PropertyFeatures nvarchar(MAX)=null
)
as
begin
begin transaction t
if(@PropertyFeatures<>'')
begin
Delete dbo.Property_Feature_Mapping where PropertyId=@PropertyId
Insert into dbo.Property_Feature_Mapping Select  Substring(Item, 1,Charindex('#', Item)-1) , @PropertyId,Substring(Item, Charindex('#', Item)+1, LEN(Item)) from dbo.Splitmaster(@PropertyFeatures,',')
end
if(@@ERROR>0)
begin
rollback transaction t
end
else
begin
commit transaction t
end
end

GO
/****** Object:  StoredProcedure [dbo].[spp_saveSubCategory]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_saveSubCategory]
(
@Sub_Category_Id nvarchar(50),
@Category_Id nvarchar(50) = null,
@Sub_Category_Name varchar(max) = null,
@Sub_Category_Image varchar(max) = null,
@UserId nvarchar(50) = null
)
as
begin 

if exists (select * from [dbo].[ProductSubCategory] where [Sub_Category_Id]=@Sub_Category_Id)
begin

update ProductSubCategory set  [Category_Id]=@Category_Id, [Sub_Category_Name]=@Sub_Category_Name,[Sub_Category_ModifyDate]=GETUTCDATE(),[Sub_Category_ModifyById]=@UserId,
[Sub_Category_image]=case when (isnull(@Sub_Category_Image,'')<>'') then @Sub_Category_Image else Sub_Category_image end
where [Sub_Category_Id] = @Sub_Category_Id

end
else
begin
insert into ProductSubCategory
([Sub_Category_Id],[Category_Id],[Sub_Category_Name],[Sub_Category_EntryDate],[Sub_Category_EntryById],[Sub_Category_image])
values
(@Sub_Category_Id,@Category_Id,@Sub_Category_Name,GETUTCDATE(),@UserId,@Sub_Category_Image)
end

end

GO
/****** Object:  StoredProcedure [dbo].[spp_SaveValuationRequest_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_SaveValuationRequest_tbl]
(
@Title nvarchar(10) = null,
@Name nvarchar(100) = null,
@PhoneNo varchar(12) = null,
@EmailId nvarchar(50) = null,
@Address nvarchar(500) = null,
@PostCode nvarchar(10) = null,
@Details nvarchar(500) = null,
@RequestFor varchar(20)=null
)
as
begin
insert into ValuationRequest_tbl
([Title],[Name],[PhoneNo],[EmailId],[Address],[PostCode],[Details],RequestFor)
values
(@Title,@Name,@PhoneNo,@EmailId,@Address,@PostCode,@Details,@RequestFor)
end

GO
/****** Object:  StoredProcedure [dbo].[spp_sendMessage]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_sendMessage]
(
@Msg_id varchar(200),
@Msg_From_User_Id varchar(100) = null,
@Msg_To_User_Id varchar(100) = null,
@Message nvarchar(max) = null,
@Msg_Status nvarchar(50) = null,
@Msg_Date datetime=null,
@Is_Read bit=0,
@IsPublic bit=0
)
as
begin
insert into [dbo].[Message]
(Msg_id,[Msg_From_User_Id],[Msg_To_User_Id],[Message],[Msg_Date],[Msg_Status],Deleted_By,[Is_Read],IsPublic)
values
(@Msg_id,@Msg_From_User_Id,@Msg_To_User_Id,@Message,DATEADD(second, DATEDIFF(second, GETDATE(), GETUTCDATE()), getdate()),@Msg_Status,'NA','False',@IsPublic)
end

GO
/****** Object:  StoredProcedure [dbo].[Spp_SignUp]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[Spp_SignUp]
(
@Uid	int	=null,
@UserId	nvarchar(200)=null,
@EmailId	nvarchar(500)	,
@FirstName	nvarchar(100)=null	,
@LastName	nvarchar(100)=null	,
@Password	nvarchar(500),
@CreatedBy nvarchar(50)=null
)
as
begin
declare @Status	bit	
if (exists (Select LoginId from Login_Table where UserId=@UserId)  )
begin
update Login_Table set  UserId=@UserId, EmailId=@EmailId, FirstName=@FirstName, LastName=@LastName, Password=@Password, Status=@Status where UserId=@UserId
end
else
begin
begin transaction t
begin
try
set @Status=1
if(Exists(select * from Login_Table where EmailId=@EmailId and isnull(googleid,'')<>''))
begin
update Login_Table set   FirstName=@FirstName, LastName=@LastName, Password=@Password,googleId='', Status=@Status where EmailId=@EmailId
end
else if(Exists(select * from Login_Table where EmailId=@EmailId and isnull(FaceBookId,'')<>''))
begin
update Login_Table set   FirstName=@FirstName, LastName=@LastName, Password=@Password,FaceBookId='', Status=@Status where EmailId=@EmailId
end
else
begin
insert into Login_Table( Uid, UserId, EmailId, FirstName, LastName, Password, Status,[Email_verified])values(@Uid, @UserId, @EmailId, @FirstName, @LastName, @Password, @Status,0)
insert Into dbo.Profile_Info(Profile_Id,CreatedBy)values(@UserId,@CreatedBy)
end

Commit transaction t
end try
begin catch
Rollback transaction t
end catch
end

end




GO
/****** Object:  StoredProcedure [dbo].[Spp_SignUpAPI]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[Spp_SignUpAPI]
(
@Uid	int	=null,
@UserId	nvarchar(200)=null,
@EmailId	nvarchar(500)	,
@FirstName	nvarchar(100)=null	,
@LastName	nvarchar(100)=null	,
@Password	nvarchar(500),
@CreatedBy nvarchar(50)=null,
@Login_Type int=0
)
as
begin
declare @Status	bit
if @Login_Type=0
begin	
if (exists (Select LoginId from Login_Table where UserId=@UserId)  )
begin
update Login_Table set  UserId=@UserId, EmailId=@EmailId, FirstName=@FirstName, LastName=@LastName, 
Password=@Password, Status=@Status where UserId=@UserId
end
else

begin
begin transaction t
begin
try
set @Status=1
if(Exists(select * from Login_Table where EmailId=@EmailId and isnull(googleid,'')<>''))
begin
update Login_Table set   FirstName=@FirstName, LastName=@LastName, Password=@Password,googleId='', Status=@Status where EmailId=@EmailId
end
else if(Exists(select * from Login_Table where EmailId=@EmailId and isnull(FaceBookId,'')<>''))
begin
update Login_Table set   FirstName=@FirstName, LastName=@LastName, Password=@Password,FaceBookId='', Status=@Status where EmailId=@EmailId
end
else
begin
insert into Login_Table( Uid, UserId, EmailId, FirstName, LastName, Password, Status,[Email_verified])values(@Uid, @UserId, @EmailId, @FirstName, @LastName, @Password, @Status,0)
insert Into dbo.Profile_Info(Profile_Id,CreatedBy)values(@UserId,@CreatedBy)
end

Commit transaction t
end try
begin catch
Rollback transaction t
end catch
end
end


else if @Login_Type=1
 begin
if exists (select [EmailId] from [dbo].[Login_Table] where [EmailId]=@EmailId)
 begin
  update [dbo].[Login_Table] set [googleId]=@Password where [EmailId]=@EmailId
end
 else
begin
 insert into Login_Table( Uid, UserId, EmailId, FirstName, LastName, [googleId], Status,[Email_verified])
 values(@Uid, @UserId, @EmailId, @FirstName, @LastName, @Password, @Status,1)
 insert Into dbo.Profile_Info(Profile_Id,CreatedBy)values(@UserId,@CreatedBy)
end
end

else if @Login_Type=2
 begin
if exists (select [EmailId] from [dbo].[Login_Table] where [EmailId]=@EmailId)
 begin
  update [dbo].[Login_Table] set [FaceBookId]=@Password where [EmailId]=@EmailId
end
 else
begin
 insert into Login_Table( Uid, UserId, EmailId, FirstName, LastName, [FaceBookId], Status,[Email_verified])
 values(@Uid, @UserId, @EmailId, @FirstName, @LastName, @Password, @Status,1)
 insert Into dbo.Profile_Info(Profile_Id,CreatedBy)values(@UserId,@CreatedBy)
end
end


end



GO
/****** Object:  StoredProcedure [dbo].[spp_update_Agent_Picture]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_update_Agent_Picture]
(
@PhotoId varchar(50),
@Photo_Title nvarchar(200) = null,
@Photo nvarchar(50) = null
)
as
begin
update Agent_Picture set [Photo_Title]=@Photo_Title, [Photo]=@Photo
where [PhotoId] = @PhotoId
end

GO
/****** Object:  StoredProcedure [dbo].[spp_update_Area]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  proc [dbo].[spp_update_Area]
@AreaId int ,
@Area varchar(50)
as 
begin 
   update  Area_tbl  set Area=@Area where AreaId=@AreaId
end

GO
/****** Object:  StoredProcedure [dbo].[spp_update_Characteristic]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  proc [dbo].[spp_update_Characteristic]
@CharId bigint ,
@Characteristic nvarchar(50)
as 
begin 
   update  dbo.PropertyCharacteristics  set Characteristic=@Characteristic where CharId=@CharId
end

GO
/****** Object:  StoredProcedure [dbo].[spp_update_ClassifiedAds_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_update_ClassifiedAds_tbl]

(

@ClassifiedId varchar(50),

@Title nvarchar(100) = null,

@Pay_Type varchar(10) = null,

@Amount decimal = null,

@Image varchar(50)=null,

@Description nvarchar(max) = null,

@Contact_Name nvarchar(100) = null,

@Contact_Email nvarchar(100) = null,

@Contact_Phone varchar(20) = null,

@Contact_location nvarchar(100) = null,

@Catid varchar(50) = null,

@Latitude float = null,

@Longitude float = null,
@HasTag nvarchar(500)=null,
@Sponsored_Ad bit=null,
@Featured_Banner bit=null,
@ScreenName nvarchar(500)=null
)

as

begin

update ClassifiedAds_tbl set  [Title]=@Title, [Pay_Type]=@Pay_Type, [Amount]=@Amount,[Image]= @Image,[Description]=@Description, 
[Contact_Name]=@Contact_Name, [Contact_Email]=@Contact_Email, [Contact_Phone]=@Contact_Phone, 
[Contact_location]=@Contact_location,Catid=@Catid,[Latitude]=@Latitude,[Longitude]=@Longitude,[HasTag]=@HasTag,
[Sponsored_Ad]=@Sponsored_Ad,[Featured_Banner]=@Featured_Banner,[ScreenName]=@ScreenName
where [ClassifiedId] = @ClassifiedId

end

GO
/****** Object:  StoredProcedure [dbo].[spp_update_ClassifiedFeature_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_update_ClassifiedFeature_tbl]
(
@CFeatureid varchar(50),
@Feature_Detail nvarchar(100) = null,
@Feature_Value nvarchar(100) = null
)
as
begin
update ClassifiedFeature_tbl set  [Feature_Detail]=@Feature_Detail, [Feature_Value]=@Feature_Value
where [CFeatureid] = @CFeatureid
end

GO
/****** Object:  StoredProcedure [dbo].[spp_update_ContactPage]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_update_ContactPage]
(
@Id bigint,
@Primary_Email nvarchar(100) = null,
@Secondary_Email nvarchar(100) = null,
@Primary_Contact varchar(50) = null,
@Secondary_Contact varchar(50) = null,
@Address nvarchar(100) = null,
@City nvarchar(50) = null,
@ZipCode nvarchar(20) = null
)
as
begin
update ContactPage set [Primary_Email]=@Primary_Email, [Secondary_Email]=@Secondary_Email, [Primary_Contact]=@Primary_Contact, [Secondary_Contact]=@Secondary_Contact, [Address]=@Address, [City]=@City, [ZipCode]=@ZipCode
where [Id] = @Id
end

GO
/****** Object:  StoredProcedure [dbo].[spp_update_Content_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_update_Content_tbl]
(
@Id int,
@Page_Name nvarchar(50) = null,
@Page_Title nvarchar(50) = null,
@Page_Heading nvarchar(MAX) = null,
@Section nvarchar(50) = null,
@Page_Content nvarchar(MAX) = null
)
as
begin
update Content_tbl set [Page_Name]=@Page_Name, [Page_Title]=@Page_Title, [Page_Heading]=@Page_Heading, [Section]=@Section, [Page_Content]=@Page_Content
where [Id] = @Id
end

GO
/****** Object:  StoredProcedure [dbo].[spp_update_Feature]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  proc [dbo].[spp_update_Feature]
@FeatureId varchar(50) ,
@FeatureName nvarchar(50),
@FeatureType nvarchar(50)
as 
begin 
   update  dbo.FeatureMaster  set FeatureName=@FeatureName,FeatureType=@FeatureType where FeatureId=@FeatureId
end

GO
/****** Object:  StoredProcedure [dbo].[spp_update_PriceHistory_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_update_PriceHistory_tbl]
(
@PriceId varchar(50),
@Date datetime = null,
@Event varchar(50) = null,
@Price decimal = null,
@Price_Sqft decimal = null,
@Source nvarchar(50) = null,
@PropertyId varchar(50) = null
)
as
begin
update PriceHistory_tbl set  [Date]=@Date, [Event]=@Event, [Price]=@Price, [Price_Sqft]=@Price_Sqft, [Source]=@Source
where [PriceId] = @PriceId and [PropertyId]=@PropertyId
end

GO
/****** Object:  StoredProcedure [dbo].[spp_update_Property_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_update_Property_tbl]
(
@PropertyId varchar(50),
@PropertyFor nvarchar(50) = null,
@PropertyTypeId varchar(50) = null,
@PropertyTitle nvarchar(200) = null,
@FrontImage varchar(200) = null,
@Price decimal = null,
@PriceUnit varchar(50) = null,
@Area decimal(18,2) = null,
@AreaUnit varchar(50) = null,
@PAgeId varchar(50) = null,
@Description nvarchar(MAX) = null,
@Address nvarchar(500) = null,
@City nvarchar(100) = null,
@State nvarchar(50) = null,
@PostCode nvarchar(50) = null,
@Latitude float = null,
@Longitude float = null,
@Video nvarchar(50) = null,
@Contact varchar(50) = null,
@FurnishedStatus nvarchar(50) = null,
@Features nvarchar(MAX)=null,
@PropertyImages varchar(MAx)=null,
@MLSNumber nvarchar(50)=null,
@LOTArea decimal(18,2)=null,
@LOTAreaUnit varchar(50)=null,
@YearBuilt int=null
)
as
begin
update Property_tbl set  [PropertyFor]=@PropertyFor, [PropertyTypeId]=@PropertyTypeId, [Property_Title]=@PropertyTitle,
 [FrontImage]=@FrontImage, [Price]=@Price, [PriceUnit]=@PriceUnit, [Area]=@Area, [AreaUnit]=@AreaUnit, [PAgeId]=@PAgeId, [Description]=@Description,
  [Address]=@Address, [City]=@City, [State]=@State, [PostCode]=@PostCode, [Latitude]=@Latitude, [Longitude]=@Longitude, [Video]=@Video, [Contact]=@Contact,
  FurnishedStatus=@FurnishedStatus,MLSNumber=@MLSNumber,LOTArea=@LOTArea,LOTAreaUnit=@LOTAreaUnit,YearBuilt=@YearBuilt
where [PropertyId] = @PropertyId

if(@Features<>'')
begin
Delete dbo.Property_Feature_Mapping where PropertyId=@PropertyId
Insert into dbo.Property_Feature_Mapping Select  Substring(Item, 1,Charindex('#', Item)-1) , @PropertyId,Substring(Item, Charindex('#', Item)+1, LEN(Item)) from dbo.Splitmaster(@Features,',') 
end
if(@PropertyImages<>'')
begin
--Delete [dbo].[Property_Images] where [PropertyId]=@PropertyId
insert into [dbo].[Property_Images](PropertyId, PrpertyImage)select @PropertyId,item from dbo.Splitmaster(@PropertyImages,',')
end

end

GO
/****** Object:  StoredProcedure [dbo].[spp_update_Property_video]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_update_Property_video]
(
@VideoId varchar(50),
@PropertyId varchar(50) = null,
@Video_Title nvarchar(100) = null,
@File_Type nvarchar(20) = null,
@Video varchar(50) = null
)
as
begin
update Property_video set [VideoId]=@VideoId, [Video_Title]=@Video_Title, [File_Type]=@File_Type, [Video]=@Video
where [VideoId] = @VideoId and [PropertyId]=@PropertyId
end

GO
/****** Object:  StoredProcedure [dbo].[spp_update_PropertyAge]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  proc [dbo].[spp_update_PropertyAge]
@PAgeId bigint ,
@PropertyAge nvarchar(50)
as 
begin 
   update dbo.PropertyAgeMaster_tbl set PropertyAge=@PropertyAge where PAgeId=@PAgeId
end

GO
/****** Object:  StoredProcedure [dbo].[spp_update_PropertyType]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  proc [dbo].[spp_update_PropertyType] 
@PropertyTypeId varchar(50),
@PropertyType nvarchar(50)=null,
@PropertyTyp_Image varchar(50)=null,
@PropertyTypeCode nvarchar(50)=null
as 
begin 
   update  PropertyType_tbl  set PropertyType=@PropertyType,PropertyTypeCode=@PropertyTypeCode,
   PropertyTyp_Image=@PropertyTyp_Image where PropertyTypeId=@PropertyTypeId
end

GO
/****** Object:  StoredProcedure [dbo].[spp_update_SociallinkMapping_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_update_SociallinkMapping_tbl]
(
@SMID varchar(50),
@SocialId bigint = null,
@Social_link nvarchar(200) = null
)
as
begin
update SociallinkMapping_tbl set [SocialId]=@SocialId, [Social_link]=@Social_link
where [SMID]=@SMID
end

GO
/****** Object:  StoredProcedure [dbo].[spp_update_SociallinkYellowPagesMapping_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE proc [dbo].[spp_update_SociallinkYellowPagesMapping_tbl]
(
@SMID varchar(50),
@SocialId bigint = null,
@Social_link nvarchar(200) = null
)
as
begin
update SociallinkYellowPagesMapping_tbl set [SocialId]=@SocialId, [Social_link]=@Social_link
where [SMID]=@SMID
end


GO
/****** Object:  StoredProcedure [dbo].[spp_update_TaxHistory_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[spp_update_TaxHistory_tbl]
(
@TaxId varchar(50),
@Year bigint = null,
@PropertyTax decimal = null,
@PTax_Changes decimal = null,
@TaxAssessmnt decimal = null,
@TaxAssessmnt_Changes decimal = null,
@PropertyId varchar(50) = null
)
as
begin
update TaxHistory_tbl set  [Year]=@Year, [PropertyTax]=@PropertyTax, [PTax_Changes]=@PTax_Changes, [TaxAssessmnt]=@TaxAssessmnt, [TaxAssessmnt_Changes]=@TaxAssessmnt_Changes
where [TaxId] = @TaxId and [PropertyId]=@PropertyId
end




GO
/****** Object:  StoredProcedure [dbo].[spp_updatePage]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_updatePage]
(
 @id int,
 @Page_Name nvarchar(50),
 @Page_Title nvarchar(50),
 @Page_Heading ntext,
 @Page_Content ntext,
 @Page_Content2 ntext=null
) 
as
begin
 update dbo.Page set Page_Name=@Page_Name,Page_Title=@Page_Title,Page_Heading=@Page_Heading,Page_Content=@Page_Content,Page_Content2=@Page_Content2
 where id=@id
end

GO
/****** Object:  StoredProcedure [dbo].[spp_updateproduct]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_updateproduct]
(
@Product_ID nvarchar(50),
@Category_Id nvarchar(100) =null,
@Sub_Category_Id nvarchar(50) =null,
@Product_Code nvarchar(200) =null,
@Product_Name nvarchar(max) = null,
@Product_Image nvarchar(max) =null,
@Base_Price decimal(18,2) =null,
@Display_Price decimal(18,2) =null,
@Product_Quantity decimal(18,2) =null,
@Description nvarchar(MAX) =null,
@Vat decimal(18,2)=null,
@Package int=null,
@QtyPerPackage int=null,
@QtyType varchar(50)=null,
@userid varchar(50),
@Featured bit=null,
@Used_Product bit=null,
@Point int=null
)
as
begin
Update [dbo].[Product] set Category_Id=@Category_Id,Sub_Category_Id=@Sub_Category_Id,Product_Code=@Product_Code,Product_Name=@Product_Name,
Product_Font_Image=case when (isnull(@Product_Image,'')<>'') then @Product_Image else Product_Font_Image end,Base_Price=@Base_Price,Display_Price=@Display_Price,Product_Stock_Count=@Product_Quantity,
Product_Desc=@Description,Vat=@Vat,[Package]=@Package,[QtyPerPackage]=@QtyPerPackage,[QtyType]=@QtyType,
ModifyBy_Id=@userid, Featured=@Featured,Used_Product=@Used_Product,[Point]=@Point
where Product_Id=@Product_ID
end


GO
/****** Object:  StoredProcedure [dbo].[spp_updateProperty_tbl]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spp_updateProperty_tbl] AS
GO
/****** Object:  StoredProcedure [dbo].[spp_updateTestimonial]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[spp_updateTestimonial]
(
@Tid varchar(50),
@Name nvarchar(100) = null,
@Designation nvarchar(50) = null,
@Comment nvarchar(200) = null,
@Photo varchar(50) = null
)
as
begin
update Testimonial set  [Name]=@Name, [Designation]=@Designation, [Comment]=@Comment, [Photo]=@Photo
where [Tid] = @Tid
end

GO
/****** Object:  StoredProcedure [dbo].[spp_User_ChangePassword]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE proc [dbo].[spp_User_ChangePassword]
(
 @UserId varchar(100),
 @CurrPassword nvarchar(100)=null,
 @Password nvarchar(100)=null
)
as
begin
    declare @OldPass nvarchar(100)
    declare @Status nvarchar(100)
    select @OldPass=[Password]  from [dbo].[Login_Table] where UserId=@UserId
    
    set @Status='FAILED'
    if(@OldPass<>@CurrPassword)
    begin 
     set @Status='FAILED'
     select 'Current password is incorrect' as Msg,@Status  as [Status]
    end
    else
    begin
     update dbo.[Login_Table] set [Password]=@Password where UserId=@UserId
     set @Status='SUCCESS'
     select 'Password changed sucessfully' as Msg,@Status  as [Status]
    end
    
    
end

GO
/****** Object:  StoredProcedure [dbo].[TextSearch]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[TextSearch]
(    
@stringToFind nVARCHAR(100),
@schema sysname,
@table sysname,
@RColumnName varchar(50)
)
AS
BEGIN
Create table #temp(row int identity,keyword NVARCHAR(1000))
insert into #temp select item from[dbo].FullText_To_Table(@stringToFind)
DECLARE @sqlCommandfinal nvarchar(max)=''
declare @Output TABLE ( Item NVARCHAR(1000))
--declare @ParaDefination nvarchar(Max)
--set @ParaDefination='@Output TABLE (Item NVARCHAR(1000))'
declare @count int,@row bigint 
declare @string Nvarchar(1000)
select @count=count(row)from #temp
set @row=1
while (@row<=@count)
begin
set @string=''
Select @string=keyword from #temp where row=@row
if(@string<>'')
begin
set @string='%'+@string+'%'
 DECLARE @sqlCommand nvarchar(max) = 'SELECT ['+@RColumnName+'] FROM [' + @schema + '].[' + @table + '] WHERE ' 	   
   SELECT @sqlCommand = @sqlCommand + '[' + COLUMN_NAME + '] LIKE ''' + @string + ''' OR '
   FROM INFORMATION_SCHEMA.COLUMNS 
   WHERE TABLE_SCHEMA = @schema
   AND TABLE_NAME = @table 
   AND DATA_TYPE IN ('char','nchar','ntext','nvarchar','text','varchar')   
   SET @sqlCommand = left(@sqlCommand,len(@sqlCommand)-3)
  set @sqlCommandfinal=@sqlCommandfinal+@sqlCommand
   if(@row<>@count)   
   SET @sqlCommandfinal=@sqlCommandfinal+' UNION '
   
     
end
   
   set @row=@row+1
end
   


Print @sqlCommandfinal

	insert into @Output(Item)  EXECUTE sp_executesql @sqlCommandfinal;
	Select * from @Output 
END

GO
/****** Object:  StoredProcedure [dbo].[UpdateFeatureCategory]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[UpdateFeatureCategory]
(
@FeatureCatId varchar(50),
@FeatureCategory nvarchar(50) = null
)
as
begin
if Exists(Select * from FeatureCategory where [FeatureCatId] = @FeatureCatId)
begin
update FeatureCategory set [FeatureCatId]=@FeatureCatId, [FeatureCategory]=@FeatureCategory
where [FeatureCatId] = @FeatureCatId
end
end

GO
/****** Object:  StoredProcedure [dbo].[updateSlide]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[updateSlide]
(
 @id int,
 @Slide_Name nvarchar(50),
 @Title nvarchar(250),
 @Image nvarchar(500)=null
)
as
begin
if(@Image is null)
begin
update Slide set Slide_Name=@Slide_Name,Title=@Title
 where id=@id
end
else
 begin
 update Slide set Slide_Name=@Slide_Name,Title=@Title,[Image]=@Image
 where id=@id
 end
end


GO
/****** Object:  StoredProcedure [khupho].[spp_EditEventsAPI]    Script Date: 4/17/2019 1:50:48 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [khupho].[spp_EditEventsAPI]
(

@EventId varchar(100),
@EventTitle nvarchar(100) = null,
@Description nvarchar(Max) = null,
@ShownType nvarchar(50) = null,
@ShowingDay int = null,
@Start_Date date = null,
@End_Date date = null,
@Start_Time time = null,
@End_Time time = null,
@CreatedBy varchar(100) = null,
@Event_Type varchar(50) = null,
@PropertyId	varchar(50)	=null
)
as
begin
begin transaction t
if Exists(Select EventId from Events_Table where EventId=@EventId)
begin
update Events_Table set [EventTitle]=isnull(@EventTitle,[EventTitle]), 
[Description]=isnull(@Description,[Description]), [ShownType]=isnull(@ShownType,[ShownType]),
[ShowingDay]=isnull(@ShowingDay,[ShowingDay]), [Start_Date]=isnull(@Start_Date,[Start_Date]),
[End_Date]=isnull(@End_Date,[End_Date]), [Start_Time]=isnull(@Start_Time,[Start_Time]),
[End_Time]=isnull(@End_Time,[End_Time]), [Event_Type]=isnull(@Event_Type,[Event_Type]),
PropertyId=isnull(@PropertyId,[PropertyId])
where [EventId] = @EventId
end
if(@@ERROR>0)
begin
	rollback transaction t
end
else
begin
	commit transaction t
end
end
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[42] 4[20] 2[16] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "Ad_Mapping_SubCategory"
            Begin Extent = 
               Top = 5
               Left = 271
               Bottom = 160
               Right = 448
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "ProductSubCategory"
            Begin Extent = 
               Top = 10
               Left = 1
               Bottom = 205
               Right = 238
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Ads_tbl"
            Begin Extent = 
               Top = 7
               Left = 474
               Bottom = 205
               Right = 644
            End
            DisplayFlags = 280
            TopColumn = 9
         End
         Begin Table = "View_Login_Profile"
            Begin Extent = 
               Top = 9
               Left = 736
               Bottom = 205
               Right = 928
            End
            DisplayFlags = 280
            TopColumn = 6
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 21
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
      ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_AdList'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N'   Column = 2550
         Alias = 2385
         Table = 2580
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_AdList'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_AdList'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "View_Login_Profile"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 211
               Right = 230
            End
            DisplayFlags = 280
            TopColumn = 9
         End
         Begin Table = "AgentComments"
            Begin Extent = 
               Top = 20
               Left = 386
               Bottom = 149
               Right = 556
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 11
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Agent_Comments'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Agent_Comments'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[52] 4[10] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "Login_Table"
            Begin Extent = 
               Top = 11
               Left = 0
               Bottom = 140
               Right = 170
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Profile_Info"
            Begin Extent = 
               Top = 6
               Left = 199
               Bottom = 135
               Right = 391
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "AgentContact_tbl"
            Begin Extent = 
               Top = 4
               Left = 765
               Bottom = 133
               Right = 943
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Property_tbl"
            Begin Extent = 
               Top = 0
               Left = 499
               Bottom = 129
               Right = 672
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "AreaUnit_tbl"
            Begin Extent = 
               Top = 208
               Left = 810
               Bottom = 337
               Right = 1006
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "PropertyType_tbl"
            Begin Extent = 
               Top = 249
               Left = 636
               Bottom = 373
               Right = 828
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "PropertyAgeMaster_tbl"
            Begin Extent = 
               Top = 159
               Left = 302
               Bottom = 254
               Right = 472' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_AgentContact_Property'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N'
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 37
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_AgentContact_Property'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_AgentContact_Property'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "AgentContact_tbl"
            Begin Extent = 
               Top = 0
               Left = 26
               Bottom = 193
               Right = 204
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Property_tbl"
            Begin Extent = 
               Top = 0
               Left = 264
               Bottom = 129
               Right = 437
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 37
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOr' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_AgentContactList'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N'der = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_AgentContactList'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_AgentContactList'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "ProductCategory"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 135
               Right = 242
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "ProductSubCategory"
            Begin Extent = 
               Top = 6
               Left = 280
               Bottom = 209
               Right = 530
            End
            DisplayFlags = 280
            TopColumn = 1
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_CategorySubCategory'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_CategorySubCategory'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "Profile_Info"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 214
               Right = 230
            End
            DisplayFlags = 280
            TopColumn = 12
         End
         Begin Table = "Login_Table"
            Begin Extent = 
               Top = 6
               Left = 268
               Bottom = 178
               Right = 438
            End
            DisplayFlags = 280
            TopColumn = 6
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ChatLoginProfile'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ChatLoginProfile'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[42] 4[4] 2[12] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "ClassifiedAds_tbl"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 208
               Right = 233
            End
            DisplayFlags = 280
            TopColumn = 11
         End
         Begin Table = "ClassifiedCategory"
            Begin Extent = 
               Top = 6
               Left = 271
               Bottom = 135
               Right = 441
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 17
         Width = 284
         Width = 1500
         Width = 5475
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 2925
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 1650
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Classfied_Category'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Classfied_Category'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[30] 4[48] 2[6] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "View_Login_Profile"
            Begin Extent = 
               Top = 0
               Left = 485
               Bottom = 369
               Right = 677
            End
            DisplayFlags = 280
            TopColumn = 1
         End
         Begin Table = "ClassifiedComments"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 331
               Right = 208
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 3105
         Table = 3150
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Classified_Comments'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Classified_Comments'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[71] 4[7] 2[18] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "Comments_tbl"
            Begin Extent = 
               Top = 15
               Left = 21
               Bottom = 248
               Right = 191
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "View_Login_Profile"
            Begin Extent = 
               Top = 1
               Left = 310
               Bottom = 374
               Right = 502
            End
            DisplayFlags = 280
            TopColumn = 6
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 2880
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Comments'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Comments'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[30] 4[4] 2[4] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "AgentContact_tbl"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 204
               Right = 216
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Property_tbl"
            Begin Extent = 
               Top = 6
               Left = 254
               Bottom = 191
               Right = 427
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 13
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Contact_Property'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Contact_Property'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[81] 4[1] 2[14] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "Follow"
            Begin Extent = 
               Top = 4
               Left = 13
               Bottom = 259
               Right = 183
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "View_Login_Profile"
            Begin Extent = 
               Top = 12
               Left = 212
               Bottom = 353
               Right = 404
            End
            DisplayFlags = 280
            TopColumn = 17
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Followed_Members'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Followed_Members'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "View_Login_Profile"
            Begin Extent = 
               Top = 6
               Left = 246
               Bottom = 185
               Right = 438
            End
            DisplayFlags = 280
            TopColumn = 26
         End
         Begin Table = "InvocePublicMarket_tbl"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 210
               Right = 208
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_InvoiceWithLogin'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_InvoiceWithLogin'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "Login_Table"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 135
               Right = 208
            End
            DisplayFlags = 280
            TopColumn = 8
         End
         Begin Table = "User_Type"
            Begin Extent = 
               Top = 6
               Left = 246
               Bottom = 118
               Right = 416
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Login'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Login'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[44] 4[17] 2[16] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "User_Type"
            Begin Extent = 
               Top = 13
               Left = 12
               Bottom = 139
               Right = 182
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Login_Table"
            Begin Extent = 
               Top = 0
               Left = 221
               Bottom = 179
               Right = 391
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Profile_Info"
            Begin Extent = 
               Top = 0
               Left = 471
               Bottom = 192
               Right = 663
            End
            DisplayFlags = 280
            TopColumn = 3
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 11
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 2085
         Alias = 1620
         Table = 2415
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Login_Profile'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Login_Profile'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[41] 4[20] 2[14] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "Product"
            Begin Extent = 
               Top = 18
               Left = 412
               Bottom = 184
               Right = 615
            End
            DisplayFlags = 280
            TopColumn = 1
         End
         Begin Table = "Order_Itemdetail_tbl"
            Begin Extent = 
               Top = 14
               Left = 213
               Bottom = 218
               Right = 383
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Orderdetail_tbl"
            Begin Extent = 
               Top = 11
               Left = 0
               Bottom = 202
               Right = 190
            End
            DisplayFlags = 280
            TopColumn = 25
         End
         Begin Table = "ProductCategory"
            Begin Extent = 
               Top = 6
               Left = 653
               Bottom = 135
               Right = 857
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "ProductSubCategory"
            Begin Extent = 
               Top = 104
               Left = 653
               Bottom = 233
               Right = 882
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Colum' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_OrderListForProduct'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N'n = 1440
         Alias = 900
         Table = 1875
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_OrderListForProduct'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_OrderListForProduct'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "Product"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 179
               Right = 241
            End
            DisplayFlags = 280
            TopColumn = 1
         End
         Begin Table = "Cart_tbl"
            Begin Extent = 
               Top = 6
               Left = 279
               Bottom = 172
               Right = 449
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Product_Cart'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Product_Cart'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "View_Login_Profile"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 210
               Right = 230
            End
            DisplayFlags = 280
            TopColumn = 6
         End
         Begin Table = "ProductComments"
            Begin Extent = 
               Top = 6
               Left = 268
               Bottom = 135
               Right = 438
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Product_Comments'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Product_Comments'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[56] 4[6] 2[14] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "ProductCategory"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 222
               Right = 242
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "ProductSubCategory"
            Begin Extent = 
               Top = 10
               Left = 433
               Bottom = 250
               Right = 662
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ProductCategoryList'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ProductCategoryList'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[51] 4[17] 2[9] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "Product"
            Begin Extent = 
               Top = 54
               Left = 518
               Bottom = 246
               Right = 721
            End
            DisplayFlags = 280
            TopColumn = 16
         End
         Begin Table = "Product_Chat"
            Begin Extent = 
               Top = 0
               Left = 300
               Bottom = 204
               Right = 488
            End
            DisplayFlags = 280
            TopColumn = 1
         End
         Begin Table = "ProductSubCategory"
            Begin Extent = 
               Top = 138
               Left = 759
               Bottom = 267
               Right = 988
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "ProductCategory"
            Begin Extent = 
               Top = 6
               Left = 759
               Bottom = 135
               Right = 963
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Admin"
            Begin Extent = 
               Top = 145
               Left = 87
               Bottom = 257
               Right = 257
            End
            DisplayFlags = 280
            TopColumn = 1
         End
         Begin Table = "View_Login_Profile"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 197
               Right = 230
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 20
         Width = 284
         Width = 150' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ProductChart_WithLogin'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N'0
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 2220
         Alias = 2550
         Table = 2535
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ProductChart_WithLogin'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ProductChart_WithLogin'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[42] 4[24] 2[6] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "User_Type_1"
            Begin Extent = 
               Top = 119
               Left = 260
               Bottom = 231
               Right = 430
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Profile_Info_1"
            Begin Extent = 
               Top = 162
               Left = 186
               Bottom = 291
               Right = 378
            End
            DisplayFlags = 280
            TopColumn = 7
         End
         Begin Table = "Login_Table_1"
            Begin Extent = 
               Top = 1
               Left = 17
               Bottom = 192
               Right = 190
            End
            DisplayFlags = 280
            TopColumn = 2
         End
         Begin Table = "Product"
            Begin Extent = 
               Top = 5
               Left = 275
               Bottom = 185
               Right = 478
            End
            DisplayFlags = 280
            TopColumn = 16
         End
         Begin Table = "Profile_Info"
            Begin Extent = 
               Top = 67
               Left = 730
               Bottom = 196
               Right = 922
            End
            DisplayFlags = 280
            TopColumn = 9
         End
         Begin Table = "Login_Table"
            Begin Extent = 
               Top = 82
               Left = 520
               Bottom = 218
               Right = 690
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "User_Type"
            Begin Extent = 
               Top = 94
               Left = 755
               Bottom = 221
               Right = 925
            End
    ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ProductList'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N'        DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "ProductSubCategory"
            Begin Extent = 
               Top = 7
               Left = 755
               Bottom = 136
               Right = 984
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "ProductCategory"
            Begin Extent = 
               Top = 0
               Left = 564
               Bottom = 129
               Right = 768
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 35
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1920
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ProductList'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ProductList'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "Product"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 135
               Right = 241
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Product_WishList"
            Begin Extent = 
               Top = 6
               Left = 279
               Bottom = 118
               Right = 449
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ProductsWishList'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ProductsWishList'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[41] 4[31] 2[10] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "Product"
            Begin Extent = 
               Top = 0
               Left = 361
               Bottom = 210
               Right = 564
            End
            DisplayFlags = 280
            TopColumn = 15
         End
         Begin Table = "ProductSubCategory"
            Begin Extent = 
               Top = 0
               Left = 16
               Bottom = 129
               Right = 245
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "ProductCategory"
            Begin Extent = 
               Top = 18
               Left = 657
               Bottom = 147
               Right = 861
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 3360
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ProductWithCategorySubCategory'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_ProductWithCategorySubCategory'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[33] 4[20] 2[16] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "p"
            Begin Extent = 
               Top = 0
               Left = 54
               Bottom = 129
               Right = 227
            End
            DisplayFlags = 280
            TopColumn = 35
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 37
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 4245
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 3660
         Alias = 1965
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Property_List'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Property_List'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[70] 4[21] 2[4] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "AreaUnit_tbl"
            Begin Extent = 
               Top = 0
               Left = 815
               Bottom = 129
               Right = 1011
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Property_tbl"
            Begin Extent = 
               Top = 0
               Left = 561
               Bottom = 456
               Right = 734
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Profile_Info"
            Begin Extent = 
               Top = 145
               Left = 320
               Bottom = 371
               Right = 512
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Login_Table"
            Begin Extent = 
               Top = 14
               Left = 99
               Bottom = 267
               Right = 269
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "AreaUnit_tbl_1"
            Begin Extent = 
               Top = 151
               Left = 818
               Bottom = 280
               Right = 1014
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "PropertyType_tbl"
            Begin Extent = 
               Top = 0
               Left = 330
               Bottom = 129
               Right = 522
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "PropertyAgeMaster_tbl"
            Begin Extent = 
               Top = 301
               Left = 833
               Bottom = 396
               Right = 1003' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Propertydtl'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N'
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Propertydtl'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Propertydtl'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "FeatureCategory"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 118
               Right = 214
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "FeatureMaster"
            Begin Extent = 
               Top = 0
               Left = 372
               Bottom = 129
               Right = 542
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "ProprtyType_Feature_Mapping"
            Begin Extent = 
               Top = 120
               Left = 20
               Bottom = 249
               Right = 251
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_PType_FMapping'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_PType_FMapping'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[34] 4[29] 2[21] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = -96
         Left = 0
      End
      Begin Tables = 
         Begin Table = "Property_tbl"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 213
               Right = 211
            End
            DisplayFlags = 280
            TopColumn = 25
         End
         Begin Table = "PropertyType_tbl"
            Begin Extent = 
               Top = 0
               Left = 424
               Bottom = 129
               Right = 616
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "AreaUnit_tbl"
            Begin Extent = 
               Top = 125
               Left = 273
               Bottom = 266
               Right = 469
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "AreaUnit_tbl_1"
            Begin Extent = 
               Top = 129
               Left = 396
               Bottom = 258
               Right = 592
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "View_Login_Profile"
            Begin Extent = 
               Top = 46
               Left = 609
               Bottom = 175
               Right = 801
            End
            DisplayFlags = 280
            TopColumn = 10
         End
         Begin Table = "PropertyAgeMaster_tbl"
            Begin Extent = 
               Top = 270
               Left = 38
               Bottom = 365
               Right = 208
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 34
         Width = 2' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_SearchProperty'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N'84
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 2055
         Table = 2130
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_SearchProperty'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_SearchProperty'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[31] 4[27] 2[14] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "SociallinkMaster_tbl"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 132
               Right = 208
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "SociallinkMapping_tbl"
            Begin Extent = 
               Top = 6
               Left = 246
               Bottom = 135
               Right = 416
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 2355
         Width = 1500
         Width = 2565
         Width = 3060
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 1665
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_sociallink_mapping'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_sociallink_mapping'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "SociallinkMaster_tbl"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 154
               Right = 208
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "SociallinkYellowPagesMapping_tbl"
            Begin Extent = 
               Top = 6
               Left = 246
               Bottom = 135
               Right = 416
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_sociallinkYellowPages_mapping'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_sociallinkYellowPages_mapping'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[50] 4[12] 2[21] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "Events_Table"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 135
               Right = 208
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "Property_tbl"
            Begin Extent = 
               Top = 6
               Left = 246
               Bottom = 135
               Right = 419
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "View_Login"
            Begin Extent = 
               Top = 138
               Left = 38
               Bottom = 267
               Right = 208
            End
            DisplayFlags = 280
            TopColumn = 7
         End
         Begin Table = "WeekDay_tbl"
            Begin Extent = 
               Top = 138
               Left = 246
               Bottom = 233
               Right = 416
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Upcoming_Event'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_Upcoming_Event'
GO
