SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Advertisements](
	[AdvertisementID] [int] IDENTITY(1,1) NOT NULL,
	[Code] [text] NOT NULL,
	[AdvertisementName] [nvarchar](200) NOT NULL,
	[Isvalid] [bit] NOT NULL,
 CONSTRAINT [PK_Advertisements] PRIMARY KEY CLUSTERED 
(
	[AdvertisementID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WebConfigs](
	[ConfigName] [nvarchar](50) NOT NULL,
	[Value] [nvarchar](500) NOT NULL,
 CONSTRAINT [PK_WebConfigs] PRIMARY KEY CLUSTERED 
(
	[ConfigName] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Users](
	[UserID] [int] IDENTITY(1,1) NOT NULL,
	[LoginID] [nvarchar](50) NOT NULL,
	[Password] [nvarchar](50) NOT NULL,
	[Role] [int] NOT NULL,
 CONSTRAINT [PK_Admins] PRIMARY KEY CLUSTERED 
(
	[UserID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Navs](
	[NavID] [int] IDENTITY(1,1) NOT NULL,
	[NavText] [nvarchar](50) NOT NULL,
	[NavUrl] [nvarchar](500) NOT NULL,
	[Target] [nvarchar](50) NOT NULL,
	[Sort] [int] NOT NULL,
 CONSTRAINT [PK_Navs] PRIMARY KEY CLUSTERED 
(
	[NavID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Categories](
	[CategoryID] [int] IDENTITY(1,1) NOT NULL,
	[CategoryName] [nvarchar](50) NOT NULL,
	[Description] [nvarchar](250) NOT NULL,
 CONSTRAINT [PK_Categories] PRIMARY KEY CLUSTERED 
(
	[CategoryID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Banners](
	[BannerID] [int] IDENTITY(1,1) NOT NULL,
	[BannerName] [nvarchar](100) NOT NULL,
	[ImgUrl] [nvarchar](500) NOT NULL,
	[Url] [nvarchar](500) NOT NULL,
	[Sort] [int] NOT NULL,
	[Target] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Banners] PRIMARY KEY CLUSTERED 
(
	[BannerID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Articles](
	[ArticleID] [int] IDENTITY(1,1) NOT NULL,
	[Title] [nvarchar](100) NOT NULL,
	[Description] [text] NOT NULL,
	[UserID] [int] NOT NULL,
	[AContent] [text] NOT NULL,
	[CreateTime] [datetime] NOT NULL,
	[CategoryID] [int] NOT NULL,
	[IsTop] [bit] NOT NULL,
	[ReadCount] [int] NOT NULL,
	[Keywords] [nvarchar](50) NOT NULL,
	[CoverImg] [nvarchar](500) NULL,
 CONSTRAINT [PK_Articles] PRIMARY KEY CLUSTERED 
(
	[ArticleID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[Advertisements] ADD  CONSTRAINT [DF_Advertisements_Isvalid]  DEFAULT ((1)) FOR [Isvalid]
GO
ALTER TABLE [dbo].[Articles] ADD  CONSTRAINT [DF_Articles_CreateTime]  DEFAULT (getdate()) FOR [CreateTime]
GO

ALTER TABLE [dbo].[Articles] ADD  CONSTRAINT [DF_Articles_IsTop]  DEFAULT ((0)) FOR [IsTop]
GO

ALTER TABLE [dbo].[Articles] ADD  CONSTRAINT [DF_Articles_ReadCount]  DEFAULT ((0)) FOR [ReadCount]
GO

ALTER TABLE [dbo].[Navs] ADD  CONSTRAINT [DF_Navs_Target]  DEFAULT (N'_blank') FOR [Target]
GO

ALTER TABLE [dbo].[Navs] ADD  CONSTRAINT [DF_Navs_Sort]  DEFAULT ((0)) FOR [Sort]
GO
ALTER TABLE [dbo].[Users] ADD  CONSTRAINT [DF_Users_Role]  DEFAULT ((0)) FOR [Role]
GO

ALTER TABLE [dbo].[Articles]  WITH CHECK ADD  CONSTRAINT [FK_Articles_Categories] FOREIGN KEY([CategoryID])
REFERENCES [dbo].[Categories] ([CategoryID])
GO
ALTER TABLE [dbo].[Articles] CHECK CONSTRAINT [FK_Articles_Categories]
GO

ALTER TABLE [dbo].[Articles]  WITH CHECK ADD  CONSTRAINT [FK_Articles_Users1] FOREIGN KEY([UserID])
REFERENCES [dbo].[Users] ([UserID])
GO
ALTER TABLE [dbo].[Articles] CHECK CONSTRAINT [FK_Articles_Users1]
GO
INSERT [dbo].[Users] ([LoginID],[Password],[Role]) VALUES(N'admin',N'111111',1)
INSERT [dbo].[WebConfigs] ([ConfigName], [Value]) VALUES (N'Copyright', N'绿叶网 Copyright &copy;2014 www.leavescn.com')
INSERT [dbo].[WebConfigs] ([ConfigName], [Value]) VALUES (N'Email', N'33612981@qq.com')
INSERT [dbo].[WebConfigs] ([ConfigName], [Value]) VALUES (N'FlashOn', N'1')
INSERT [dbo].[WebConfigs] ([ConfigName], [Value]) VALUES (N'Logo', N'http://www.leavescn.com/Static/Image/Logo.png')
INSERT [dbo].[WebConfigs] ([ConfigName], [Value]) VALUES (N'MetaDescription', N'd')
INSERT [dbo].[WebConfigs] ([ConfigName], [Value]) VALUES (N'MetaKeyword', N'd')
INSERT [dbo].[WebConfigs] ([ConfigName], [Value]) VALUES (N'Notice', N'dfsadfsa')
INSERT [dbo].[WebConfigs] ([ConfigName], [Value]) VALUES (N'SiteAddress', N'http://dev.leavescn.com')
INSERT [dbo].[WebConfigs] ([ConfigName], [Value]) VALUES (N'SiteName', N'绿叶网')
INSERT [dbo].[WebConfigs] ([ConfigName], [Value]) VALUES (N'Statistic', N'<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://"); document.write(unescape("%3Cspan id=''cnzz_stat_icon_5644073''%3E%3C/span%3E%3Cscript src=''" + cnzz_protocol + "v1.cnzz.com/stat.php%3Fid%3D5644073%26show%3Dpic'' type=''text/javascript''%3E%3C/script%3E"));</script>')
INSERT [dbo].[WebConfigs] ([ConfigName], [Value]) VALUES (N'CommentAuto',N'1')

INSERT [dbo].[Categories] ( [CategoryName], [Description]) VALUES ( N'ASP.NET', N'ASP.NET')
INSERT [dbo].[Categories] ( [CategoryName], [Description]) VALUES ( N'数据库', N'数据库')
INSERT [dbo].[Categories] ( [CategoryName], [Description]) VALUES ( N'项目管理', N'项目管理')
INSERT [dbo].[Categories] ( [CategoryName], [Description]) VALUES ( N'Javascript', N'Javascript')


INSERT [dbo].[Articles] ( [Title], [Description], [UserID], [AContent], [CreateTime], [CategoryID], [IsTop], [ReadCount], [Keywords], [CoverImg]) VALUES ( N'程序员不喜欢开放式办公室', N'去年我参观了Adobe位于湾区的办公楼。他们的办公楼真是太夸张了，到处都是很酷的东西，楼顶上有个篮球场，还有风车，以及设计师沙龙。但是，当他们秀他们的开放合作式办公室时，我觉得这不是我想要工作的地方。', 1, N'<p>
	英文原文：<a href="http://adevelopersvoice.com/2014/03/03/i-hate-open-floorplans-it-makes-roger-come-out/" target="_blank">I Hate Open Floorplans</a></p>
<p>
	去年我参观了Adobe位于湾区的办公楼。他们的办公楼真是太夸张了，到处都是很酷的东西，楼顶上有个篮球场，还有风车，以及设计师沙龙。但是，当他们秀他们的开放合作式办公室时，我觉得这不是我想要工作的地方。</p>
<div>
	我有过不同的工作经历，有一次，第一天上班，办公室主任发给我一张表，其中列出了工作相关的必要信息。表格里的信息既简明又条理。但我发现这个表格是发给Roger Smith的。</div>
<div>
	&nbsp;</div>
<div>
	&ldquo;还有什么需要的吗？&rdquo; 主任问我。</div>
<div>
	&nbsp;</div>
<div>
	我说，&rdquo;我的名字不是Roger。&rdquo;</div>
<div>
	&nbsp;</div>
<div>
	&ldquo;噢&hellip;&rdquo; 她有点不知所措，&ldquo;&hellip;嗯&hellip;那你的名字是？&rdquo;</div>
<div>
	&nbsp;</div>
<div>
	然后我收下了写着Roger的工卡，于是Roger就成了我的外号。这个笑话很快就传开了，我也成了公司的名人。偶尔我也开玩笑自称Roger Smith。</div>
<div>
	&nbsp;</div>
<div>
	几年后我娶了我的好太太（她现在是两个孩子的母亲了）。她有时候会在我工作的时候打电话给我，但我的匆匆应付，让她不明白为什么我会&ldquo;生气&rdquo;。我工作的时候像换了一个人似的，跟在家里完全不一样。于是她就用Roger来指代工作中的我。她想不通为什么我在家的时候很温柔，而在工作中的时候打电话给我却觉得我很陌生。她不喜欢Roger。多年里，我跟许多的程序员探讨过这个，许多人都有类似的问题。我们并不是真的很生气，我们只是沉浸在编程中无法自拔。</div>
<div>
	&nbsp;</div>
<div>
	<div>
		进入状态一般至少需要15分钟。如果是写程序，这15分钟内，你要记住你在写什么，然后在脑海中重构算法和数据结构。你同时看到程序现有的样子和做成后的样子。你察觉不到周围发生了什么&hellip;这时电话铃声响起。</div>
	<div>
		&nbsp;</div>
	<div>
		&ldquo;喂？（这个算法似乎有内存泄漏）。嗯，宝贝，我回家时顺便去买那个。（一个指针指向一个指针的指针，谁写的垃圾代码）&hellip;我&hellip;今天&hellip;过得还行&hellip;（我靠，好像是我自己写的&hellip;肯定是在打电话的时候写的吧）。&rdquo;</div>
	<div>
		&nbsp;</div>
	<div>
		所以说，如果你在程序员写程序的时候打电话给他，或者事先不打招呼突然造访，不要奇怪为什么他不太会理睬你，因为他这时还沉醉于代码世界里。也就是说，如果他们每隔15分钟就被打断一次，他们永远也无法进入高效的工作状态。</div>
	<div>
		&nbsp;</div>
	<div>
		那么这跟开放式办公室有几毛钱关系呢？如果我的办公桌正好面对繁忙的走廊，人们在我周围走来走去的时候我无法工作。（不解释，这就是让我不爽。）每次有人走过，我总要抬头看一下门。这已经足够打断我的状态了。无奈我只好将一个书柜放在办公桌前挡住我的视线，这让我看起来有点不合群，但至少我能正常工作。</div>
	<div>
		&nbsp;</div>
	<div>
		<div>
			从我的办公桌往前看，都是木头</div>
		<div>
			&nbsp;</div>
		<div>
			开放式办公室导致员工失去对于自己工作场所的控制。他们再也无法避免打扰，无法保持工作状态。对于他们来说，人来人往，高声谈话等等就像是狂轰滥炸。合作没错，但拥有一间独立的办公室并不影响合作。别人可以到我的办公室来谈事情，这样不会打扰到其他人。互助式办公室只会降低我的工作效率。开放式办公室试图解决一个根本不存在的问题，并且让人们的工作效率更糟糕。</div>
	</div>
</div>
<p>
	&nbsp;</p>', CAST(0x0000A35D017F7749 AS DateTime), 3, 0, 4, N'程序员,办公环境', N'http://www.17gzc.com/Files/images/bl1.jpg')





CREATE TABLE [dbo].[Comments](
	[CommentID] [int] IDENTITY(1,1) NOT NULL,
	[ArticleID] [int] NULL,
	[NickName] [nvarchar](50) NULL,
	[CContent] [nvarchar](500) NULL,
	[TCommentID] [int] NOT NULL,
	[Status] [int] NOT NULL,
	[CreateTime] [datetime] NOT NULL,
	[IP] [nvarchar](50) NULL,
 CONSTRAINT [PK_Comments] PRIMARY KEY CLUSTERED 
(
	[CommentID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Comments]  WITH CHECK ADD  CONSTRAINT [FK_Comments_Articles] FOREIGN KEY([ArticleID])
REFERENCES [dbo].[Articles] ([ArticleID])
GO

ALTER TABLE [dbo].[Comments] CHECK CONSTRAINT [FK_Comments_Articles]
GO

ALTER TABLE [dbo].[Comments] ADD  CONSTRAINT [DF_Comments_TCommentID]  DEFAULT ((0)) FOR [TCommentID]
GO

ALTER TABLE [dbo].[Comments] ADD  CONSTRAINT [DF_Comments_Status]  DEFAULT ((0)) FOR [Status]
GO

ALTER TABLE [dbo].[Comments] ADD  CONSTRAINT [DF_Comments_CreateTime]  DEFAULT (getdate()) FOR [CreateTime]
GO


