asp.net图书销售管理系统设计 第2页

asp.net图书销售管理系统设计 第2页
Operatorid INT(4) NOT NULL 操作员id
Description VCHAR(200) NULL 其他描述
Bookid INT(4) NOT NULL 图书id
其中id为主键, bookid是表book 中bookid的外码,userid是表user中id 的外码,当userid为-1时表示此次零售是普通用户,否则则是会员购买!


会员表
列名 数据类型 可否为空 说明
ID INT(4) NOT NUll 主键、自动增长
Usertype INT(4) NOT NULL 会员组编号
Username VCHAR(20) NULL 会员名
Pwd VCHAR(20) NOT NULL 密码
Integral INT(4) NOT NULL 会员积分
Email VCHAR(20) NULL 会员email
Address VCHAR(20) NULL 地址
Postalcode VCHAR(10) NULL 邮编
Tel VCHAR(10) NULL 电话
Description VCHAR(200) NULL 其他描述
Idcard VCHAR(50) NOT NULL          身份证
Rmb FLOAT NOT NULL 余额
Periodofvalidity DATETIME(8) NOT NULL 会员有效期
Serialnumber VCHAR(20) NOT NULL 会员编号
Status INT(4) NOT NULL 会员状态
Sex Bool NULL 性别
Addtime DATETIME(8) NULL 添加日期
其中id为主键, usertype是表usertype 中usertype_id的外码, status是表 userstatus 中id 的外码
触发器 : modifyjifen
该触发器的作用是当改变了某一个会员的会员组类别的时候,系统将自动调整其积分,使得积分回归该会员组定义的积分限之内
----------------------------------------------------------------------------------------------------------------------
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER TRIGGER [ModifyJiFen]
ON [dbo].[User]
AFTER INSERT
AS
 declare @userid int
    declare @integral int
    declare @usertype int
 select @userid=id,@usertype=usertype,@integral=integral from inserted
 
 
 declare @integral_low int,@integral_up int
 
 select @integral_low=integral_low,@integral_up=integral_up from usertype where usertype_id=@usertype
 

 if @integral<@integral_low or @integral>@integral_up
 begin
  update [user] set integral=@integral_low where id=@userid
 end
----------------------------------------------------------------------------------------------------------------------

 

 

会员组
列名 数据类型 可否为空 说明
usertype_id INT(4) NOT NUll 主键、自动增长,会员组id
Usertype_name VCHAR(20) NOT NULL 会员组名称
         Discount FLOAT NOT NULL 会员组折扣
Integral_low INT(4) NOT NULL 积分下限
Integral_up INT(4) NOT NULL 积分上限
Description VCHAR(200) NULL 描述信息
其中usertype_id为主键.
触发器 : modify_low_up
该触发器的作用是当改变了某一个会员组的积分上限或者下限的时候,系统将自动调整其相邻的会员组的下限或者上限
---------------------------------------------------------------------set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER TRIGGER [Modify_low_up]
ON [dbo].[UserType]
after UPDATE
AS
  declare @integrallow int,@integrallow0 int
    declare @integralup int,@integralup0 int
    declare @usertypeid int
 select @usertypeid=usertype_id,@integrallow=integral_low,@integralup=integral_up from inserted 
 select @integrallow0=integral_low,@integralup0=integral_up from deleted 
 
 --select   记录号  from   inserted——修改后的 
  --select   记录号  from   deleted——修改前的 
 declare @integrallow2 int,@integralup2 int,@usertypeid2 int
 set @integrallow2=-1
 set @integralup2=-1
 
 if @integrallow0<>@integrallow
 begin
 select @usertypeid2=usertype_id,@integrallow2=integral_low,@integralup2=integral_up from usertype where 
 if @integrallow2<>-1
 begin
 update usertype set www.751com.cn  if @integralup0<>@integralup
 begin
 select @usertypeid2=usertype_id,@integrallow2=integral_low,@integralup2=integral_up from usertype where  
 if @integrallow2<>-1
 begin
 update usertype set  where 
 end
 end
--------------------------------------------------------------------- 
会员状态
列名 数据类型 可否为空 说明
ID INT(4) NOT NUll 主键、自动增长,状态id
Userstatus VCHAR(20) NOT NULL 状态名称
           Description VCHAR(200) NULL 描述信息
其中id为主键.
II. 视图设计
BOOkInfo: 表book和 表bookconcern通过concernid内连接生成.
BookSell_UserInfo_BookInfo: 视图bookinfo和 表userinfo通过bookid和userid外连接生成.
UserInfo: 表user和 表usertype 和 userstatus 通过usertype_id 和userstatus_id内连接生成.
TuiHuo/XiaoShou: 表booksell和 视图bookinfo 和 userinfo 通过userid 和bookid外连接生成.以下是部分连接语句:
1. 视图 BOOkInfo

上一页  [1] [2] [3] [4] 下一页

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有