USE [book]
GO
/****** Object:  View [dbo].[v_users]    Script Date: 01/20/2012 17:29:55 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[v_users]'))
DROP VIEW [dbo].[v_users]
GO






IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[v_booklist]'))
DROP VIEW [dbo].[v_booklist]
GO




/****** Object:  UserDefinedFunction [dbo].[GetdeptName]    Script Date: 01/20/2012 17:29:54 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GetdeptName]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[GetdeptName]
GO
/****** Object:  StoredProcedure [dbo].[sp_users_insertdept]    Script Date: 01/20/2012 17:29:53 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_users_insertdept]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[sp_users_insertdept]
GO
/****** Object:  StoredProcedure [dbo].[sp_users_movedept]    Script Date: 01/20/2012 17:29:53 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_users_movedept]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[sp_users_movedept]
GO
/****** Object:  Table [dbo].[users_dept]    Script Date: 01/20/2012 17:29:53 ******/
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_portal_category_parentid]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[users_dept] DROP CONSTRAINT [DF_portal_category_parentid]
END
GO
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_portal_category_orderid]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[users_dept] DROP CONSTRAINT [DF_portal_category_orderid]
END
GO
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_portal_category_depth]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[users_dept] DROP CONSTRAINT [DF_portal_category_depth]
END
GO
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_hr_csscategory_path]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[users_dept] DROP CONSTRAINT [DF_hr_csscategory_path]
END
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[users_dept]') AND type in (N'U'))
DROP TABLE [dbo].[users_dept]
GO
/****** Object:  Table [dbo].[users_getpwd]    Script Date: 01/20/2012 17:29:53 ******/
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_users_getpwd_createdate]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[users_getpwd] DROP CONSTRAINT [DF_users_getpwd_createdate]
END
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[users_getpwd]') AND type in (N'U'))
DROP TABLE [dbo].[users_getpwd]
GO
/****** Object:  Table [dbo].[users_releation]    Script Date: 01/20/2012 17:29:53 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[users_releation]') AND type in (N'U'))
DROP TABLE [dbo].[users_releation]
GO
/****** Object:  Table [dbo].[users_roles]    Script Date: 01/20/2012 17:29:52 ******/
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_users_roles_issystem]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[users_roles] DROP CONSTRAINT [DF_users_roles_issystem]
END
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[users_roles]') AND type in (N'U'))
DROP TABLE [dbo].[users_roles]
GO
/****** Object:  Table [dbo].[users_users]    Script Date: 01/20/2012 17:29:52 ******/
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_portal_users_createdate]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[users_users] DROP CONSTRAINT [DF_portal_users_createdate]
END
GO
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_portal_users_lastlogin]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[users_users] DROP CONSTRAINT [DF_portal_users_lastlogin]
END
GO
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_users_users_avtor]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[users_users] DROP CONSTRAINT [DF_users_users_avtor]
END
GO
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_users_users_logintime]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[users_users] DROP CONSTRAINT [DF_users_users_logintime]
END
GO
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_users_users_logintime_1]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[users_users] DROP CONSTRAINT [DF_users_users_logintime_1]
END
GO
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_users_users_ismgr]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[users_users] DROP CONSTRAINT [DF_users_users_ismgr]
END
GO
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_users_users_issec]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[users_users] DROP CONSTRAINT [DF_users_users_issec]
END
GO
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_users_users_isstaff]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[users_users] DROP CONSTRAINT [DF_users_users_isstaff]
END
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[users_users]') AND type in (N'U'))
DROP TABLE [dbo].[users_users]
GO
/****** Object:  Table [dbo].[users_usersinroles]    Script Date: 01/20/2012 17:29:52 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[users_usersinroles]') AND type in (N'U'))
DROP TABLE [dbo].[users_usersinroles]
GO
/****** Object:  Table [dbo].[logos]    Script Date: 01/20/2012 17:29:52 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[logos]') AND type in (N'U'))
DROP TABLE [dbo].[logos]
GO
/****** Object:  Table [dbo].[book_booklist]    Script Date: 01/20/2012 17:29:52 ******/
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_book_booklist_createdate]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[book_booklist] DROP CONSTRAINT [DF_book_booklist_createdate]
END
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[book_booklist]') AND type in (N'U'))
DROP TABLE [dbo].[book_booklist]
GO
/****** Object:  Table [dbo].[book_cache]    Script Date: 01/20/2012 17:29:52 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[book_cache]') AND type in (N'U'))
DROP TABLE [dbo].[book_cache]
GO
/****** Object:  Table [dbo].[book_categories]    Script Date: 01/20/2012 17:29:52 ******/
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF__book_cate__isdel__03317E3D]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[book_categories] DROP CONSTRAINT [DF__book_cate__isdel__03317E3D]
END
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[book_categories]') AND type in (N'U'))
DROP TABLE [dbo].[book_categories]
GO
/****** Object:  Table [dbo].[book_log]    Script Date: 01/20/2012 17:29:52 ******/
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_book_log_datetime]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[book_log] DROP CONSTRAINT [DF_book_log_datetime]
END
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[book_log]') AND type in (N'U'))
DROP TABLE [dbo].[book_log]
GO
/****** Object:  Table [dbo].[book_schedular]    Script Date: 01/20/2012 17:29:52 ******/
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_book_schedular_ispop]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[book_schedular] DROP CONSTRAINT [DF_book_schedular_ispop]
END
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[book_schedular]') AND type in (N'U'))
DROP TABLE [dbo].[book_schedular]
GO
/****** Object:  User [book]    Script Date: 01/20/2012 17:29:50 ******/
IF  EXISTS (SELECT * FROM sys.database_principals WHERE name = N'book')
DROP USER [book]
GO
/****** Object:  User [book]    Script Date: 01/20/2012 17:29:50 ******/
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'book')
CREATE USER [book] WITHOUT LOGIN WITH DEFAULT_SCHEMA=[dbo]
GO
/****** Object:  Table [dbo].[book_schedular]    Script Date: 01/20/2012 17:29:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[book_schedular]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[book_schedular](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[begintime] [datetime] NULL,
	[endtime] [datetime] NULL,
	[uid] [int] NULL,
	[meetingid] [int] NULL,
	[title] [nvarchar](500) NULL,
	[ispop] [int] NULL CONSTRAINT [DF_book_schedular_ispop]  DEFAULT ((1)),
 CONSTRAINT [PK__book_schedular__07F6335A] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET IDENTITY_INSERT [dbo].[book_schedular] ON
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (1, CAST(0x00009F17011826C0 AS DateTime), CAST(0x00009F170128A180 AS DateTime), 1, 1, N'6(15001712100) 6 预定了会议室邀请您参加:', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (2, CAST(0x00009F18009450C0 AS DateTime), CAST(0x00009F1800A4CB80 AS DateTime), 1, 2, N'6(15001712100) 6 预定了会议室邀请您参加:test', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (3, CAST(0x00009F1800CDFE60 AS DateTime), CAST(0x00009F1800DE7920 AS DateTime), 1, 3, N'6(15001712100) 6 预定了会议室邀请您参加:tests2', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (4, CAST(0x00009F1800F73140 AS DateTime), CAST(0x00009F180107AC00 AS DateTime), 1, 4, N'HR(15001712100) HR 预定了会议室邀请您参加:test', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (5, CAST(0x00009F1800DE7920 AS DateTime), CAST(0x00009F1800EEF3E0 AS DateTime), 1, 5, N'HR(15001712100) HR 预定了会议室邀请您参加:test', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (6, CAST(0x00009F180128A180 AS DateTime), CAST(0x00009F1801391C40 AS DateTime), 1, 6, N'HR(15001712100) HR 预定了会议室邀请您参加:test', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (7, CAST(0x00009F1900C5C100 AS DateTime), CAST(0x00009F1900DE7920 AS DateTime), 1, 7, N'HR(15001712100) HR 预定了会议室邀请您参加:', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (8, CAST(0x00009F1A0107AC00 AS DateTime), CAST(0x00009F1A011826C0 AS DateTime), 1, 8, N'人力资源部(15001712100) 人力资源部 预定了会议室邀请您参加:内部培训用', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (9, CAST(0x00009F1A011826C0 AS DateTime), CAST(0x00009F1A0128A180 AS DateTime), 1, 9, N'HR(15001712100) HR 预定了会议室邀请您参加:test', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (10, CAST(0x00009F1F00B54640 AS DateTime), CAST(0x00009F1F00C5C100 AS DateTime), 1, 10, N'HR(15001712100) HR 预定了会议室邀请您参加:test', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (11, CAST(0x00009FBC0083D600 AS DateTime), CAST(0x00009FBC009450C0 AS DateTime), 1, 11, N'HR(15001712100) HR 预定了会议室邀请您参加:test', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (12, CAST(0x00009FBC00B54640 AS DateTime), CAST(0x00009FBC00C5C100 AS DateTime), 1, 12, N'人事部(15001712100) 人事部 预定了会议室邀请您参加:新员工入职培训', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (13, CAST(0x00009FBC00A4CB80 AS DateTime), CAST(0x00009FBC00B54640 AS DateTime), 1, 13, N'人事部(15001712100) 人事部 预定了会议室邀请您参加:内部培训使用', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (14, CAST(0x00009FBC00C5C100 AS DateTime), CAST(0x00009FBC00D63BC0 AS DateTime), 1, 14, N'管理部(15001712100) 管理部 预定了会议室邀请您参加:计算机等级内部培训', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (15, CAST(0x00009FBC00D63BC0 AS DateTime), CAST(0x00009FBC00E6B680 AS DateTime), 1, 15, N'人事部(15001712100) 人事部 预定了会议室邀请您参加:员工内部培训', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (16, CAST(0x00009FBC0128A180 AS DateTime), CAST(0x00009FBC01391C40 AS DateTime), 1, 16, N'HR(15001712100) HR 预定了会议室邀请您参加:员工培训惊声尖用', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (17, CAST(0x00009FBD00DE7920 AS DateTime), CAST(0x00009FBD00EEF3E0 AS DateTime), 1, 17, N'HR(15001712100) HR 预定了会议室邀请您参加:eee', 0)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (18, CAST(0x00009FBE00F73140 AS DateTime), CAST(0x00009FBE0107AC00 AS DateTime), 1, NULL, N'快快快', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (19, CAST(0x00009FBD00BD83A0 AS DateTime), CAST(0x00009FBD00DE7920 AS DateTime), 1, NULL, N'新事件', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (24, CAST(0x00009FBF00B54640 AS DateTime), CAST(0x00009FBF00C5C100 AS DateTime), 1, 19, N'人事部(15001712100) 人事部 预定了会议室邀请您参加:新员工入职会议', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (25, CAST(0x00009FBF009450C0 AS DateTime), CAST(0x00009FBF00A4CB80 AS DateTime), 1, 20, N'人事部(15001712100) 人事部 预定了会议室邀请您参加:新员工入职', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (26, CAST(0x00009FBF009450C0 AS DateTime), CAST(0x00009FBF00A4CB80 AS DateTime), 2, 20, N'人事部(15001712100) 人事部 预定了会议室邀请您参加:新员工入职', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (27, CAST(0x00009FBF009450C0 AS DateTime), CAST(0x00009FBF00A4CB80 AS DateTime), 1, 20, N'人事部(15001712100) 人事部 预定了会议室邀请您参加:新员工入职', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (28, CAST(0x00009FC701391C40 AS DateTime), CAST(0x00009FC701499700 AS DateTime), 1, 21, N'人事部(15001712100) 人事部 预定了会议室邀请您参加:内部培训', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (29, CAST(0x00009FC701499700 AS DateTime), CAST(0x00009FC7015A11C0 AS DateTime), 1, 22, N'HR(15001712100) HR 预定了会议室邀请您参加:内部培训', 1)
INSERT [dbo].[book_schedular] ([id], [begintime], [endtime], [uid], [meetingid], [title], [ispop]) VALUES (31, CAST(0x00009FDF00DE7920 AS DateTime), CAST(0x00009FDF00F73140 AS DateTime), 1, 23, N'HR(15001712100) HR 预定了会议室邀请您参加:test', 1)
SET IDENTITY_INSERT [dbo].[book_schedular] OFF
/****** Object:  Table [dbo].[book_log]    Script Date: 01/20/2012 17:29:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[book_log]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[book_log](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[username] [nvarchar](50) NULL,
	[ip] [nvarchar](50) NULL,
	[datetime] [datetime] NULL CONSTRAINT [DF_book_log_datetime]  DEFAULT (getdate()),
	[contents] [nvarchar](2000) NULL,
 CONSTRAINT [PK__book_log__1367E606] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object:  Table [dbo].[book_categories]    Script Date: 01/20/2012 17:29:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[book_categories]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[book_categories](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[catname] [nvarchar](50) NULL,
	[orderid] [int] NULL,
	[cattype] [nvarchar](50) NULL,
	[allowroles] [nvarchar](500) NULL,
	[isdelete] [int] NULL CONSTRAINT [DF__book_cate__isdel__03317E3D]  DEFAULT ((0)),
	[url] [nvarchar](500) NULL,
	[username] [nvarchar](50) NULL,
	[password] [nvarchar](50) NULL,
	[domain] [nvarchar](50) NULL,
	[hasprojector] [nvarchar](50) NULL,
	[haspc] [nvarchar](50) NULL,
	[hastc] [nvarchar](50) NULL,
	[hasvtc] [nvarchar](50) NULL,
	[num] [int] NULL,
	[numtext] [nvarchar](50) NULL,
	[flash] [nvarchar](100) NULL,
	[prev1] [nvarchar](50) NULL,
	[prev2] [nvarchar](50) NULL,
	[ip] [nvarchar](50) NULL,
 CONSTRAINT [PK__book_categories__023D5A04] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET IDENTITY_INSERT [dbo].[book_categories] ON
INSERT [dbo].[book_categories] ([id], [catname], [orderid], [cattype], [allowroles], [isdelete], [url], [username], [password], [domain], [hasprojector], [haspc], [hastc], [hasvtc], [num], [numtext], [flash], [prev1], [prev2], [ip]) VALUES (25, N'room1', 0, N'room', N'All Roles,', 0, N'http://mail.dotnetcms.com.cn/exchange/dreamli/Calendar/', N'username', N'password', N'mschina', N'1', N'1', N'0', N'0', 5, NULL, NULL, N'0', N'0', NULL)
INSERT [dbo].[book_categories] ([id], [catname], [orderid], [cattype], [allowroles], [isdelete], [url], [username], [password], [domain], [hasprojector], [haspc], [hastc], [hasvtc], [num], [numtext], [flash], [prev1], [prev2], [ip]) VALUES (26, N'Appemail', 0, N'room', N'', 0, N'http://mail.dotnetcms.com.cn/exchange/appemail/%E6%97%A5%E5%8E%86/', N'test', N'password', N'mschina', N'0', N'0', N'0', N'0', 0, NULL, NULL, N'0', N'0', NULL)
SET IDENTITY_INSERT [dbo].[book_categories] OFF
/****** Object:  Table [dbo].[book_cache]    Script Date: 01/20/2012 17:29:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[book_cache]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[book_cache](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[subject] [nvarchar](1000) NULL,
	[location] [nvarchar](1000) NULL,
	[begintime] [datetime] NULL,
	[endtime] [datetime] NULL,
	[busystatus] [nvarchar](50) NULL,
	[href] [nvarchar](1000) NULL,
	[displayname] [nvarchar](500) NULL,
	[htmldescription] [nvarchar](max) NULL,
	[instancetype] [nvarchar](50) NULL,
	[roomid] [int] NULL,
	[guid] [nvarchar](50) NULL,
 CONSTRAINT [PK_book_cache] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET IDENTITY_INSERT [dbo].[book_cache] ON
INSERT [dbo].[book_cache] ([id], [subject], [location], [begintime], [endtime], [busystatus], [href], [displayname], [htmldescription], [instancetype], [roomid], [guid]) VALUES (1, N'明天开会', N'', CAST(0x00009FDF00C5C100 AS DateTime), CAST(0x00009FDF00CDFE60 AS DateTime), N'BUSY', N'http://mail.dotnetcms.com.cn/exchange/blog/Calendar/{6AA70906-B045-4875-9A5C-73E5DBAE4D3B}.EML', N'{6AA70906-B045-4875-9A5C-73E5DBAE4D3B}.EML', N'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7653.1">
<TITLE>明天开会</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>可以吗</FONT>
</P>

</BODY>
</HTML>', NULL, 25, N'dd2be4c7-d66b-48f9-a75d-edece3c0099f')
INSERT [dbo].[book_cache] ([id], [subject], [location], [begintime], [endtime], [busystatus], [href], [displayname], [htmldescription], [instancetype], [roomid], [guid]) VALUES (2, N'test', N'', CAST(0x00009FDE00B54640 AS DateTime), CAST(0x00009FDE00BD83A0 AS DateTime), N'BUSY', N'http://mail.qq.com/exchange/username/Calendar/{64955884-77B3-47C1-962B-BE3C82307990}.EML', N'{64955884-77B3-47C1-962B-BE3C82307990}.EML', N'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7653.1">
<TITLE>test</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>这里是一个测试</FONT>
</P>

</BODY>
</HTML>', NULL, 25, N'dd2be4c7-d66b-48f9-a75d-edece3c0099f')
SET IDENTITY_INSERT [dbo].[book_cache] OFF
/****** Object:  Table [dbo].[book_booklist]    Script Date: 01/20/2012 17:29:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[book_booklist]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[book_booklist](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[username] [nvarchar](50) NULL,
	[createdate] [datetime] NULL CONSTRAINT [DF_book_booklist_createdate]  DEFAULT (getdate()),
	[bookdate] [datetime] NULL,
	[begintime] [datetime] NULL,
	[endtime] [datetime] NULL,
	[contactname] [nvarchar](50) NULL,
	[contactdept] [nvarchar](50) NULL,
	[contacttel] [nvarchar](50) NULL,
	[contactemail] [nvarchar](50) NULL,
	[numbers] [nvarchar](50) NULL,
	[intro] [nvarchar](500) NULL,
	[roomname] [nvarchar](50) NULL,
	[roomid] [nvarchar](50) NULL,
	[pcname] [nvarchar](50) NULL,
	[pcid] [nvarchar](50) NULL,
	[projectorname] [nvarchar](50) NULL,
	[projectorid] [nvarchar](50) NULL,
	[others1] [nvarchar](500) NULL,
	[others2] [nvarchar](500) NULL,
	[cc] [nvarchar](1000) NULL,
	[specialrequire] [nvarchar](500) NULL,
	[process] [nvarchar](50) NULL,
	[status] [nvarchar](50) NULL,
	[userid] [nvarchar](50) NULL,
	[welcomemessage] [nvarchar](300) NULL,
	[fontsize] [nvarchar](50) NULL,
	[fontcolor] [nvarchar](50) NULL,
	[logo] [nvarchar](200) NULL,
	[fontfamily] [nvarchar](50) NULL,
 CONSTRAINT [PK__book_booklist__7C8480AE] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET IDENTITY_INSERT [dbo].[book_booklist] ON
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (1, N'管理员', CAST(0x00009F1701222E73 AS DateTime), CAST(0x00009F1700000000 AS DateTime), CAST(0x00009F17011826C0 AS DateTime), CAST(0x00009F170128A180 AS DateTime), N'管理员', N'HR', N'15001712100', N'A@dotnetcms.org', N'2', N'', N'room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'A@dotnetcms.org', N'', N'1', NULL, N'1', NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (2, N'管理员', CAST(0x00009F1800952816 AS DateTime), CAST(0x00009F1800000000 AS DateTime), CAST(0x00009F18009450C0 AS DateTime), CAST(0x00009F1800A4CB80 AS DateTime), N'管理员', N'HR', N'15001712100', N'A@dotnetcms.org', N'2', N'test', N'room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'A@dotnetcms.org', N'', N'1', NULL, N'1', NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (3, N'管理员', CAST(0x00009F1800953624 AS DateTime), CAST(0x00009F1800000000 AS DateTime), CAST(0x00009F1800CDFE60 AS DateTime), CAST(0x00009F1800DE7920 AS DateTime), N'管理员', N'管理员', N'15001712100', N'A@dotnetcms.org', N'2', N'tests2', N'room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'A@dotnetcms.org', N'', N'1', NULL, N'1', NULL, NULL, NULL, N'~/uploads/b.jpg', NULL)
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (4, N'管理员', CAST(0x00009F1800E0E292 AS DateTime), CAST(0x00009F1800000000 AS DateTime), CAST(0x00009F1800F73140 AS DateTime), CAST(0x00009F180107AC00 AS DateTime), N'管理员', N'HR', N'15001712100', N'A@dotnetcms.org', N'2', N'test', N'room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'A@dotnetcms.org', N'', N'1', NULL, N'1', NULL, NULL, NULL, N'~/uploads/b.jpg', NULL)
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (5, N'管理员', CAST(0x00009F1800E1164E AS DateTime), CAST(0x00009F1800000000 AS DateTime), CAST(0x00009F1800DE7920 AS DateTime), CAST(0x00009F1800EEF3E0 AS DateTime), N'管理员', N'HR', N'15001712100', N'A@dotnetcms.org', N'2', N'test', N'room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'A@dotnetcms.org', N'test', N'1', NULL, N'1', NULL, NULL, NULL, N'~/uploads/b.jpg', NULL)
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (6, N'管理员', CAST(0x00009F1800E49362 AS DateTime), CAST(0x00009F1800000000 AS DateTime), CAST(0x00009F180128A180 AS DateTime), CAST(0x00009F1801391C40 AS DateTime), N'管理员', N'HR2', N'15001712100', N'A@dotnetcms.org', N'2', N'test', N'room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'A@dotnetcms.org', N'test', N'1', NULL, N'1', N'test', N'20', N'#ff0000', N'~/uploads/b.jpg', N'微软雅黑')
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (7, N'管理员', CAST(0x00009F1900C97643 AS DateTime), CAST(0x00009F1900000000 AS DateTime), CAST(0x00009F1900C5C100 AS DateTime), CAST(0x00009F1900DE7920 AS DateTime), N'管理员', N'HR', N'15001712100', N'A@dotnetcms.org', N'2', N'', N'room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'A@dotnetcms.org', N'1223', N'1', NULL, N'1', N'', N'20', N'#ff0000', N'~/uploads/20110705173035.JPG', N'微软雅黑')
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (8, N'管理员', CAST(0x00009F1A010D1125 AS DateTime), CAST(0x00009F1A00000000 AS DateTime), CAST(0x00009F1A0107AC00 AS DateTime), CAST(0x00009F1A011826C0 AS DateTime), N'李万宝', N'人力资源部', N'15001712100', N'A@dotnetcms.org', N'2', N'内部培训用', N'room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'A@dotnetcms.org', N'', N'1', NULL, N'1', N'test', N'20', N'#ff0000', N'~/uploads/20110705173035.JPG', N'微软雅黑')
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (9, N'管理员', CAST(0x00009F1A011BC913 AS DateTime), CAST(0x00009F1A00000000 AS DateTime), CAST(0x00009F1A011826C0 AS DateTime), CAST(0x00009F1A0128A180 AS DateTime), N'管理员', N'HR', N'15001712100', N'A@dotnetcms.org', N'2', N'test', N'room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'A@dotnetcms.org', N'', N'1', NULL, N'1', N'tt', N'20', N'#ff0000', N'~/uploads/20110705173035.JPG', N'微软雅黑')
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (10, N'管理员', CAST(0x00009F1F00C199A1 AS DateTime), CAST(0x00009F1F00000000 AS DateTime), CAST(0x00009F1F00B54640 AS DateTime), CAST(0x00009F1F00C5C100 AS DateTime), N'管理员', N'HR', N'15001712100', N'A@dotnetcms.org', N'2', N'test', N'23F Room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'A@dotnetcms.org', N'test', N'1', NULL, N'1', N'', N'20', N'#ff0000', N'~/uploads/20110706133910.JPG', N'微软雅黑')
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (11, N'管理员', CAST(0x00009FBC0090BEC6 AS DateTime), CAST(0x00009FBC00000000 AS DateTime), CAST(0x00009FBC0083D600 AS DateTime), CAST(0x00009FBC009450C0 AS DateTime), N'管理员', N'HR', N'15001712100', N'A@dotnetcms.org', N'2', N'test', N'23F Room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'A@dotnetcms.org', N'', N'1', NULL, N'1', N'', N'20', N'#ff0000', N'', N'微软雅黑')
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (12, N'管理员', CAST(0x00009FBC009B00B8 AS DateTime), CAST(0x00009FBC00000000 AS DateTime), CAST(0x00009FBC00B54640 AS DateTime), CAST(0x00009FBC00C5C100 AS DateTime), N'李万宝', N'人事部', N'15001712100', N'A@dotnetcms.org', N'2', N'新员工入职培训', N'23F Room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'A@dotnetcms.org', N'', N'1', NULL, N'1', N'', N'20', N'#ff0000', N'', N'微软雅黑')
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (13, N'管理员', CAST(0x00009FBC00A877DD AS DateTime), CAST(0x00009FBC00000000 AS DateTime), CAST(0x00009FBC00A4CB80 AS DateTime), CAST(0x00009FBC00B54640 AS DateTime), N'管理员', N'人事部', N'15001712100', N'A@dotnetcms.org', N'2', N'内部培训使用', N'23F Room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'A@dotnetcms.org', N'', N'1', NULL, N'1', N'', N'20', N'#ff0000', N'', N'微软雅黑')
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (14, N'管理员', CAST(0x00009FBC00CA1F7B AS DateTime), CAST(0x00009FBC00000000 AS DateTime), CAST(0x00009FBC00C5C100 AS DateTime), CAST(0x00009FBC00D63BC0 AS DateTime), N'管理员', N'管理部', N'15001712100', N'A@dotnetcms.org', N'2', N'计算机等级内部培训', N'23F Room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'A@dotnetcms.org', N'', N'1', NULL, N'1', N'', N'20', N'#ff0000', N'', N'微软雅黑')
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (15, N'管理员', CAST(0x00009FBC00E0FD84 AS DateTime), CAST(0x00009FBC00000000 AS DateTime), CAST(0x00009FBC00D63BC0 AS DateTime), CAST(0x00009FBC00E69C6C AS DateTime), N'管理员', N'人事部', N'15001712100', N'A@dotnetcms.org', N'2', N'员工内部培训', N'23F Room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'A@dotnetcms.org', N'', N'1', NULL, N'1', N'', N'20', N'#ff0000', N'', N'微软雅黑')
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (16, N'管理员', CAST(0x00009FBC012C03E1 AS DateTime), CAST(0x00009FBC00000000 AS DateTime), CAST(0x00009FBC0128A180 AS DateTime), CAST(0x00009FBC012F0980 AS DateTime), N'管理员', N'HR', N'15001712100', N'A@dotnetcms.org', N'2', N'员工培训惊声尖用', N'23F Room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'A@dotnetcms.org', N'', N'1', NULL, N'1', N'', N'20', N'#ff0000', N'', N'微软雅黑')
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (17, N'管理员', CAST(0x00009FBD012FA8AB AS DateTime), CAST(0x00009FBD00000000 AS DateTime), CAST(0x00009FBD0128A180 AS DateTime), CAST(0x00009FBD01391C40 AS DateTime), N'管理员', N'HR', N'15001712100', N'A@dotnetcms.org', N'2', N'eee', N'23F Room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'A@dotnetcms.org', N'', N'1', NULL, N'1', N'', N'20', N'#ff0000', N'', N'微软雅黑')
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (18, N'管理员', CAST(0x00009FBF008011A0 AS DateTime), CAST(0x00009FBF00000000 AS DateTime), CAST(0x00009FBF00735B40 AS DateTime), CAST(0x00009FBF0083D600 AS DateTime), N'管理员', N'人事部', N'15001712100', N'A@dotnetcms.org', N'2', N'内部培训会议', N'23F Room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'983506039@qq.com', N'', N'1', NULL, N'1', N'', N'20', N'#ff0000', N'', N'微软雅黑')
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (19, N'管理员', CAST(0x00009FBF008088D3 AS DateTime), CAST(0x00009FBF00000000 AS DateTime), CAST(0x00009FBF00B54640 AS DateTime), CAST(0x00009FBF00C5C100 AS DateTime), N'管理员', N'人事部', N'15001712100', N'983506039@qq.com', N'2', N'新员工入职会议', N'23F Room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'983506039@qq.com', N'', N'3', NULL, N'1', N'', N'20', N'#ff0000', N'', N'微软雅黑')
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (20, N'管理员', CAST(0x00009FBF00A102C5 AS DateTime), CAST(0x00009FBF00000000 AS DateTime), CAST(0x00009FBF009450C0 AS DateTime), CAST(0x00009FBF00A4CB80 AS DateTime), N'管理员', N'人事部', N'15001712100', N'983506039@qq.com', N'2', N'新员工入职', N'23F Room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'983506039@qq.com,11@11.11,983506039@qq.com,', N'', N'1', NULL, N'1', N'', N'20', N'#ff0000', N'', N'微软雅黑')
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (21, N'管理员', CAST(0x00009FC701432CAE AS DateTime), CAST(0x00009FC700000000 AS DateTime), CAST(0x00009FC701391C40 AS DateTime), CAST(0x00009FC701499700 AS DateTime), N'管理员', N'人事部', N'15001712100', N'983506039@qq.com', N'2', N'内部培训', N'23F Room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'983506039@qq.com', N'', N'1', NULL, N'1', N'', N'20', N'#ff0000', N'', N'微软雅黑')
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (22, N'管理员', CAST(0x00009FC7014A2C44 AS DateTime), CAST(0x00009FC700000000 AS DateTime), CAST(0x00009FC701499700 AS DateTime), CAST(0x00009FC7014B5D64 AS DateTime), N'管理员', N'HR', N'15001712100', N'983506039@qq.com', N'2', N'内部培训', N'23F Room1 内置笔记本,内置笔记本,容纳人数5', N'14', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'983506039@qq.com', N'', N'1', NULL, N'1', N'', N'20', N'#ff0000', N'', N'微软雅黑')
INSERT [dbo].[book_booklist] ([id], [username], [createdate], [bookdate], [begintime], [endtime], [contactname], [contactdept], [contacttel], [contactemail], [numbers], [intro], [roomname], [roomid], [pcname], [pcid], [projectorname], [projectorid], [others1], [others2], [cc], [specialrequire], [process], [status], [userid], [welcomemessage], [fontsize], [fontcolor], [logo], [fontfamily]) VALUES (23, N'管理员', CAST(0x00009FDE01167B78 AS DateTime), CAST(0x00009FDF00000000 AS DateTime), CAST(0x00009FDF00DE7920 AS DateTime), CAST(0x00009FDF00F73140 AS DateTime), N'管理员', N'HR', N'15001712100', N'983506039@qq.com', N'2', N'test', N'room1 内置笔记本,内置笔记本,容纳人数5', N'25', N'无需笔记本', N'0', N'无需投影仪', N'0', N'', N'', N'983506039@qq.com', N'', N'2', NULL, N'1', N'', N'20', N'#ff0000', N'', N'微软雅黑')
SET IDENTITY_INSERT [dbo].[book_booklist] OFF
/****** Object:  Table [dbo].[logos]    Script Date: 01/20/2012 17:29:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[logos]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[logos](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[logopath] [nvarchar](50) NULL,
 CONSTRAINT [PK_logos] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET IDENTITY_INSERT [dbo].[logos] ON
INSERT [dbo].[logos] ([id], [logopath]) VALUES (1, N'~/uploads/20110705173035.JPG')
INSERT [dbo].[logos] ([id], [logopath]) VALUES (2, N'~/uploads/20110706133910.JPG')
SET IDENTITY_INSERT [dbo].[logos] OFF
/****** Object:  Table [dbo].[users_usersinroles]    Script Date: 01/20/2012 17:29:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[users_usersinroles]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[users_usersinroles](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[uid] [int] NULL,
	[rolename] [nvarchar](50) NULL,
 CONSTRAINT [PK_portal_usersinroles] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET IDENTITY_INSERT [dbo].[users_usersinroles] ON
INSERT [dbo].[users_usersinroles] ([id], [uid], [rolename]) VALUES (1, 1, N'Administrators')
INSERT [dbo].[users_usersinroles] ([id], [uid], [rolename]) VALUES (2, 4, N'Administrators')
SET IDENTITY_INSERT [dbo].[users_usersinroles] OFF
/****** Object:  Table [dbo].[users_users]    Script Date: 01/20/2012 17:29:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[users_users]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[users_users](
	[uid] [int] IDENTITY(1,1) NOT NULL,
	[username] [nvarchar](256) NOT NULL,
	[adpath] [nvarchar](1024) NULL,
	[firstname] [nvarchar](50) NULL,
	[lastname] [nvarchar](50) NULL,
	[city] [nvarchar](256) NULL,
	[Office] [nvarchar](256) NULL,
	[Description] [nvarchar](1024) NULL,
	[Tel] [nvarchar](128) NULL,
	[fax] [nvarchar](128) NULL,
	[email] [nvarchar](256) NULL,
	[MailType] [nvarchar](128) NULL,
	[Title] [nvarchar](128) NULL,
	[Department] [nvarchar](128) NULL,
	[Company] [nvarchar](128) NULL,
	[Password] [nvarchar](128) NULL,
	[displayname] [nvarchar](128) NULL,
	[StaffCode] [nvarchar](128) NULL,
	[IsAccountActive] [int] NULL,
	[createdate] [datetime] NULL CONSTRAINT [DF_portal_users_createdate]  DEFAULT (getdate()),
	[lastlogin] [datetime] NULL CONSTRAINT [DF_portal_users_lastlogin]  DEFAULT (getdate()),
	[sex] [nvarchar](50) NULL,
	[avtor] [nvarchar](300) NULL CONSTRAINT [DF_users_users_avtor]  DEFAULT ('avtor.jpg'),
	[logintimes] [int] NULL CONSTRAINT [DF_users_users_logintime]  DEFAULT ((0)),
	[ip] [nvarchar](50) NULL,
	[logintime] [int] NULL CONSTRAINT [DF_users_users_logintime_1]  DEFAULT ((0)),
	[intro] [nvarchar](500) NULL,
	[ismgr] [int] NULL CONSTRAINT [DF_users_users_ismgr]  DEFAULT ((0)),
	[issec] [int] NULL CONSTRAINT [DF_users_users_issec]  DEFAULT ((0)),
	[isstaff] [int] NULL CONSTRAINT [DF_users_users_isstaff]  DEFAULT ((1)),
 CONSTRAINT [PK_portal_users_1] PRIMARY KEY CLUSTERED 
(
	[uid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET IDENTITY_INSERT [dbo].[users_users] ON
INSERT [dbo].[users_users] ([uid], [username], [adpath], [firstname], [lastname], [city], [Office], [Description], [Tel], [fax], [email], [MailType], [Title], [Department], [Company], [Password], [displayname], [StaffCode], [IsAccountActive], [createdate], [lastlogin], [sex], [avtor], [logintimes], [ip], [logintime], [intro], [ismgr], [issec], [isstaff]) VALUES (1, N'admin', NULL, NULL, NULL, NULL, N'北京', NULL, N'15001712100', N'123456', N'983506039@qq.com', NULL, N'', N'HR', NULL, N'CE-0B-FD-15-05-9B-68-D6-76-88-88-4D-7A-3D-3E-8C', N'管理员', N'', NULL, CAST(0x00009E4C013FE373 AS DateTime), CAST(0x00009FDE011E52C8 AS DateTime), N'', N'images/avtor.jpg', 51, N'127.0.0.1', 0, N'我是管理员，负责网络', 0, 0, 1)
INSERT [dbo].[users_users] ([uid], [username], [adpath], [firstname], [lastname], [city], [Office], [Description], [Tel], [fax], [email], [MailType], [Title], [Department], [Company], [Password], [displayname], [StaffCode], [IsAccountActive], [createdate], [lastlogin], [sex], [avtor], [logintimes], [ip], [logintime], [intro], [ismgr], [issec], [isstaff]) VALUES (2, N'里小姐', NULL, NULL, NULL, NULL, N'', NULL, N'', N'', N'11@11.11', NULL, N'', N'', NULL, N'70-66-A4-0F-42-77-69-CC-43-34-7A-A9-6B-72-93-1A', N'里小姐', N'', NULL, CAST(0x00009FBD01306020 AS DateTime), CAST(0x00009FBD01306020 AS DateTime), N'', N'images/avtor.jpg', 0, N'::1', 0, N'', 0, 0, 1)
INSERT [dbo].[users_users] ([uid], [username], [adpath], [firstname], [lastname], [city], [Office], [Description], [Tel], [fax], [email], [MailType], [Title], [Department], [Company], [Password], [displayname], [StaffCode], [IsAccountActive], [createdate], [lastlogin], [sex], [avtor], [logintimes], [ip], [logintime], [intro], [ismgr], [issec], [isstaff]) VALUES (3, N'manages', NULL, NULL, NULL, NULL, N'', NULL, N'', N'', N'dd@qqq.ddd', NULL, N'', N'', NULL, N'FE-AD-05-2E-EE-DC-FB-31-C4-9B-19-F9-1E-DD-ED-24', N'manages', N'', NULL, CAST(0x00009FBF00A310B2 AS DateTime), CAST(0x00009FBF00A310B2 AS DateTime), N'', N'images/avtor.jpg', 0, N'192.168.1.101', 0, N'', 0, 0, 1)
SET IDENTITY_INSERT [dbo].[users_users] OFF
/****** Object:  Table [dbo].[users_roles]    Script Date: 01/20/2012 17:29:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[users_roles]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[users_roles](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[rolename] [nvarchar](50) NULL,
	[issystem] [int] NULL CONSTRAINT [DF_users_roles_issystem]  DEFAULT ((0)),
	[roletype] [nvarchar](50) NULL,
 CONSTRAINT [PK_users_roles] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET IDENTITY_INSERT [dbo].[users_roles] ON
INSERT [dbo].[users_roles] ([id], [rolename], [issystem], [roletype]) VALUES (1, N'Administrators', 1, N'')
INSERT [dbo].[users_roles] ([id], [rolename], [issystem], [roletype]) VALUES (4, N'audit', 1, NULL)
INSERT [dbo].[users_roles] ([id], [rolename], [issystem], [roletype]) VALUES (5, N'users', 0, N'')
INSERT [dbo].[users_roles] ([id], [rolename], [issystem], [roletype]) VALUES (6, N'前台', 0, N'')
INSERT [dbo].[users_roles] ([id], [rolename], [issystem], [roletype]) VALUES (7, N'vip', 0, N'')
SET IDENTITY_INSERT [dbo].[users_roles] OFF
/****** Object:  Table [dbo].[users_releation]    Script Date: 01/20/2012 17:29:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[users_releation]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[users_releation](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[mgrid] [int] NULL,
	[secid] [int] NULL,
 CONSTRAINT [PK_users_releation] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET IDENTITY_INSERT [dbo].[users_releation] ON
INSERT [dbo].[users_releation] ([id], [mgrid], [secid]) VALUES (5, 7, 8)
SET IDENTITY_INSERT [dbo].[users_releation] OFF
/****** Object:  Table [dbo].[users_getpwd]    Script Date: 01/20/2012 17:29:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[users_getpwd]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[users_getpwd](
	[id] [int] NOT NULL,
	[uid] [int] IDENTITY(1,1) NOT NULL,
	[display] [nvarchar](50) NULL,
	[createdate] [datetime] NULL CONSTRAINT [DF_users_getpwd_createdate]  DEFAULT (getdate()),
 CONSTRAINT [PK_users_getpwd] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
/****** Object:  Table [dbo].[users_dept]    Script Date: 01/20/2012 17:29:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[users_dept]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[users_dept](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[catname] [nvarchar](50) NULL,
	[parentid] [int] NULL CONSTRAINT [DF_portal_category_parentid]  DEFAULT ((0)),
	[orderid] [int] NULL CONSTRAINT [DF_portal_category_orderid]  DEFAULT ((0)),
	[depth] [int] NULL CONSTRAINT [DF_portal_category_depth]  DEFAULT ((1)),
	[note] [nvarchar](200) NULL,
	[path] [nvarchar](1000) NULL CONSTRAINT [DF_hr_csscategory_path]  DEFAULT (''),
	[types] [nvarchar](50) NULL,
 CONSTRAINT [PK_users_dept] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET IDENTITY_INSERT [dbo].[users_dept] ON
INSERT [dbo].[users_dept] ([id], [catname], [parentid], [orderid], [depth], [note], [path], [types]) VALUES (1, N'公司部门', 0, 0, 1, N'', N'', N'dept')
INSERT [dbo].[users_dept] ([id], [catname], [parentid], [orderid], [depth], [note], [path], [types]) VALUES (2, N'管理部', 1, 0, 1, N'', N'A', N'dept')
INSERT [dbo].[users_dept] ([id], [catname], [parentid], [orderid], [depth], [note], [path], [types]) VALUES (3, N'制造部', 1, 0, 1, N'', N'B', N'dept')
INSERT [dbo].[users_dept] ([id], [catname], [parentid], [orderid], [depth], [note], [path], [types]) VALUES (4, N'人事部', 2, 0, 1, N'', N'AA', N'dept')
INSERT [dbo].[users_dept] ([id], [catname], [parentid], [orderid], [depth], [note], [path], [types]) VALUES (5, N'行政部', 2, 0, 1, N'', N'AB', N'dept')
INSERT [dbo].[users_dept] ([id], [catname], [parentid], [orderid], [depth], [note], [path], [types]) VALUES (6, N'IT部门', 2, 0, 1, N'', N'AC', N'dept')
INSERT [dbo].[users_dept] ([id], [catname], [parentid], [orderid], [depth], [note], [path], [types]) VALUES (7, N'环境部', 3, 0, 1, N'', N'BA', N'dept')
INSERT [dbo].[users_dept] ([id], [catname], [parentid], [orderid], [depth], [note], [path], [types]) VALUES (8, N'生产部', 3, 0, 1, N'', N'BB', N'dept')
SET IDENTITY_INSERT [dbo].[users_dept] OFF
/****** Object:  StoredProcedure [dbo].[sp_users_movedept]    Script Date: 01/20/2012 17:29:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_users_movedept]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'CREATE    PROCEDURE  [dbo].[sp_users_movedept] 
(
    @ParentID int,--新父节点
    @CataID int,--要移动的节点编号
    @CataPath varchar(20) output,--新移动后的节点路径
    @orderid int,
    @note nvarchar(500),
    @types nvarchar(50),
    @catname nvarchar(50) 

)
AS

if (not exists(select 1 from users_dept where ID = @ParentID))
    set @CataPath = '''' -- 如果新父节点不存在，则设置错误信息
else 
    begin

        declare @oldParentID int -- 原来的父节点
        select @oldParentID = ParentID from users_dept where ID = @CataID
      


  if @oldParentID = @ParentID -- 没有移动，只更新内容即可
             begin
                update users_dept set orderid=@orderid, note=@note,types=@types,catname=@catname  where id=@cataid
                select @CataPath = path from users_dept where ID = @CataID
            end 
       
       else
			begin
	            
				declare @pathLength  int
				declare @path varchar(20)
				select @path = max(Path) from users_dept  where parentID =@parentId --order by Path desc
				
            select @pathLength = len(@path) 
				 
			
   	declare @newpath varchar(20)-- 计算移动到新分类后的节点路径
				if @pathLength > 0 -- 已经存在该父类
						select @newpath = substring(@path,1,@pathLength -1)+CHAR(ASCII(REVERSE(@path))+1) 
				else
						select @newpath = path + ''A'' from users_dept where ID = @parentID
	        
				if len(@newpath) > 0
					begin
						declare @oldPath varchar(20)-- 记录原来的节点路径
						select @oldPath = Path from users_dept where ID = @CataID
						set @CataPath = @newpath;
						update users_dept set orderid=@orderid,   ParentID = @ParentID,Path = @newpath, types=@types,catname=@catname,note=@note where ID = @CataID
						-- 替换子类的Path
						update users_dept set Path = stuff(path,1,len(@oldPath),@CataPath) where Path like @oldPath+''%'' AND types=@types
					end
				else
					set @CataPath = ''''
			end
     end

' 
END
GO
/****** Object:  StoredProcedure [dbo].[sp_users_insertdept]    Script Date: 01/20/2012 17:29:53 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_users_insertdept]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @statement = N'
CREATE   PROCEDURE [dbo].[sp_users_insertdept] 
(
    @ParentID int, 
    @CatName varchar(20), 
    @Note nvarchar(200),
    @OrderId int,
    @Types nvarchar(50),
    @ID int output  
)
AS

if (@ParentID=0)
  begin
    insert into 
    users_dept(catName,ParentID,Path,Note,OrderId,types) 
    values(@CatName,@ParentID,'''',@Note,@OrderId,@types)
    select @ID = scope_identity();
 end


else
    begin
        declare @pathLength  int --路径长度
        declare @path varchar(20) --该父节点下最后一个节点的路径
        select @path = max(Path) from users_dept  where parentID = @parentId  
        select @pathLength = len(@path) 
        print @pathLength
        declare @newpath varchar(20)--新加节点的路径
        if @pathLength > 0 -- 该父类节点下已经存在有子类
                select @newpath = substring(@path,1,@pathLength -1)+CHAR(ASCII(REVERSE(@path))+1) 
        else
                select @newpath = path + ''A'' from users_dept where ID = @parentID
        
        if len(@newpath) > 0
            begin
            insert into users_dept(catName,ParentID,Path,note,OrderId,types) values(@CatName,@ParentID,@newpath,@Note,@OrderId,@types)
            select @ID = scope_identity();
            end
        else
            set @ID = -1
    end


 


' 
END
GO
/****** Object:  UserDefinedFunction [dbo].[GetdeptName]    Script Date: 01/20/2012 17:29:54 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GetdeptName]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
BEGIN
execute dbo.sp_executesql @statement = N'CREATE FUNCTION [dbo].[GetdeptName]( @id int)
 
 
 RETURNS  nvarchar(50)
begin
declare @c nvarchar(50)
 select @c= catname from users_dept    where id=@id 
   RETURN @c
end

 

' 
END
GO
/****** Object:  View [dbo].[v_users]    Script Date: 01/20/2012 17:29:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[v_users]'))
EXEC dbo.sp_executesql @statement = N'CREATE VIEW [dbo].[v_users]
AS
SELECT     uid, username, adpath, firstname, lastname, city, Office, Description, Tel, fax, email, MailType, Title, Department, Company, Password, displayname, 
                      StaffCode, IsAccountActive, createdate, lastlogin, sex, avtor, logintimes, ip, logintime, intro, ismgr, issec, isstaff, dbo.GetdeptName(Department) 
                      AS deptname
FROM         dbo.users_users
'
GO
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N'MS_DiagramPane1' , N'SCHEMA',N'dbo', N'VIEW',N'v_users', NULL,NULL))
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "users_users"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 121
               Right = 197
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'v_users'
GO
IF NOT EXISTS (SELECT * FROM ::fn_listextendedproperty(N'MS_DiagramPaneCount' , N'SCHEMA',N'dbo', N'VIEW',N'v_users', NULL,NULL))
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'v_users'
GO






CREATE VIEW [dbo].[v_booklist]
AS
SELECT     dbo.book_cache.id, dbo.book_cache.begintime, dbo.book_cache.endtime, dbo.book_cache.subject, dbo.book_categories.catname AS roomname, 
                      dbo.book_cache.roomid
FROM         dbo.book_cache LEFT OUTER JOIN
                      dbo.book_categories ON dbo.book_cache.roomid = dbo.book_categories.id
WHERE     (ISNULL(dbo.book_cache.begintime, N'') <> '') AND (dbo.book_cache.guid =
                          (SELECT     TOP (1) guid
                            FROM          dbo.book_cache AS book_cache_1
                            WHERE      (ISNULL(begintime, '') <> '')
                            ORDER BY id DESC))

GO


