硕 士 学 位 论 文 厦门大学博硕士论文摘要库 - corethat contains mvc design pattern,...

17
学校编码:10384 分类号 密级 学号:X2009230372 UDC 基于.NET 和 MVC 的建筑科学研究院 信息管理系统设计与实现 Design and Implementation of Academy of Building Research Information Management System Base on .NET and MVC 王 沣 指导教师姓名: 吴清强副教授 称: 论文提交日期: 2011 10 论文答辩日期: 2011 11 学位授予日期: 2011 12 答辩委员会主席人: 2011 10 厦门大学博硕士论文摘要库

Upload: others

Post on 26-Sep-2020

15 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 硕 士 学 位 论 文 厦门大学博硕士论文摘要库 - COREthat contains MVC design pattern, Entity Framework technique and etc. After providing the theoretical basis of this

学校编码:10384 分类号 密级

学号:X2009230372 UDC

硕 士 学 位 论 文

基于.NET 和 MVC 的建筑科学研究院

信息管理系统设计与实现

Design and Implementation of Academy of Building Research

Information Management System Base on .NET and MVC

王 沣

指导教师姓名: 吴 清 强 副 教 授

专 业 名 称: 软 件 工 程

论文提交日期: 2 0 1 1 年 1 0 月

论文答辩日期: 2 0 1 1 年 1 1 月

学位授予日期: 2 0 1 1 年 1 2 月

答辩委员会主席:

评 阅 人:

2011 年 10 月

厦门

大学

博硕

士论

文摘

要库

Page 2: 硕 士 学 位 论 文 厦门大学博硕士论文摘要库 - COREthat contains MVC design pattern, Entity Framework technique and etc. After providing the theoretical basis of this

厦门大学博硕士论文摘要库

Page 3: 硕 士 学 位 论 文 厦门大学博硕士论文摘要库 - COREthat contains MVC design pattern, Entity Framework technique and etc. After providing the theoretical basis of this

厦门大学学位论文原创性声明

本人呈交的学位论文是本人在导师指导下,独立完成的研究成

果。本人在论文写作中参考其他个人或集体已经发表的研究成果,均

在文中以适当方式明确标明,并符合法律规范和《厦门大学研究生学

术活动规范(试行)》。

另外,该学位论文为( )课题(组)

的研究成果,获得( )课题(组)经费或实验室的

资助,在( )实验室完成。(请在以上括号内填写课

题或课题组负责人或实验室名称,未有此项声明内容的,可以不作特

别声明。)

声明人(签名):

年 月 日

厦门大学博硕士论文摘要库

Page 4: 硕 士 学 位 论 文 厦门大学博硕士论文摘要库 - COREthat contains MVC design pattern, Entity Framework technique and etc. After providing the theoretical basis of this

厦门大学学位论文著作权使用声明

本人同意厦门大学根据《中华人民共和国学位条例暂行实施办

法》等规定保留和使用此学位论文,并向主管部门或其指定机构送交

学位论文(包括纸质版和电子版),允许学位论文进入厦门大学图书

馆及其数据库被查阅、借阅。本人同意厦门大学将学位论文加入全国

博士、硕士学位论文共建单位数据库进行检索,将学位论文的标题和

摘要汇编出版,采用影印、缩印或者其它方式合理复制学位论文。

本学位论文属于:

( )1.经厦门大学保密委员会审查核定的保密学位论文,

于 年 月 日解密,解密后适用上述授权。

( √ )2.不保密,适用上述授权。

(请在以上相应括号内打“√”或填上相应内容。保密学位论文

应是已经厦门大学保密委员会审定过的学位论文,未经厦门大学保密

委员会审定的学位论文均为公开学位论文。此声明栏不填写的,默认

为公开学位论文,均适用上述授权。)

声明人(签名):

年 月 日

厦门大学博硕士论文摘要库

Page 5: 硕 士 学 位 论 文 厦门大学博硕士论文摘要库 - COREthat contains MVC design pattern, Entity Framework technique and etc. After providing the theoretical basis of this

摘要

I

摘 要

目前在建筑业已广泛开始应用计算机软件进行项目管理,一些建设工程管理

部门建立了覆盖管理业务职能的计算机管理信息系统,对促进建筑业科学管理起

到了良好的激励作用。

本系统是某建筑科研单位 OA 系统的子系统主要实现网站信息管理。本系统

从科研单位实际需求出发,采用 ASP.NET 技术进行 WEB 服务器端的开发。系

统的开发过程中是在.NET Framework 平台上,采用了 MVC 的设计模式,并采

用传统的三层架构,其开发模式有助于提高软件的可移植性和可伸缩性,有助于

提高软件开发人员的生产力和缩短开发周期。

本文首先介绍了设计与开发系统的理论基础,包括 MVC 设计模式、Entity

Framework 技术等。在给出系统理论基础之后,对信息系统做出了需求分析与

详细设计。需求分析为系统设计与实现提供了方向和目标;详细设计部分在对

三层架构研究的基础上,提出开发系统的总体思路,并给出部分功能模块的设

计与实现。接着对系统进行了测试和环境部署。 后论文针对系统进行了分析

和评价,并列出了下一步改进计划。

关键词:MVC;.NET;信息管理系统

厦门大学博硕士论文摘要库

Page 6: 硕 士 学 位 论 文 厦门大学博硕士论文摘要库 - COREthat contains MVC design pattern, Entity Framework technique and etc. After providing the theoretical basis of this

Abstract

II

Abstract

At present, computer software is widely used in building industry to manage

projects. And some construction management departments have established

computer-based management information system covering the functions of managing

business which plays an incentive role in promoting the scientific management in

building industry.

This system is the OA sub-system of a certain construction research institute and

its main purpose is to manage website information. Combined with the author’s work

experience and based on the actual demands, this system adopts ASP.NET technique

to conduct the development of WEB server end. Based on the platform of NET

Framework, the development process of this system adopts the design pattern of

MVC and traditional three-tier structure. Its design pattern is helpful to reduce the

portability and scalability of software and improve the network performance, and

besides, it can also improve software developers’ work capacity and reduce

development cycle.

This paper first introduces the theoretical basis of design and development system

that contains MVC design pattern, Entity Framework technique and etc. After

providing the theoretical basis of this system, it makes a demand analysis and specific

design of the information system. Demand analysis provides a direction and goal for

the design and achievement of the system; based on a research on three-tier structure,

specific design offers an overall plan for system development and provides the design

and achievement of department functional modules. And then it carries out the

environment deployment and a test on the system. At last, this paper gives an analysis

and evaluation about the system and clearly lists the next improvement plan.

KeyWords: MVC ;.Net; Information Management System

厦门大学博硕士论文摘要库

Page 7: 硕 士 学 位 论 文 厦门大学博硕士论文摘要库 - COREthat contains MVC design pattern, Entity Framework technique and etc. After providing the theoretical basis of this

目录

III

目 录

第一章 绪论 .............................................................................................................. 1

1.1 研究课题的背景和意义 ................................................................................ 1

1.2 国内外发展概况 ............................................................................................ 1

1.2.1 国外发展概况 ..................................................................................... 1

1.2.2 国内发展概况 ..................................................................................... 2

1.3 论文组织结构 ................................................................................................ 2

第二章 系统相关理论与技术概述 .................................................................... 3

2.1 MVC 模式基本原理 ....................................................................................... 3

2.2 ASP.NET MVC 框架 ...................................................................................... 4

2.2.1 ASP.NET MVC 框架简介 .................................................................... 4

2.2.2 ASP.NET MVC 框架优点 .................................................................... 6

2.3 ADO.NET Entity Framework ....................................................................... 6

2.4 LINQ 简介 ..................................................................................................... 7

2.5 JQuery ........................................................................... 错误!未定义书签。

2.6 本章小结 ........................................................................................................ 9

第三章 系统的需求分析 .................................................................................... 10

3.1 背景 .............................................................................................................. 10

3.2 业务需求 ...................................................................................................... 10

3.3 性能需求 ...................................................................................................... 11

3.4 功能需求 ...................................................................................................... 11

3.5 其它需求 ...................................................................................................... 12

3.6 用户平台要求 .............................................................................................. 12

3.7 建立系统用例模型 ...................................................................................... 12

3.7.1 角色的确定 ....................................................................................... 13

3.7.2 创建用例 ........................................................................................... 13

3.7.3 建立用例图 ....................................................................................... 13

厦门大学博硕士论文摘要库

Page 8: 硕 士 学 位 论 文 厦门大学博硕士论文摘要库 - COREthat contains MVC design pattern, Entity Framework technique and etc. After providing the theoretical basis of this

目录

IV

3.8 系统流程分析 .............................................................................................. 15

3.9 操作流程图分析 .......................................................................................... 16

3.10 系统结构分析 ............................................................................................ 17

3.11 本章小结 ..................................................................................................... 17

第四章 系统设计与实现 .................................................................................... 18

4.1 系统的总体架构 .......................................................................................... 18

4.1.1 系统层次划分 ................................................................................... 18

4.1.2 系统职责划分 ................................................................................... 18

4.1.3 系统模块划分及交互设计 ............................................................... 18

4.2 系统实体类设计 .......................................................................................... 20

4.3 系统接口的设计 .......................................................................................... 21

4.4 系统采用的设计模式 .................................................................................. 22

4.4.1 仓储模式 ......................................................................................... 22

4.4.2 工作单元模式 ................................................................................. 23

4.4.3 依赖倒置原则 ................................................................................. 23

4.5 角色管理实现 .............................................................................................. 26

4.6 系统日志记录的实现 .................................................................................. 30

4.7 系统表单数据验证 ...................................................................................... 30

4.8 导出和导入 Excel 文档实现 ....................................................................... 33

4.8.1 导出 Excel 的实现 ............................................................................ 33

4.8.2 导入 Excel 的实现 ............................................................................ 36

4.9 网站首页的实现 .......................................................................................... 38

4.10 匿名客户文件上传的实现 ........................................................................ 39

4.11 列表页的实现 ............................................................................................. 42

4.12 高级检索的实现 ........................................................................................ 44

4.13 本章小结 .................................................................................................... 45

第五章 测试与部署 .............................................................................................. 46

5.1 功能测试 ...................................................................................................... 46

厦门大学博硕士论文摘要库

Page 9: 硕 士 学 位 论 文 厦门大学博硕士论文摘要库 - COREthat contains MVC design pattern, Entity Framework technique and etc. After providing the theoretical basis of this

目录

V

5.1.1 搜索功能测试用例 ........................................................................... 46

5.1.2 翻页功能测试用例 ........................................................................... 48

5.2 性能测试 ...................................................................................................... 50

5.3 系统环境的部署 .......................................................................................... 50

5.4 本章小结 ...................................................................................................... 54

第六章 总结与展望 .............................................................................................. 55

6.1 论文总结 ...................................................................................................... 55

6.2 工作展望 ...................................................................................................... 55

参考文献 ................................................................................................................... 56

致 谢 .......................................................................................................................... 57

厦门大学博硕士论文摘要库

Page 10: 硕 士 学 位 论 文 厦门大学博硕士论文摘要库 - COREthat contains MVC design pattern, Entity Framework technique and etc. After providing the theoretical basis of this

Contents

VI

Contents

Chapter 1 Introduction.........................................................................................1

1.1 Background and Significance ..................................... 错误!未定义书签。

1.2 Overview of Domestic and Foreign .............................................................. 1

1.2.1 Overview of the Foreign.......................................................................1

1.2.2 Overview of Domestic……….......…………………………………...2

1.2 Organization ................................................................................................... 2

Chapter 2 Correlation Theory and Technology...........................................3

2.1 MVC Pattern Fundamental Principle .......................................................... 3

2.2 ASP.NET MVC Framework .......................................................................... 4

2.2.1 ASP.NET MVC Framework Introduction .............................................4

2.2.2 ASP.NET MVC Framework Advantages..............................................6

2.3 ADO.NET Entity Framework ....................................................................... 6

2.4 LINQ Introduction ........................................................................................ 7

2.5 JQuery ............................................................................................................. 8

2.6 Summary ......................................................................................................... 9

Chapter 3 System Requirements Analysis...................................................10

3.1 Background .................................................................................................. 10

3.2 Business Requirements ................................................................................ 10

3.3 Performance Requirements ........................................................................ 10

3.4 Functional Requirements ............................................................................ 11

3.5 Other Requirements .................................................................................... 12

3.6 User Platform Requirements ...................................................................... 12

3.7 System Use Case Model ............................................................................... 13

3.7.1 Determine the Role............................................................................13

3.7.2 Case Design.........................................................................................13

3.7.3 Use Case Diagram...............................................................................13

3.8 System Flow Analysis ................................................................................... 15

厦门大学博硕士论文摘要库

Page 11: 硕 士 学 位 论 文 厦门大学博硕士论文摘要库 - COREthat contains MVC design pattern, Entity Framework technique and etc. After providing the theoretical basis of this

Contents

VII

3.9 Operation Flow Chart Analysis .................................................................. 16

3.10 System Structure Analysis ......................................................................... 17

3.11 Summary ..................................................................................................... 17

Chapter 4 System Design and Implementation..........................................18

4.1 Overall System Architecture ....................................................................... 18

4.1.1 System-Level Classification................................................................18

4.1.2 System Division of Responsibilities...................................................18

4.1.3 System Module Division.....................................................................18

4.2 System Entity Class Design ......................................................................... 20

4.3 System Interface Design .............................................................................. 21

4.4 System Design Patterns ............................................................................... 22

4.4.1 Repository.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22

4.4.2 Unit of Work................................................................23

4.4.3 Dependence Inversion Principle..........................................................24

4.5 Role Management Implementation ............................................................ 26

4.6 System Log Implementation ....................................................................... 30

4.7 System Form Data Validation ..................................................................... 30

4.8 Export and Import Excel Document Implementation .............................. 33

4.8.1 Export Excel Implementation..............................................................33

4.8.2 Import Excel Implementation..............................................................36

4.9 HomePage Implementation ......................................................................... 38

4.10 Customer Upload Files Implementation .................................................. 39

4.11 ListPage Implementation .......................................................................... 42

4.12 Advanced Search Implementation............................................................ 44

4.13 Summary ..................................................................................................... 45

Chapter 5 Test and Deployment.......................................................................46

5.1 Functional Test ............................................................................................. 46

5.1.1 Search Function Test...........................................................................46

5.1.2 Page Function Test..............................................................................48

厦门大学博硕士论文摘要库

Page 12: 硕 士 学 位 论 文 厦门大学博硕士论文摘要库 - COREthat contains MVC design pattern, Entity Framework technique and etc. After providing the theoretical basis of this

Contents

VIII

5.2 Performance Test ......................................................................................... 50

5.3 Deployment System Environment .............................................................. 50

5.4 Summary ....................................................................................................... 54

Chapter 6 Conclusions and Future Work.....................................................55

6.1 Conclusions ................................................................................................... 55

6.2 Future Work ................................................................................................. 55

References...................................................................................................................56

Acknowledgements.....................................................................................................57

厦门大学博硕士论文摘要库

Page 13: 硕 士 学 位 论 文 厦门大学博硕士论文摘要库 - COREthat contains MVC design pattern, Entity Framework technique and etc. After providing the theoretical basis of this

第一章 绪论

1

第一章 绪论

1.1 研究课题的背景和意义

建筑业属于传统产业,用信息化等高新技术改造传统产业,是传统产业持续

发展的必由之路,是建筑业实现跨越式发展的重要途径。企业内部的信息技术人

员和业务人员互不熟悉对方业务,造成企业内部信息不交流,尽管目前专业应用

软件已十分普及,但没能真正形成企业各类信息统一使用的信息管理系统。

在传统的建筑业企业管理模式中,项目上各种信息的存储主要是基于表格或

单据等纸面形式,信息的加工和整理完全由大量的手工计算来完成,信息的交流

则绝大部分依赖于人与人之间的手工传递甚至口头传递,信息的检索则完全依赖

于对文档资料的翻阅和查看。传统的项目管理模式在速度、可靠性以及经济可行

性等方面明显地限制了建筑企业在市场经济激烈的竞争环境中的可持续生存和

发展的能力。

某建筑科学研究院是一所集建筑科研、建筑质量检测及建筑设计等业务活动

的综合性科研单位。各式的文档、图纸、等纸质资料穿插于各项业务中,实现信

息化管理非常迫切。所以本论文结合了单位对信息管理系统的需求,实现了其网

站信息管理系统的开发。在开发过程中采用了三层架构和 MVC 设计模式,为系

统的开发和维护提供了很好的灵活性和可管理性。 后以论文的形式详细介绍信

息管理系统的实现过程。

1.2 国内外发展概况

1.2.1 国外发展概况

国外十分重视信息技术在建筑业中的应用,并为建筑业的信息化奠定了坚实

的基础。美国斯坦福大学早在 1989 年就成立了跨土木工程学科和计算机学科的

研究中心 CIFE(Center for Integrated Facility Engineering)。十多年来,该研究中

心得到充分的科学基金和企业赞助,在建筑业信息化方面做了大量前瞻性的工

作,对美国乃至世界在这方面的研究起到了带头作用,也为工程项目的信息化管

理和企业自身的信息化建设打下了坚实的基础。发达国家和地区大多数已经建成

厦门大学博硕士论文摘要库

Page 14: 硕 士 学 位 论 文 厦门大学博硕士论文摘要库 - COREthat contains MVC design pattern, Entity Framework technique and etc. After providing the theoretical basis of this

基于.NET 和 MVC 的建筑科学研究院信息管理系统设计与实现

2

了较为完善的电子政务系统,建筑业的有关企业和个人都可以从因特网上获取必

要的信息,办理相关的主要手续。

1.2.2 国内发展概况

“九五”以来,我国建筑业信息化得到较快发展,信息网络建设开始起步,

信息技术应用得到推广。在企业自身的信息管理建设方面,信息技术在建筑业得

到广泛应用。勘察设计行业 CAD 技术应用得到普及,甲乙级设计单位计算机出

图率达到 100%;计算机辅助施工技术(CAC)已在建筑施工领域得到应用;房

地产交易、工程招投标、造价、质量检测等行业,普遍实现了计算机管理,并向

网络化迈进。目前,我国建筑业信息技术的应用虽已取得了一定的成绩,尚未形

成建筑企业的领导者真正认识到企业的竞争力日益与企业信息化程度密切相关

的重要性,同时也没完全认识到与发达国家相比还有一定的差距,与我国建筑业

发展的速度和要求相比相距甚远,还有很长的路要走。

1.3 论文组织结构

本论文共分为六章,论文首先介绍了计算机信息管理系统在建筑行业的应

用、重要性和发展趋势,引出了论文所做的主要工作内容。紧接着论文简单介绍

了毕业设计项目中所用到的各项技术,比如 MVC 设计模式,持续集成技术。然

后论文具体介绍了信息系统的架构和具体实现,分析了设计原则、设计模式在系

统当中的应用。 后论文通过截图展示了系统的运行结果。

论文结论具体安排如下:

第一章 简单介绍了信息管理系统在建筑业中现状和本系统的应用背景。

第二章 简要介绍了系统中所使用的主要开发技术的特点和优势。

第三章 详细介绍了系统的需求分析。

第四章 分模块详细介绍了信息系统的设计与实现。

第五章 详细展示信息系统的测试和环境部署。

第六章 后论文总结了毕业设计所做的工作,并进行了工作展望。

厦门大学博硕士论文摘要库

Page 15: 硕 士 学 位 论 文 厦门大学博硕士论文摘要库 - COREthat contains MVC design pattern, Entity Framework technique and etc. After providing the theoretical basis of this

第二章 系统相关理论与技术概述

3

第二章 系统相关理论与技术概述

2.1 MVC 模式基本原理

MVC (Model-View-Controller),即把一个应用的输入、处理、输出流程按照

Model,View,Controller 的方式进行分离,这样一个应用被分成三个层—模型层、

视图层、控制层,其三层之间的关系和功能如图 2-1 所示。

图 2-1 MVC 组件类型关系和功能图

MVC 设计模式的典型流程为:首先 Controller 接收用户的请求,并决定应

该调用哪个 Model 来进行处理,然后 Model 用业务逻辑来处理用户的请求并返

回数据, 后 Controller 用相应的 View 格式化 Model 返回的数据,并通过表示

层呈现给用户。

控制层(Controller)可以理解为从用户接收请求,将模型与视图匹配在一起,

共同完成用户的请求。划分控制层的作用也很明显,它清楚地告诉我们,它就是

一个分发器,选择什么样的模型,选择什么样的视图,可以完成什么样的用户请

求。控制层并不做任何的数据处理。例如,用户点击一个链接,控制层接受请求

后,并不处理业务信息,它只把用户的信息传递给模型,告诉模型做什么,选择

符合要求的视图返回给用户。因此一个模型可能对应多个视图,一个视图可能对

应多个模型。

模型层(Model)就是业务流程/状态的处理以及业务规则的制定。业务流程的

处理过程对其它层来说是黑箱操作,模型接受视图请求的数据,并返回 终的处

理结果。业务模型的设计可以说是 MVC 主要的核心,必须能够满足大多数客

厦门大学博硕士论文摘要库

Page 16: 硕 士 学 位 论 文 厦门大学博硕士论文摘要库 - COREthat contains MVC design pattern, Entity Framework technique and etc. After providing the theoretical basis of this

基于.NET 和 MVC 的建筑科学研究院信息管理系统设计与实现

4

户的需求,包括保证应用程序各组件的事务整合、维护并快速获取应用数据,支

持事务工作流的协调以及在已有应用程序中集成新的应用组件等。MVC 并没有

提供模型的设计方法,而只告诉我们应该组织管理这些模型,以便于模型的重构

和提高重用性。

视图层(View)代表用户交互界面,对于 Web 应用来说,可以概括为 HTML

界面,但有可能为 XHTML,XML 和 Applet。随着应用的复杂性和规模性,界

面的处理也变得具有挑战性。一个应用可能有很多不同的视图,MVC 设计模式

对于视图的处理仅限于视图上数据的采集和处理,以及用户的请求,而不包括在

视图上的业务流程的处理。业务流程的处理交予模型(Model)处理。

2.2 ASP.NET MVC 框架

2.2.1 ASP.NET MVC 框架简介

ASP.NET MVC Framework 是 MVC 模式的一套实现,并且内置了开发 web

应用的能力,ASP.NET MVC 框架如图 2-2 所示。

图 2-2 ASP.NET MVC 框架

Model:是程序的领域逻辑。通常来说,Model 的状态会存储在数据库里。

在开发一个 n 层应用程序中,它是介于领域模型和商业逻辑之间的中间层。

厦门大学博硕士论文摘要库

Page 17: 硕 士 学 位 论 文 厦门大学博硕士论文摘要库 - COREthat contains MVC design pattern, Entity Framework technique and etc. After providing the theoretical basis of this

Degree papers are in the “Xiamen University Electronic Theses and Dissertations Database”. Fulltexts are available in the following ways: 1. If your library is a CALIS member libraries, please log on http://etd.calis.edu.cn/ and submitrequests online, or consult the interlibrary loan department in your library. 2. For users of non-CALIS member libraries, please mail to [email protected] for delivery details.

厦门大学博硕士论文摘要库