Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

775 lines
22 KiB

  1. /****** Object: Stored Procedure dbo.SEP_GetDeliveryTypeBySolutionType Script Date: 8/15/2002 03:39:27 PM ******/
  2. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetDeliveryTypeBySolutionType]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  3. drop procedure [dbo].[SEP_GetDeliveryTypeBySolutionType]
  4. GO
  5. /****** Object: Stored Procedure dbo.SEP_GetProductData Script Date: 8/15/2002 03:39:27 PM ******/
  6. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetProductData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  7. drop procedure [dbo].[SEP_GetProductData]
  8. GO
  9. /****** Object: Stored Procedure dbo.SEP_GetSolutionBySolutionID Script Date: 8/15/2002 03:39:27 PM ******/
  10. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetSolutionBySolutionID]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  11. drop procedure [dbo].[SEP_GetSolutionBySolutionID]
  12. GO
  13. /****** Object: Stored Procedure dbo.SEP_GetSolutionData Script Date: 8/15/2002 03:39:27 PM ******/
  14. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetSolutionData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  15. drop procedure [dbo].[SEP_GetSolutionData]
  16. GO
  17. /****** Object: Stored Procedure dbo.SEP_GetSolutionIDs Script Date: 8/15/2002 03:39:27 PM ******/
  18. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetSolutionIDs]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  19. drop procedure [dbo].[SEP_GetSolutionIDs]
  20. GO
  21. /****** Object: Stored Procedure dbo.SEP_GetSolutionTypes Script Date: 8/15/2002 03:39:27 PM ******/
  22. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetSolutionTypes]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  23. drop procedure [dbo].[SEP_GetSolutionTypes]
  24. GO
  25. /****** Object: Stored Procedure dbo.SEP_GetTemplateData Script Date: 8/15/2002 03:39:27 PM ******/
  26. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetTemplateData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  27. drop procedure [dbo].[SEP_GetTemplateData]
  28. GO
  29. /****** Object: Stored Procedure dbo.SEP_GetTemplates Script Date: 8/15/2002 03:39:27 PM ******/
  30. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetTemplates]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  31. drop procedure [dbo].[SEP_GetTemplates]
  32. GO
  33. /****** Object: Stored Procedure dbo.SEP_SetContact Script Date: 8/15/2002 03:39:27 PM ******/
  34. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_SetContact]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  35. drop procedure [dbo].[SEP_SetContact]
  36. GO
  37. /****** Object: Stored Procedure dbo.SEP_SetModuleData Script Date: 8/15/2002 03:39:27 PM ******/
  38. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_SetModuleData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  39. drop procedure [dbo].[SEP_SetModuleData]
  40. GO
  41. /****** Object: Stored Procedure dbo.SEP_SetProductData Script Date: 8/15/2002 03:39:27 PM ******/
  42. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_SetProductData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  43. drop procedure [dbo].[SEP_SetProductData]
  44. GO
  45. /****** Object: Stored Procedure dbo.SEP_SetSolutionData Script Date: 8/15/2002 03:39:27 PM ******/
  46. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_SetSolutionData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  47. drop procedure [dbo].[SEP_SetSolutionData]
  48. GO
  49. /****** Object: Stored Procedure dbo.SEP_SetTemplateData Script Date: 8/15/2002 03:39:27 PM ******/
  50. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_SetTemplateData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  51. drop procedure [dbo].[SEP_SetTemplateData]
  52. GO
  53. /****** Object: Stored Procedure dbo.SEP_GetContact Script Date: 8/15/2002 03:39:27 PM ******/
  54. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetContact]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  55. drop procedure [dbo].[SEP_GetContact]
  56. GO
  57. /****** Object: Stored Procedure dbo.SEP_GetContacts Script Date: 8/15/2002 03:39:27 PM ******/
  58. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetContacts]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  59. drop procedure [dbo].[SEP_GetContacts]
  60. GO
  61. /****** Object: Stored Procedure dbo.SEP_GetModuleData Script Date: 8/15/2002 03:39:27 PM ******/
  62. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetModuleData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  63. drop procedure [dbo].[SEP_GetModuleData]
  64. GO
  65. /****** Object: Stored Procedure dbo.SEP_GetModules Script Date: 8/15/2002 03:39:27 PM ******/
  66. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetModules]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  67. drop procedure [dbo].[SEP_GetModules]
  68. GO
  69. /****** Object: Stored Procedure dbo.SEP_GetProducts Script Date: 8/15/2002 03:39:27 PM ******/
  70. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SEP_GetProducts]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
  71. drop procedure [dbo].[SEP_GetProducts]
  72. GO
  73. /****** Object: Table [dbo].[Contacts] Script Date: 8/15/2002 03:39:27 PM ******/
  74. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Contacts]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  75. drop table [dbo].[Contacts]
  76. GO
  77. /****** Object: Table [dbo].[DeliveryTypeMap] Script Date: 8/15/2002 03:39:27 PM ******/
  78. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DeliveryTypeMap]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  79. drop table [dbo].[DeliveryTypeMap]
  80. GO
  81. /****** Object: Table [dbo].[DeliveryTypes] Script Date: 8/15/2002 03:39:27 PM ******/
  82. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DeliveryTypes]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  83. drop table [dbo].[DeliveryTypes]
  84. GO
  85. /****** Object: Table [dbo].[Modules] Script Date: 8/15/2002 03:39:27 PM ******/
  86. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Modules]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  87. drop table [dbo].[Modules]
  88. GO
  89. /****** Object: Table [dbo].[Products] Script Date: 8/15/2002 03:39:27 PM ******/
  90. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Products]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  91. drop table [dbo].[Products]
  92. GO
  93. /****** Object: Table [dbo].[SolutionEx] Script Date: 8/15/2002 03:39:27 PM ******/
  94. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SolutionEx]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  95. drop table [dbo].[SolutionEx]
  96. GO
  97. /****** Object: Table [dbo].[SolutionTypes] Script Date: 8/15/2002 03:39:27 PM ******/
  98. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SolutionTypes]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  99. drop table [dbo].[SolutionTypes]
  100. GO
  101. /****** Object: Table [dbo].[Templates] Script Date: 8/15/2002 03:39:27 PM ******/
  102. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Templates]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
  103. drop table [dbo].[Templates]
  104. GO
  105. /****** Object: Table [dbo].[Contacts] Script Date: 8/15/2002 03:39:28 PM ******/
  106. CREATE TABLE [dbo].[Contacts] (
  107. [ContactID] [int] IDENTITY (1, 1) NOT NULL ,
  108. [CompanyName] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  109. [CompanyAddress1] [nvarchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  110. [CompanyAddress2] [nvarchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  111. [CompanyCity] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  112. [CompanyState] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  113. [CompanyZip] [nvarchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  114. [CompanyMainPhone] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  115. [CompanySupportPhone] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  116. [CompanyFax] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  117. [CompanyWebSite] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  118. [ContactName] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  119. [ContactOccupation] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  120. [ContactAddress1] [nvarchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  121. [ContactAddress2] [nvarchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  122. [ContactCity] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  123. [ContactState] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  124. [ContactZip] [nvarchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  125. [ContactPhone] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  126. [ContactEMail] [nvarchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  127. ) ON [PRIMARY]
  128. GO
  129. /****** Object: Table [dbo].[DeliveryTypeMap] Script Date: 8/15/2002 03:39:28 PM ******/
  130. CREATE TABLE [dbo].[DeliveryTypeMap] (
  131. [MapID] [int] NOT NULL ,
  132. [SolutionTypeID] [int] NOT NULL ,
  133. [DeliveryTypeID] [int] NOT NULL
  134. ) ON [PRIMARY]
  135. GO
  136. /****** Object: Table [dbo].[DeliveryTypes] Script Date: 8/15/2002 03:39:28 PM ******/
  137. CREATE TABLE [dbo].[DeliveryTypes] (
  138. [DeliveryID] [int] NOT NULL ,
  139. [DeliveryType] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  140. ) ON [PRIMARY]
  141. GO
  142. /****** Object: Table [dbo].[Modules] Script Date: 8/15/2002 03:39:28 PM ******/
  143. CREATE TABLE [dbo].[Modules] (
  144. [ModuleID] [int] IDENTITY (1, 1) NOT NULL ,
  145. [ModuleName] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  146. ) ON [PRIMARY]
  147. GO
  148. /****** Object: Table [dbo].[Products] Script Date: 8/15/2002 03:39:28 PM ******/
  149. CREATE TABLE [dbo].[Products] (
  150. [ProductID] [int] IDENTITY (1, 1) NOT NULL ,
  151. [ProductName] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  152. ) ON [PRIMARY]
  153. GO
  154. /****** Object: Table [dbo].[SolutionEx] Script Date: 8/15/2002 03:39:29 PM ******/
  155. CREATE TABLE [dbo].[SolutionEx] (
  156. [SolutionType] [tinyint] NULL ,
  157. [DeliveryType] [tinyint] NULL ,
  158. [SP] [tinyint] NULL ,
  159. [CrashType] [tinyint] NULL ,
  160. [SolutionID] [int] NOT NULL ,
  161. [TemplateID] [int] NULL ,
  162. [ProductID] [int] NULL ,
  163. [ContactID] [int] NULL ,
  164. [ModuleID] [int] NULL ,
  165. [BugID] [nvarchar] (8) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  166. [QueryData] [nvarchar] (1024) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  167. [Description] [nvarchar] (1024) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  168. ) ON [PRIMARY]
  169. GO
  170. /****** Object: Table [dbo].[SolutionTypes] Script Date: 8/15/2002 03:39:29 PM ******/
  171. CREATE TABLE [dbo].[SolutionTypes] (
  172. [SolutionTypeID] [int] NOT NULL ,
  173. [SolutionTypeName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  174. ) ON [PRIMARY]
  175. GO
  176. /****** Object: Table [dbo].[Templates] Script Date: 8/15/2002 03:39:29 PM ******/
  177. CREATE TABLE [dbo].[Templates] (
  178. [TemplateID] [int] NOT NULL ,
  179. [Lang] [varchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
  180. [Description] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  181. [TemplateName] [nvarchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
  182. ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
  183. GO
  184. SET QUOTED_IDENTIFIER OFF
  185. GO
  186. SET ANSI_NULLS OFF
  187. GO
  188. /****** Object: Stored Procedure dbo.SEP_GetContact Script Date: 8/15/2002 03:39:29 PM ******/
  189. CREATE PROCEDURE SEP_GetContact(
  190. @ContactID int
  191. )
  192. AS
  193. SELECT * FROM Contacts WHERE ContactID = @ContactID
  194. GO
  195. SET QUOTED_IDENTIFIER OFF
  196. GO
  197. SET ANSI_NULLS ON
  198. GO
  199. SET QUOTED_IDENTIFIER ON
  200. GO
  201. SET ANSI_NULLS ON
  202. GO
  203. /****** Object: Stored Procedure dbo.SEP_GetContacts Script Date: 8/15/2002 03:39:29 PM ******/
  204. CREATE PROCEDURE SEP_GetContacts
  205. AS
  206. SELECT ContactID, CompanyName FROM Contacts ORDER BY CompanyName
  207. GO
  208. SET QUOTED_IDENTIFIER OFF
  209. GO
  210. SET ANSI_NULLS ON
  211. GO
  212. SET QUOTED_IDENTIFIER ON
  213. GO
  214. SET ANSI_NULLS OFF
  215. GO
  216. /****** Object: Stored Procedure dbo.SEP_GetModuleData Script Date: 8/15/2002 03:39:29 PM ******/
  217. CREATE PROCEDURE SEP_GetModuleData (
  218. @ModuleID int
  219. ) AS
  220. SELECT ModuleName FROM Modules WHERE ModuleID = @ModuleID
  221. GO
  222. SET QUOTED_IDENTIFIER OFF
  223. GO
  224. SET ANSI_NULLS ON
  225. GO
  226. SET QUOTED_IDENTIFIER ON
  227. GO
  228. SET ANSI_NULLS ON
  229. GO
  230. /****** Object: Stored Procedure dbo.SEP_GetModules Script Date: 8/15/2002 03:39:29 PM ******/
  231. CREATE PROCEDURE SEP_GetModules
  232. AS
  233. SELECT ModuleID, ModuleName FROM Modules ORDER BY ModuleName
  234. GO
  235. SET QUOTED_IDENTIFIER OFF
  236. GO
  237. SET ANSI_NULLS ON
  238. GO
  239. SET QUOTED_IDENTIFIER ON
  240. GO
  241. SET ANSI_NULLS ON
  242. GO
  243. /****** Object: Stored Procedure dbo.SEP_GetProducts Script Date: 8/15/2002 03:39:29 PM ******/
  244. CREATE PROCEDURE SEP_GetProducts
  245. AS
  246. SELECT ProductID, ProductName FROM Products ORDER BY ProductName
  247. GO
  248. SET QUOTED_IDENTIFIER OFF
  249. GO
  250. SET ANSI_NULLS ON
  251. GO
  252. SET QUOTED_IDENTIFIER ON
  253. GO
  254. SET ANSI_NULLS OFF
  255. GO
  256. /****** Object: Stored Procedure dbo.SEP_GetDeliveryTypeBySolutionType Script Date: 8/15/2002 03:39:29 PM ******/
  257. CREATE PROCEDURE SEP_GetDeliveryTypeBySolutionType (
  258. @SolutionTypeID int
  259. ) AS
  260. SELECT DeliveryTypeID, DeliveryType FROM DeliveryTypeMap as M
  261. inner join DeliveryTypes as D on D.DeliveryID = M.DeliveryTypeID
  262. WHERE SolutionTypeID = @SolutionTypeID
  263. GO
  264. SET QUOTED_IDENTIFIER OFF
  265. GO
  266. SET ANSI_NULLS ON
  267. GO
  268. SET QUOTED_IDENTIFIER ON
  269. GO
  270. SET ANSI_NULLS OFF
  271. GO
  272. /****** Object: Stored Procedure dbo.SEP_GetProductData Script Date: 8/15/2002 03:39:29 PM ******/
  273. CREATE PROCEDURE SEP_GetProductData (
  274. @ProductID int
  275. ) AS
  276. SELECT ProductName FROM Products WHERE ProductID = @ProductID order by productName
  277. GO
  278. SET QUOTED_IDENTIFIER OFF
  279. GO
  280. SET ANSI_NULLS ON
  281. GO
  282. SET QUOTED_IDENTIFIER OFF
  283. GO
  284. SET ANSI_NULLS OFF
  285. GO
  286. /****** Object: Stored Procedure dbo.SEP_GetSolutionBySolutionID Script Date: 8/15/2002 03:39:29 PM ******/
  287. CREATE PROCEDURE SEP_GetSolutionBySolutionID(
  288. @SolutionID int
  289. ) AS
  290. SELECT * from SolutionEx where SolutionID = @SolutionID
  291. GO
  292. SET QUOTED_IDENTIFIER OFF
  293. GO
  294. SET ANSI_NULLS ON
  295. GO
  296. SET QUOTED_IDENTIFIER ON
  297. GO
  298. SET ANSI_NULLS OFF
  299. GO
  300. /****** Object: Stored Procedure dbo.SEP_GetSolutionData Script Date: 8/15/2002 03:39:29 PM ******/
  301. CREATE PROCEDURE SEP_GetSolutionData(
  302. @TemplateID int,
  303. @ContactID int,
  304. @ProductID int,
  305. @ModuleID int,
  306. @Language nvarchar(4) = 'en'
  307. ) AS
  308. IF ( @Language <> 'en' )
  309. BEGIN
  310. IF NOT EXISTS (
  311. SELECT * FROM Templates where TemplateID = @TemplateID and Lang = @Language
  312. )
  313. SET @Language = 'en'
  314. END
  315. select
  316. (select ProductName from Products where ProductID=@ProductID) as ProductName ,
  317. (Select ModuleName from Modules where ModuleID = @ModuleID) as ModuleName,
  318. (Select CompanyName from Contacts where ContactID = @ContactID) as CompanyName,
  319. (Select CompanyMainPhone from Contacts where ContactID = @ContactID) as CompanyMainPhone,
  320. (Select CompanyWebSite from Contacts where ContactID = @ContactID) as CompanyWebsite,
  321. [Description]
  322. from Templates
  323. where TemplateID = @TemplateID and Lang=@Language
  324. GO
  325. SET QUOTED_IDENTIFIER OFF
  326. GO
  327. SET ANSI_NULLS ON
  328. GO
  329. SET QUOTED_IDENTIFIER OFF
  330. GO
  331. SET ANSI_NULLS OFF
  332. GO
  333. /****** Object: Stored Procedure dbo.SEP_GetSolutionIDs Script Date: 8/15/2002 03:39:29 PM ******/
  334. CREATE PROCEDURE SEP_GetSolutionIDs
  335. AS
  336. SELECT SolutionID, SolutionID FROM SolutionEx ORDER BY SolutionID
  337. GO
  338. SET QUOTED_IDENTIFIER OFF
  339. GO
  340. SET ANSI_NULLS ON
  341. GO
  342. SET QUOTED_IDENTIFIER OFF
  343. GO
  344. SET ANSI_NULLS OFF
  345. GO
  346. /****** Object: Stored Procedure dbo.SEP_GetSolutionTypes Script Date: 8/15/2002 03:39:29 PM ******/
  347. CREATE PROCEDURE SEP_GetSolutionTypes
  348. AS
  349. SELECT SolutionTypeID, SolutionTypeName FROM SolutionTypes ORDER BY SolutionTypeID
  350. GO
  351. SET QUOTED_IDENTIFIER OFF
  352. GO
  353. SET ANSI_NULLS ON
  354. GO
  355. SET QUOTED_IDENTIFIER OFF
  356. GO
  357. SET ANSI_NULLS OFF
  358. GO
  359. /****** Object: Stored Procedure dbo.SEP_GetTemplateData Script Date: 8/15/2002 03:39:29 PM ******/
  360. CREATE PROCEDURE SEP_GetTemplateData (
  361. @TemplateID int
  362. ) AS
  363. SELECT Lang, TemplateName, [Description] FROM Templates WHERE TemplateID = @TemplateID
  364. GO
  365. SET QUOTED_IDENTIFIER OFF
  366. GO
  367. SET ANSI_NULLS ON
  368. GO
  369. SET QUOTED_IDENTIFIER OFF
  370. GO
  371. SET ANSI_NULLS OFF
  372. GO
  373. /****** Object: Stored Procedure dbo.SEP_GetTemplates Script Date: 8/15/2002 03:39:29 PM ******/
  374. CREATE PROCEDURE SEP_GetTemplates
  375. AS
  376. SELECT TemplateID, TemplateName FROM Templates where lang='en' ORDER BY TemplateName
  377. GO
  378. SET QUOTED_IDENTIFIER OFF
  379. GO
  380. SET ANSI_NULLS ON
  381. GO
  382. SET QUOTED_IDENTIFIER ON
  383. GO
  384. SET ANSI_NULLS OFF
  385. GO
  386. /****** Object: Stored Procedure dbo.SEP_SetContact Script Date: 8/15/2002 03:39:29 PM ******/
  387. CREATE PROCEDURE SEP_SetContact (
  388. @ContactID int,
  389. @CompanyName nvarchar(128),
  390. @CompanyAddress1 nvarchar(64),
  391. @CompanyAddress2 nvarchar(64),
  392. @CompanyCity nvarchar(16),
  393. @CompanyState nvarchar(4),
  394. @CompanyZip nvarchar(16),
  395. @CompanyMainPhone nvarchar(16),
  396. @CompanySupportPhone nvarchar(16),
  397. @CompanyFax nvarchar(16),
  398. @CompanyWebSite nvarchar(128),
  399. @ContactName nvarchar(32),
  400. @ContactOccupation nvarchar(32),
  401. @ContactAddress1 nvarchar(64),
  402. @ContactAddress2 nvarchar(64),
  403. @ContactCity nvarchar(16),
  404. @ContactState nvarchar(4),
  405. @ContactZip nvarchar(16),
  406. @ContactPhone nvarchar(16),
  407. @ContactEMail nvarchar(64)
  408. ) AS
  409. IF EXISTS(SELECT * FROM Contacts WHERE ContactID = @ContactID)
  410. BEGIN
  411. UPDATE Contacts SET
  412. CompanyName = @CompanyName,
  413. CompanyAddress1 = @CompanyAddress1,
  414. CompanyAddress2 = @CompanyAddress2,
  415. CompanyCity = @CompanyCity,
  416. CompanyState = @CompanyState,
  417. CompanyZip = @CompanyZip,
  418. CompanyMainPhone = @CompanyMainPhone,
  419. CompanySupportPhone = @CompanySupportPhone,
  420. CompanyFax = @CompanyFax,
  421. CompanyWebSite = @CompanyWebSite,
  422. ContactName = @ContactName,
  423. ContactOccupation = @ContactOccupation,
  424. ContactAddress1 = @contactAddress1,
  425. ContactAddress2 = @ContactAddress2,
  426. ContactCity = @ContactCity,
  427. ContactState = @ContactState,
  428. ContactZip = @ContactZip,
  429. ContactPhone = @ContactPhone,
  430. ContactEMail = @ContactEMail
  431. WHERE
  432. ContactID = @ContactID
  433. SELECT @ContactID as ContactID
  434. END
  435. ELSE
  436. BEGIN
  437. INSERT INTO Contacts
  438. (CompanyName, CompanyAddress1, CompanyAddress2, CompanyCity, CompanyState, CompanyZip,
  439. CompanyMainPhone, CompanySupportPhone, CompanyFax, CompanyWebSite,
  440. ContactName, ContactOccupation, ContactAddress1, ContactAddress2, ContactCity, ContactState, ContactZip,
  441. ContactPhone, ContactEMail)
  442. VALUES
  443. (@CompanyName, @CompanyAddress1, @CompanyAddress2, @CompanyCity, @CompanyState, @CompanyZip,
  444. @CompanyMainPhone, @CompanySupportPhone, @CompanyFax, @CompanyWebSite,
  445. @ContactName, @ContactOccupation, @ContactAddress1, @ContactAddress2, @ContactCity, @ContactState, @ContactZip,
  446. @ContactPhone, @ContactEMail)
  447. SELECT @@Identity as ContactID
  448. END
  449. GO
  450. SET QUOTED_IDENTIFIER OFF
  451. GO
  452. SET ANSI_NULLS ON
  453. GO
  454. SET QUOTED_IDENTIFIER ON
  455. GO
  456. SET ANSI_NULLS OFF
  457. GO
  458. /****** Object: Stored Procedure dbo.SEP_SetModuleData Script Date: 8/15/2002 03:39:29 PM ******/
  459. CREATE PROCEDURE SEP_SetModuleData (
  460. @ModuleID int,
  461. @ModuleName nvarchar(128)
  462. ) AS
  463. IF EXISTS (SELECT * FROM Modules WHERE ModuleID = @ModuleID)
  464. BEGIN
  465. UPDATE Modules SET
  466. ModuleName = @ModuleName
  467. WHERE
  468. ModuleID = @ModuleID
  469. SELECT @ModuleID as ModuleID
  470. END
  471. ELSE
  472. BEGIN
  473. INSERT INTO Modules
  474. (ModuleName)
  475. VALUES
  476. (@ModuleName)
  477. SELECT @@IDENTITY AS ModuleID
  478. END
  479. GO
  480. SET QUOTED_IDENTIFIER OFF
  481. GO
  482. SET ANSI_NULLS ON
  483. GO
  484. SET QUOTED_IDENTIFIER ON
  485. GO
  486. SET ANSI_NULLS OFF
  487. GO
  488. /****** Object: Stored Procedure dbo.SEP_SetProductData Script Date: 8/15/2002 03:39:29 PM ******/
  489. CREATE PROCEDURE SEP_SetProductData (
  490. @ProductID int,
  491. @ProductName nvarchar(128)
  492. ) AS
  493. IF EXISTS (SELECT * FROM Products WHERE ProductID = @ProductID)
  494. BEGIN
  495. UPDATE Products SET
  496. ProductName = @ProductName
  497. WHERE
  498. ProductID = @ProductID
  499. SELECT @ProductID as ProductID
  500. END
  501. ELSE
  502. BEGIN
  503. INSERT INTO Products
  504. (ProductName)
  505. VALUES
  506. (@ProductName)
  507. SELECT @@IDENTITY AS ProductID
  508. END
  509. GO
  510. SET QUOTED_IDENTIFIER OFF
  511. GO
  512. SET ANSI_NULLS ON
  513. GO
  514. SET QUOTED_IDENTIFIER OFF
  515. GO
  516. SET ANSI_NULLS OFF
  517. GO
  518. /****** Object: Stored Procedure dbo.SEP_SetSolutionData Script Date: 8/15/2002 03:39:29 PM ******/
  519. CREATE PROCEDURE SEP_SetSolutionData(
  520. @SolutionID int,
  521. @SolutionType tinyint,
  522. @DeliveryType tinyint,
  523. @SP tinyint = 0,
  524. @TemplateID int,
  525. @ProductID int,
  526. @Description nvarchar(1024),
  527. @ContactID int,
  528. @ModuleID int,
  529. @UserMode tinyint = 0
  530. ) AS
  531. IF ( @SolutionID = 0 )
  532. SELECT @SolutionID = MAX(SolutionID) + 1 FROM SolutionEX
  533. IF EXISTS (SELECT * FROM SolutionEx WHERE SolutionID = @SolutionID)
  534. UPDATE SolutionEx SET
  535. SolutionType = @SolutionType,
  536. DeliveryType = @DeliveryType,
  537. SP = @SP,
  538. TemplateID = @TemplateID,
  539. ProductID = @ProductID,
  540. [Description] = @Description,
  541. ContactID = @ContactID,
  542. ModuleID = @ModuleID
  543. WHERE
  544. SolutionID = @SolutionID
  545. ELSE
  546. INSERT INTO SolutionEx
  547. (SolutionID, SolutionType, DeliveryType, SP, TemplateID, ProductID, [Description], ContactID, ModuleID )
  548. VALUES
  549. (@SolutionID, @SolutionType, @DeliveryType, @SP, @TemplateID, @ProductID, @Description, @ContactID, @ModuleID )
  550. SELECT @SolutionID as SolutionID
  551. GO
  552. SET QUOTED_IDENTIFIER OFF
  553. GO
  554. SET ANSI_NULLS ON
  555. GO
  556. SET QUOTED_IDENTIFIER OFF
  557. GO
  558. SET ANSI_NULLS OFF
  559. GO
  560. /****** Object: Stored Procedure dbo.SEP_SetTemplateData Script Date: 8/15/2002 03:39:29 PM ******/
  561. CREATE PROCEDURE SEP_SetTemplateData (
  562. @TemplateID int,
  563. @TemplateName nvarchar(32),
  564. @Description ntext,
  565. @Lang varchar(5) = 'en'
  566. ) AS
  567. DECLARE @NewID int
  568. IF EXISTS (SELECT * FROM Templates WHERE TemplateID = @TemplateID )
  569. BEGIN
  570. IF EXISTS( SELECT * FROM Templates where TemplateID = @TemplateID and Lang = @Lang )
  571. UPDATE Templates SET
  572. TemplateName = @TemplateName,
  573. Description = @Description
  574. WHERE
  575. TemplateID = @TemplateID and Lang = @Lang
  576. ELSE
  577. INSERT INTO Templates
  578. (TemplateName, Description, Lang, TemplateID )
  579. VALUES
  580. (@TemplateName, @Description, @Lang, @TemplateID )
  581. END
  582. ELSE
  583. BEGIN
  584. SELECT @NewID = MAX(TemplateID)+1 from Templates
  585. INSERT INTO Templates
  586. (TemplateName, Description, Lang, TemplateID )
  587. VALUES
  588. (@TemplateName, @Description, @Lang, @NewID )
  589. SELECT @NewID as TemplateID
  590. END
  591. GO
  592. SET QUOTED_IDENTIFIER OFF
  593. GO
  594. SET ANSI_NULLS ON
  595. GO