-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path02.02.02.SqlDataProvider
172 lines (135 loc) · 4.69 KB
/
02.02.02.SqlDataProvider
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/************************************************************/
/***** SqlDataProvider *****/
/***** *****/
/***** *****/
/***** Note: To manually execute this script you must *****/
/***** perform a search and replace operation *****/
/***** for {databaseOwner} and {objectQualifier} *****/
/***** *****/
/***** *****/
/***** *****/
/************************************************************/
/************************************************************/
/***** TABLE Start *****/
/************************************************************/
/************************************************************/
/***** SPROC Start *****/
/************************************************************/
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}NEvoweb_NB_Store_ClearDownStore]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure {databaseOwner}[{objectQualifier}NEvoweb_NB_Store_ClearDownStore]
GO
/*
Author: DCL
Last Modified for NB_Store version: 02.02.02
*/
CREATE PROCEDURE {databaseOwner}[{objectQualifier}NEvoweb_NB_Store_ClearDownStore]
@PortalID int
AS
begin
-- clear carts
delete
from {databaseOwner}{objectQualifier}NB_Store_Cart
where PortalID = @PortalID
-- clear orders
delete
from {databaseOwner}{objectQualifier}NB_Store_Orders
where PortalID = @PortalID
-- clear orders
delete
from {databaseOwner}{objectQualifier}NB_Store_Address
where PortalID = @PortalID
-- clear Product Images
delete
from {databaseOwner}{objectQualifier}NB_Store_ProductImage
where ProductID in (select productID from {databaseOwner}{objectQualifier}NB_Store_Products
where PortalID = @PortalID)
-- clear Product Doc
delete
from {databaseOwner}{objectQualifier}NB_Store_ProductDoc
where ProductID in (select productID from {databaseOwner}{objectQualifier}NB_Store_Products
where PortalID = @PortalID)
-- clear Products
delete
from {databaseOwner}{objectQualifier}NB_Store_Products
where PortalID = @PortalID
-- clear Categories
delete
from {databaseOwner}{objectQualifier}NB_Store_Categories
where PortalID = @PortalID
-- clear product Shipping
delete
from {databaseOwner}{objectQualifier}NB_Store_ShippingRates
where ShipType = 'PRD'
and PortalID = @PortalID
-- clear product Tax
delete
from {databaseOwner}{objectQualifier}NB_Store_TaxRates
where TaxType = 'PRD'
and PortalID = @PortalID
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}NEvoweb_NB_Store_Model_GetByRef]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure {databaseOwner}[{objectQualifier}NEvoweb_NB_Store_Model_GetByRef]
GO
/*
Author: DCL
Last Modified for NB_Store version: 02.02.02
*/
CREATE PROCEDURE {databaseOwner}[{objectQualifier}NEvoweb_NB_Store_Model_GetByRef]
@ProductID int,
@ModelRef nvarchar(20),
@Lang nchar(5)
AS
begin
select top 1
M.ModelID,
M.ProductID,
M.ListOrder,
M.UnitCost,
M.Barcode,
M.ModelRef,
M.Deleted,
ML.Lang,
ML.ModelName,
QtyRemaining,
QtyTrans,
QtyTransDate,
PL.ProductName,
P.PortalID,
isnull(SR.ProductWeight,0) as Weight,
isnull(SR.ProductHeight,0) as Height,
isnull(SR.ProductLength,0) as Length,
isnull(SR.ProductWidth,0) as Width,
M.QtyStockSet,
M.DealerCost,
M.DealerOnly,
M.PurchaseCost,
ML.[XMLData],
ML.Extra,
M.Allow
from {databaseOwner}[{objectQualifier}NB_Store_Model] as M
inner join {databaseOwner}[{objectQualifier}NB_Store_Products] as P on P.ProductID = M.ProductID
left outer join {databaseOwner}[{objectQualifier}NB_Store_ModelLang] as ML on ML.ModelID = M.ModelID and ML.Lang = @Lang
left outer join {databaseOwner}[{objectQualifier}NB_Store_ProductLang] as PL on PL.ProductID = M.ProductID and PL.Lang = @Lang
left outer join {databaseOwner}[{objectQualifier}NB_Store_ShippingRates] as SR on SR.ObjectID = M.ModelID and ShipType='PRD' and SR.[Disable]=0
where M.ModelRef = @ModelRef
and (M.ProductID = @ProductID or @ProductID = -1)
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
/************************************************************/