-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path02.00.02.SqlDataProvider
317 lines (241 loc) · 8.89 KB
/
02.00.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
/************************************************************/
/***** SqlDataProvider *****/
/***** *****/
/***** *****/
/***** Note: To manually execute this script you must *****/
/***** perform a search and replace operation *****/
/***** for {databaseOwner} and {objectQualifier} *****/
/***** *****/
/***** *****/
/***** *****/
/************************************************************/
/************************************************************/
/***** Table Start *****/
/************************************************************/
/************************************************************/
/***** Table End *****/
/************************************************************/
/************************************************************/
/***** 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_CartItems_GetCartList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure {databaseOwner}[{objectQualifier}NEvoweb_NB_Store_CartItems_GetCartList]
GO
CREATE PROCEDURE {databaseOwner}[{objectQualifier}NEvoweb_NB_Store_CartItems_GetCartList]
@CartID nvarchar(50)
AS
begin
select ItemID,
ItemDesc,
UnitCost,
Quantity,
(Quantity * UnitCost) as SubTotal,
ProductURL,
Discount
from {databaseOwner}[{objectQualifier}NB_Store_CartItems]
where CartID = @CartID
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_ProductDoc_GetExportList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure {databaseOwner}[{objectQualifier}NEvoweb_NB_Store_ProductDoc_GetExportList]
GO
/*
Description: Gets a list of all documents in a portal
Author: DCL
NB_Store version: 01.02.00
*/
CREATE PROCEDURE {databaseOwner}[{objectQualifier}NEvoweb_NB_Store_ProductDoc_GetExportList]
@PortalID int
AS
begin
select
D.DocID,
D.ProductID,
D.DocPath,
D.ListOrder,
D.Hidden,
D.[FileName],
D.[FileExt]
from {databaseOwner}[{objectQualifier}NB_Store_ProductDoc] as D
inner join {databaseOwner}{objectQualifier}NB_Store_Products as P on P.ProductId = D.ProductID
where P.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_ProductImage_GetExportList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure {databaseOwner}[{objectQualifier}NEvoweb_NB_Store_ProductImage_GetExportList]
GO
/*
Description: Gets a list of all images in a portal
Author: DCL
NB_Store version: 01.02.00
*/
CREATE PROCEDURE {databaseOwner}[{objectQualifier}NEvoweb_NB_Store_ProductImage_GetExportList]
@PortalID int
AS
begin
select
I.ImageID,
I.ProductID,
I.ImagePath,
I.ListOrder,
I.Hidden,
I.ImageURL
from {databaseOwner}[{objectQualifier}NB_Store_ProductImage] as I
inner join {databaseOwner}{objectQualifier}NB_Store_Products as P on P.ProductId = I.ProductID
where P.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_ShippingRates_GetList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure {databaseOwner}[{objectQualifier}NEvoweb_NB_Store_ShippingRates_GetList]
GO
CREATE PROCEDURE {databaseOwner}[{objectQualifier}NEvoweb_NB_Store_ShippingRates_GetList]
@PortalID int,
@ShipType varchar(5),
@Lang varchar(5),
@Filter varchar(50),
@CategoryID int,
@ShipMethodID int
AS
begin
if @ShipType = 'PRD'
begin
if @CategoryID = -1
begin
select
isnull(SR.ItemId,-1) as Itemid,
isnull(SR.Range1,0) as Range1,
isnull(SR.Range2,0) as Range2,
SM.ModelID as ObjectId,
isnull(SR.ShipCost,0) as ShipCost,
'PRD' as ShipType,
SR.[Disable],
PL.ProductName + ' - ' + sm.modelref + ' - ' + SML.ModelName as Description,
isnull(SR.ProductWeight,0) as ProductWeight,
isnull(SR.ProductHeight,0) as ProductHeight,
isnull(SR.ProductLength,0) as ProductLength,
isnull(SR.ProductWidth,0) as ProductWidth
from {databaseOwner}{objectQualifier}NB_Store_Model AS SM
left outer join {databaseOwner}[{objectQualifier}NB_Store_ShippingRates] as SR on SM.ModelID = SR.ObjectID and SR.ShipType = 'PRD'
inner join {databaseOwner}{objectQualifier}NB_Store_ModelLang AS SML on SML.ModelID = SM.ModelID and SML.Lang = @Lang
inner join {databaseOwner}[{objectQualifier}NB_Store_Products] as P on P.ProductID = SM.ProductID
left outer join {databaseOwner}[{objectQualifier}NB_Store_ProductLang] as PL on PL.ProductID = SM.ProductID and PL.Lang = @Lang
where (PL.ProductName like '%' + @Filter + '%' or SML.ModelName like '%' + @Filter + '%' or sm.modelref like '%' + @Filter + '%')
and P.PortalID = @PortalID
and archived= 0
and (ShipMethodID = @ShipMethodID or @ShipMethodID = -1)
order by PL.ProductName,sm.listorder,sm.modelref,SML.ModelName
end
else
begin
select
isnull(SR.ItemId,-1) as Itemid,
isnull(SR.Range1,0) as Range1,
isnull(SR.Range2,0) as Range2,
SM.ModelID as ObjectId,
isnull(SR.ShipCost,0) as ShipCost,
'PRD' as ShipType,
SR.[Disable],
PL.ProductName + ' - ' + sm.modelref + ' - ' + SML.ModelName as Description,
isnull(SR.ProductWeight,0) as ProductWeight,
isnull(SR.ProductHeight,0) as ProductHeight,
isnull(SR.ProductLength,0) as ProductLength,
isnull(SR.ProductWidth,0) as ProductWidth
from {databaseOwner}{objectQualifier}NB_Store_Model AS SM
left outer join {databaseOwner}[{objectQualifier}NB_Store_ShippingRates] as SR on SM.ModelID = SR.ObjectID and SR.ShipType = 'PRD'
inner join {databaseOwner}{objectQualifier}NB_Store_ModelLang AS SML on SML.ModelID = SM.ModelID and SML.Lang = @Lang
inner join {databaseOwner}[{objectQualifier}NB_Store_Products] as P on P.ProductID = SM.ProductID
inner join {databaseOwner}{objectQualifier}NB_Store_ProductCategory as PC on PC.ProductID = P.ProductID
left outer join {databaseOwner}[{objectQualifier}NB_Store_ProductLang] as PL on PL.ProductID = SM.ProductID and PL.Lang = @Lang
where (PL.ProductName like '%' + @Filter + '%' or SML.ModelName like '%' + @Filter + '%' or sm.modelref like '%' + @Filter + '%')
and P.PortalID = @PortalID
and PC.CategoryID = @CategoryID
and archived= 0
and (ShipMethodID = @ShipMethodID or @ShipMethodID = -1)
order by PL.ProductName,sm.listorder,sm.modelref,SML.ModelName
end
end
else
begin
if @ShipType=''
begin
select ItemId,
isnull(Range1,0) as Range1,
isnull(Range2,0) as Range2,
ObjectId,
isnull(ShipCost,0) as ShipCost,
ShipType,
[Disable],
Description,
isnull(ProductWeight,0) as ProductWeight,
isnull(ProductHeight,0) as ProductHeight,
isnull(ProductLength,0) as ProductLength,
isnull(ProductWidth,0) as ProductWidth,
PortalID
from {databaseOwner}[{objectQualifier}NB_Store_ShippingRates]
where PortalID = @PortalID
and ShipMethodID = @ShipMethodID
order by Range1
end
else
begin
select ItemId,
isnull(Range1,0) as Range1,
isnull(Range2,0) as Range2,
ObjectId,
isnull(ShipCost,0) as ShipCost,
ShipType,
[Disable],
Description,
isnull(ProductWeight,0) as ProductWeight,
isnull(ProductHeight,0) as ProductHeight,
isnull(ProductLength,0) as ProductLength,
isnull(ProductWidth,0) as ProductWidth,
PortalID
from {databaseOwner}[{objectQualifier}NB_Store_ShippingRates]
where ShipType = @ShipType
and PortalID = @PortalID
and ShipMethodID = @ShipMethodID
order by Range1
end
end
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
/************************************************************/
/***** Fix Multiple Models Bug. Issue:4359 *****/
/************************************************************/
delete
from {databaseOwner}[{objectQualifier}NB_Store_ShippingRates]
where shiptype = 'PRD'
and shipMethodID != - 1