CREATE DATABASE BalloonShop
GO
USE BalloonShop
GO
CREATE TABLE Department(
DepartmentID INT IDENTITY(1,1) NOT NULL,
Name VARCHAR(50) NOT NULL,
Description VARCHAR(1000) NULL,
CONSTRAINT PK_Department PRIMARY KEY CLUSTERED (DepartmentID ASC)
)
GO
CREATE PROCEDURE GetDepartments AS
SELECT DepartmentID, Name, Description
FROM Department
GO
INSERT INTO Department(Name, Description)
VALUES ('Anniversary Balloons', 'These sweet balloons are the perfect gift for someone you love.')
GO
INSERT INTO Department(Name, Description )
VALUES ('Balloons for Children', 'The colorful and funny balloons will make any child smile!')
GO
CREATE TABLE Category(
CategoryID INT IDENTITY(1,1) NOT NULL,
DepartmentID INT NOT NULL,
Name VARCHAR(50) NOT NULL,
Description VARCHAR(1000) NULL,
CONSTRAINT PK_Category_1 PRIMARY KEY CLUSTERED(CategoryID ASC)
)
GO
ALTER TABLE Category ADD CONSTRAINT FK_Category_Department FOREIGN KEY(DepartmentID)
REFERENCES Department (DepartmentID)
GO
CREATE TABLE Product(
ProductID INT IDENTITY(1,1) NOT NULL,
Name VARCHAR(50) NOT NULL,
Description VARCHAR(5000) NOT NULL,
Price MONEY NOT NULL,
Image1FileName VARCHAR(50) NULL,
Image2FileName VARCHAR(50) NULL,
OnCatalogPromotion BIT NOT NULL,
OnDepartmentPromotion BIT NOT NULL,
CONSTRAINT PK_Product PRIMARY KEY CLUSTERED (ProductID ASC)
)
GO
CREATE TABLE ProductCategory(
ProductID INT NOT NULL,
CategoryID INT NOT NULL,
CONSTRAINT PK_ProductCategory PRIMARY KEY CLUSTERED (ProductID ASC, CategoryID ASC)
)
GO
ALTER TABLE ProductCategory WITH CHECK ADD CONSTRAINT FK_ProductCategory_Category FOREIGN KEY(CategoryID)
REFERENCES Category (CategoryID)
GO
ALTER TABLE ProductCategory WITH CHECK ADD CONSTRAINT FK_ProductCategory_Product FOREIGN KEY(ProductID)
REFERENCES Product (ProductID)
GO
CREATE PROCEDURE GetCategoriesInDepartment
(@DepartmentID INT)
AS
SELECT CategoryID, Name, Description
FROM Category
WHERE DepartmentID = @DepartmentID
GO
CREATE PROCEDURE GetDepartmentDetails
(@DepartmentID INT)
AS
SELECT Name, Description
FROM Department
WHERE DepartmentID = @DepartmentID
GO
CREATE PROCEDURE GetCategoryDetails
(@CategoryID INT)
AS
SELECT DepartmentID, Name, Description
FROM Category
WHERE CategoryID = @CategoryID
GO
CREATE PROCEDURE GetProductsOnDepartmentPromotion
(@DepartmentID INT,
@DescriptionLength INT,
@PageNumber INT,
@ProductsPerPage INT,
@HowManyProducts INT OUTPUT)
AS
-- declare a new TABLE variable
DECLARE @Products TABLE
(RowNumber INT,
ProductID INT,
Name VARCHAR(50),
Description VARCHAR(5000),
Price MONEY,
Image1FileName VARCHAR(50),
Image2FileName VARCHAR(50),
OnDepartmentPromotion BIT,
OnCatalogPromotion BIT)
-- populate the table variable with the complete list of products
INSERT INTO @Products
SELECT ROW_NUMBER() OVER (ORDER BY ProductID) AS Row,
ProductID, Name, SUBSTRING(Description, 1, @DescriptionLength) + '...' AS Description,
Price, Image1FileName, Image2FileName, OnDepartmentPromotion, OnCatalogPromotion
FROM
(SELECT DISTINCT Product.ProductID, Product.Name,
SUBSTRING(Product.Description, 1, @DescriptionLength) + '...' AS Description,
Price, Image1FileName, Image2FileName, OnDepartmentPromotion, OnCatalogPromotion
FROM Product INNER JOIN ProductCategory
ON Product.ProductID = ProductCategory.ProductID
INNER JOIN Category
ON ProductCategory.CategoryID = Category.CategoryID
WHERE Product.OnDepartmentPromotion = 1
AND Category.DepartmentID = @DepartmentID
) AS ProductOnDepPr
-- return the total number of products using an OUTPUT variable
SELECT @HowManyProducts = COUNT(ProductID) FROM @Products
-- extract the requested page of products
SELECT ProductID, Name, Description, Price, Image1FileName,
Image2FileName, OnDepartmentPromotion, OnCatalogPromotion
FROM @Products
WHERE RowNumber > (@PageNumber - 1) * @ProductsPerPage
AND RowNumber <= @PageNumber * @ProductsPerPage
GO
CREATE PROCEDURE GetProductsOnCatalogPromotion
(@DescriptionLength INT,
@PageNumber INT,
@ProductsPerPage INT,
@HowManyProducts INT OUTPUT)
AS
-- declare a new TABLE variable
DECLARE @Products TABLE
(RowNumber INT,
ProductID INT,
Name VARCHAR(50),
Description VARCHAR(5000),
Price MONEY,
Image1FileName VARCHAR(50),
Image2FileName VARCHAR(50),
OnDepartmentPromotion BIT,
OnCatalogPromotion BIT)
-- populate the table variable with the complete list of products
INSERT INTO @Products
SELECT ROW_NUMBER() OVER (ORDER BY Product.ProductID),
ProductID, Name,
SUBSTRING(Description, 1, @DescriptionLength) + '...' AS Description,
Price, Image1FileName, Image2FileName, OnDepartmentPromotion, OnCatalogPromotion
FROM Product
WHERE OnCatalogPromotion = 1
-- return the total number of products using an OUTPUT variable
SELECT @HowManyProducts = COUNT(ProductID) FROM @Products
-- extract the requested page of products
SELECT ProductID, Name, Description, Price, Image1FileName,
Image2FileName, OnDepartmentPromotion, OnCatalogPromotion
FROM @Products
WHERE RowNumber > (@PageNumber - 1) * @ProductsPerPage
AND RowNumber <= @PageNumber * @ProductsPerPage
GO
CREATE PROCEDURE GetProductsInCategory
(@CategoryID INT,
@DescriptionLength INT,
@PageNumber INT,
@ProductsPerPage INT,
@HowManyProducts INT OUTPUT)
AS
-- declare a new TABLE variable
DECLARE @Products TABLE
(RowNumber INT,
ProductID INT,
Name VARCHAR(50),
Description VARCHAR(5000),
Price MONEY,
Image1FileName VARCHAR(50),
Image2FileName VARCHAR(50),
OnDepartmentPromotion BIT,
OnCatalogPromotion BIT)
-- populate the table variable with the complete list of products
INSERT INTO @Products
SELECT ROW_NUMBER() OVER (ORDER BY Product.ProductID),
Product.ProductID, Name,
SUBSTRING(Description, 1, @DescriptionLength) + '...' AS Description,
Price, Image1FileName, Image2FileName, OnDepartmentPromotion, OnCatalogPromotion
FROM Product INNER JOIN ProductCategory
ON Product.ProductID = ProductCategory.ProductID
WHERE ProductCategory.CategoryID = @CategoryID
-- return the total number of products using an OUTPUT variable
SELECT @HowManyProducts = COUNT(ProductID) FROM @Products
-- extract the requested page of products
SELECT ProductID, Name, Description, Price, Image1FileName,
Image2FileName, OnDepartmentPromotion, OnCatalogPromotion
FROM @Products
WHERE RowNumber > (@PageNumber - 1) * @ProductsPerPage
AND RowNumber <= @PageNumber * @ProductsPerPage
GO
CREATE PROCEDURE GetProductDetails
(@ProductID INT)
AS
SELECT Name, Description, Price, Image1FileName, Image2FileName, OnDepartmentPromotion, OnCatalogPromotion
FROM Product
WHERE ProductID = @ProductID
RETURN
GO
INSERT INTO Category (DepartmentID, Name, Description )
VALUES (1, 'Love & Romance', 'Here''s our collection of balloons with romantic messages.')
GO
INSERT INTO Category (DepartmentID, Name, Description )
VALUES (1, 'Birthdays', 'Tell someone "Happy Birthday" with one of these wonderful balloons!')
GO
INSERT INTO Category (DepartmentID, Name, Description )
VALUES (1, 'Weddings', 'Going to a wedding? Here''s a collection of balloons for that special event!')
GO
INSERT INTO Category (DepartmentID, Name, Description )
VALUES (2, 'Message Balloons', 'Why write on paper, when you can deliver your message on a balloon?')
GO
INSERT INTO Category (DepartmentID, Name, Description )
VALUES (2, 'Cartoons', 'Buy a balloon with your child''s favorite cartoon character!')
GO
INSERT INTO Category (DepartmentID, Name, Description )
VALUES (2, 'Miscellaneous', 'Various baloons that your kid will most certainly love!')
GO
INSERT INTO Product(Name, Description, Price, Image1FileName, Image2FileName, OnCatalog
没有合适的资源?快使用搜索试试~ 我知道了~
Beginning ASP.NET 2.0 E-Commerce in C#
共698个文件
cs:274个
jpg:124个
ascx:85个
需积分: 0 4 下载量 112 浏览量
2008-09-11
21:56:51
上传
评论
收藏 2.93MB RAR 举报
温馨提示
是一个不可多得的实例网站代码 利用的三层架构开发的B/S结构的 购物网站实例,值得参考
资源详情
资源评论
资源推荐
收起资源包目录
Beginning ASP.NET 2.0 E-Commerce in C# (698个子文件)
Global.asax 896B
Global.asax 862B
Global.asax 862B
Global.asax 862B
Global.asax 862B
Global.asax 862B
Global.asax 862B
Global.asax 862B
Global.asax 862B
CustomerDetailsEdit.ascx 7KB
ProductsAdmin.ascx 5KB
ProductsAdmin.ascx 5KB
ProductsAdmin.ascx 5KB
ProductsAdmin.ascx 5KB
ProductsAdmin.ascx 5KB
OrderDetailsAdmin.ascx 5KB
OrderDetailsAdmin.ascx 4KB
OrderDetailsAdmin.ascx 4KB
OrderDetailsAdmin.ascx 4KB
UserInfo.ascx 3KB
CategoriesAdmin.ascx 2KB
CategoriesAdmin.ascx 2KB
CategoriesAdmin.ascx 2KB
CategoriesAdmin.ascx 2KB
CategoriesAdmin.ascx 2KB
DepartmentsAdmin.ascx 2KB
DepartmentsAdmin.ascx 2KB
DepartmentsAdmin.ascx 2KB
DepartmentsAdmin.ascx 2KB
DepartmentsAdmin.ascx 2KB
ProductDetailsAdmin.ascx 2KB
ProductDetailsAdmin.ascx 2KB
ProductDetailsAdmin.ascx 2KB
ProductDetailsAdmin.ascx 2KB
ProductDetailsAdmin.ascx 2KB
UserInfo.ascx 2KB
UserInfo.ascx 2KB
UserInfo.ascx 2KB
UserInfo.ascx 2KB
ProductsList.ascx 2KB
ProductsList.ascx 2KB
ProductsList.ascx 2KB
ProductsList.ascx 2KB
UserInfo.ascx 1KB
ProductsList.ascx 1KB
ProductsList.ascx 1KB
ProductsList.ascx 1KB
ProductsList.ascx 1KB
ProductsList.ascx 1KB
DepartmentsList.ascx 1KB
AmazonProductsList.ascx 996B
CategoriesList.ascx 902B
CategoriesList.ascx 900B
CategoriesList.ascx 900B
CategoriesList.ascx 900B
CategoriesList.ascx 900B
CategoriesList.ascx 900B
CategoriesList.ascx 900B
CategoriesList.ascx 900B
CategoriesList.ascx 900B
CartSummary.ascx 820B
CartSummary.ascx 820B
CartSummary.ascx 820B
CartSummary.ascx 820B
DepartmentsList.ascx 804B
DepartmentsList.ascx 804B
DepartmentsList.ascx 804B
DepartmentsList.ascx 804B
DepartmentsList.ascx 804B
DepartmentsList.ascx 804B
DepartmentsList.ascx 804B
DepartmentsList.ascx 804B
DepartmentsList.ascx 804B
SearchBox.ascx 722B
SearchBox.ascx 722B
SearchBox.ascx 722B
SearchBox.ascx 722B
SearchBox.ascx 722B
SearchBox.ascx 722B
SearchBox.ascx 722B
SearchBox.ascx 722B
ProductRecommendations.ascx 693B
ProductRecommendations.ascx 693B
Header.ascx 217B
Header.ascx 217B
Header.ascx 217B
Header.ascx 217B
Header.ascx 217B
Header.ascx 217B
Header.ascx 217B
Header.ascx 217B
Header.ascx 217B
Header.ascx 217B
Header.ascx 217B
OrdersAdmin.aspx 5KB
OrdersAdmin.aspx 4KB
OrdersAdmin.aspx 4KB
OrdersAdmin.aspx 4KB
Login.aspx 3KB
Login.aspx 3KB
共 698 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
Bevanxi
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0