Design of Car Rental Company CIS Database System

xiaoxiao2021-03-06  54

Design of Car Rental Company CIS Database System

Chinese summary

According to network information: my country currently has more than 30 million citizens with driver's licenses, and this quantity is still rising in a certain proportion. We have learned that there are many people who are temporarily can't afford in the short term, but most people in them need temporary vehicles, and there are also temporary car rental capabilities. Therefore, business lease has extremely huge Market demand. As a car rental company, it is necessary to build a database system that suits you developed and serves to improve your business, and can update customers, suppliers, and market changes in time.

table of Contents

I. Detailed description of demand analysis

Second, the database design

1.e-r diagram

2. Precise process

3.SQL implementation

Third, database application development

Block diagram of flowchart or functional composition

2. Main module introduction

1) Module function

2) Module flow chart

3. Application development environment: language, database

4. Process development process

Fourth, the operating instructions

Five, reference

I. Detailed description of demand analysis

China Car Lease In 80 years China International Trust Investment Co., Ltd. is a batch of automobiles in Beijing for nearly two decades. Car rentals have also developed from foreign affairs activities and tourism services to services for ordinary people. More and more companies in investing in cars, there are basically car rental companies in large and medium-sized cities in the country, and the total number of vehicles used for lease is constantly expanding.

According to network information: my country currently has more than 30 million citizens with driver's licenses, and this quantity is still rising in a certain proportion. We have learned that there are many people who are temporarily can't afford in the short term, but most people in them need temporary vehicles, and there are also temporary car rental capabilities. Therefore, business lease has extremely huge Market demand.

Many car rental companies are optimistic about the prospects of the car rental market, such as Beijing today's new concept, Zhejiang Unicom, Shanghai Anji Third Company, etc. However, due to the large value of the car, the car rental company takes cautious practices in the choice of car rental customers, and takes a stricter qualification examination for customers. At present, individuals want to rent a car, rental companies generally ask customers to provide account books, driver's licensing, ID cards where the leasing company is located; if they rent a car, ask for a copy of the business license registered in the landing company where the lease company is required, the legal representative ID card, driver's license, etc., as necessary, request customers to provide corresponding guarantees.

To this end, it is necessary to build a database system that suits your own development and service to improve your business, and can update customer, supplier, and market changes in time. According to the status quo of China's car rental and the development experience of international car rental, China's car rental enterprises will take a large-scale and networked road.

DBS013G car rental company clearly recognizes these backgrounds and conditions, and we need to design our own CIS to meet the competition of the market.

As far as the idea:

The entire CIS system is divided into four parts: customer information, service information, resource information, supplier information.

For customer information, what we need to understand includes: customer name (or unit name), home address (or unit address), contact telephone and electronic mailbox.

For service information, it should be said: models, car rental dates, car dates, price queries.

The company's internal resources, we feel that there can be the following components: models, car conditions, car rental price, car driving kilometers.

And the supplier's information includes the manufacturer name, contact number, model and number of car.

Second, the database design

The following is three phased reports (E-R diagram, accuracy process, SQL implementation)

1.e-r diagram, some attributes and names have changed in later database design.

2. Mode refinement and paradigm process:

According to the entity set and relationship map in the E-R figure, the following relationship modes are initially established:

1) .Clients (CID: INT, CNAME: String, Caddress: String, CPHONE: STRING, Email: String, ID_Number: String) Simplified: r = (i, n, a, p, e, d)

Function dependent set f = (i-> Naped)

The conditions of BCNF have been met.

2) .cars (CSN: INT, TYPE: STRING, State: String, Mile: int, Price: int)

Simplified: r = (C, T, S, M, P)

Function dependent set f = (C-> TSMP, TS-> P)

The TS-> P does not satisfy the BCNF conditions, decomposing (C, T, S, M) and (T, S, P), satisfying the conditions of BCNF.

3). Rroviders (PNAME: String, PPHONE: STRING, PCOUNT: INT, PTYPE: STRING)

Simplified: r = (n, p, c, t)

The function is dependent on F = (N-> PCT) to meet the conditions of BCNF.

4) .ReServes (CID: INT, CSN: INT, BDATE: DATETIME, RDATE: DATETIEM)

Simplified: r = (i, s, b, r)

The function is dependent on F = (IS-> Br) to meet the conditions of BCNF.

Therefore, get the following five relationship modes:

1) .Clients (CID: INT, CNAME: String, Caddress: String, CPHONE: STRING, Email: string, id_number: string)

2) .cars (CSN: Int, Type: string, state: string, mile: int)

3). Rroviders (PNAME: String, PPHONE: STRING, PCOUNT: INT, PTYPE: STRING)

4) .ReServes (CID: INT, CSN: INT, BDATE: DATETIME, RDATE: DATETIEM)

5). Price (Type: string, state: string, price: int)

According to the above five relational patterns, a database TAXI is created in SQL Server and a table is created for each relationship mode.

They are: Client_info, Car_info, Provider_info, Reserve_info, Price_Info.

3.SQL statement

SQL files exported from SQL Server:

/ ****** Object: Database Taxi Script Date: 2004-9-11

14:41:45

****** /

If exists (select name from master.dbo.sysdatabases where name = n'taxi))

DROP DATABASE [TAXI]

Go

Create Database [TAXI] ON (Name = N'taxi_data ', filename = N'c: / program files / microsoft SQL Server / MSSQL $ INCE1 / DATA / TAXI_DATA.MDF', SIZE = 2, FileGRowth = 10%)

Log

On

(Name = N'taxi_log ', filename = N'c: / program files / microsoft SQL Server / MSSQL $ INCE1 / DATA / TAXI_LOG.LDF', SIZE = 1, FileGrowth = 10%)

Collate Chinese_PRC_CI_AS

Go

EXEC SP_DBOPTION N'TAXI ', N'AUTOCLOSE', N'TRUE '

Go

EXEC SP_DBOPTION N'TAXI ', N'BULKCOPY', N'FALSE'GO

Exec sp_dboption n'taxi ', n'trunc. log', n'true '

Go

EXEC SP_DBOPTION N'TAXI ', N'TRN Page Detection', N'true '

Go

Exec sp_dboption n'taxi ', n'read only', n'false '

Go

EXEC SP_DBOPTION N'TAXI ', N'DBO USE', N'FALSE '

Go

EXEC SP_DBOPTION N'TAXI ', N'SINGLE', N'FALSE '

Go

Exec sp_dboption n'taxi ', n'autoshrink', n'true '

Go

Exec sp_dboption n'taxi ', n'si null default', n'false '

Go

Exec sp_dboption n'taxi ', N'Recursive Triggers', N'False'

Go

EXEC SP_DBOPTION N'TAXI ', N'si Nulls', N'FALSE'

Go

Exec sp_dboption n'taxi ', n'concat null yields null', n'false '

Go

Exec sp_dboption n'taxi ', N'cursor Close On Commit', N'False '

Go

Exec sp_dboption n'taxi ', N'Default to Local Cursor', N'FALSE '

Go

EXEC SP_DBOPTION N'TAXI ', N'QUOTED Identifier', N'FALSE '

Go

EXEC SP_DBOPTION N'TAXI ', N'SI WARNINGS', N'FALSE '

Go

Exec sp_dboption n'taxi ', N'Auto Create Statistics', N'true'

Go

Exec sp_dboption n'taxi ', N'Auto Update Statistics', N'true'

Go

Use [TAXI]

Go

if EXISTS (Select * from dbo.sysObjects where id = Object_id (n '[dbo]. [fk_reserve_info_car_info]') And ObjectProperty (ID, n'isforeignkey) = 1)

Alter Table [DBO]. [RESERVE_INFO] DROP continRAint fk_reserve_info_car_info

Go

if exists (select * from dbo.sysobjects where id = object_id (N '[dbo]. [FK_reserve_info_client_info]') and OBJECTPROPERTY (id, N'IsForeignKey ') = 1) ALTER TABLE [dbo]. [reserve_info] DROP CONSTRAINT FK_reserve_info_client_info

Go

/ ****** Object: table [dbo]. [Reserve_info] script date: 2004-9-11

14:41:48

****** /

If EXISTS (Select * from dbo.sysObjects where id = Object_id (n '[dbo]. [reserve_info]') And ObjectProperty (ID, n'usertable ') = 1)

DROP TABLE [DBO]. [reserve_info]

Go

/ ****** Object: table [dbo]. [Car_info] script date: 2004-9-11

14:41:48

****** /

if EXISTS (Select * from dbo.sysObjects where id = Object_id (n '[dbo]. [car_info]') And ObjectProperty (ID, n'uSERTABLE ') = 1)

Drop Table [DBO]. [car_info]

Go

/ ****** Object: table [dbo]. [Client_info] script date: 2004-9-11

14:41:48

****** /

if EXISTS (Select * from dbo.sysObjects where id = Object_id (n '[dbo]. [client_info]') And ObjectProperty (ID, n'uSERTABLE ') = 1)

DROP TABLE [DBO]. [client_info]

Go

/ ****** Object: table [dbo]. [Price_info] script date: 2004-9-11

14:41:48

****** /

If EXISTS (Select * from dbo.sysObjects where id = Object_id (n '[dbo]. [price_info]') And ObjectProperty (ID, n'uSERTABLE ') = 1)

Drop Table [DBO]. [price_info]

Go

/ ****** Object: table [dbo]. [Provider_info] Script date: 2004-9-11

14:41:48

****** /

if EXISTS (Select * from dbo.sysObjects where id = Object_id (n '[dbo]. [provider_info]') And ObjectProperty (ID, n'uSERTABLE ') = 1)

DROP TABLE [DBO]. [provider_info]

Go

/ ****** Object: table [dbo]. [Car_info] script date: 2004-9-11

14:41:50

****** /

Create Table [DBO]. [Car_info] ([CSN] [INT] NOT NULL,

[TYPE] [25) Collate Chinese_PRC_CI_AS Not Null,

[state] [char] (10) Collate chinese_prc_ci_as not null,

[Mile] [INT] Not null

) On [primary]

Go

/ ****** Object: table [dbo]. [Client_info] script date: 2004-9-11

14:41:51

****** /

Create Table [DBO]. [Client_info]

[CID] [INT] NOT NULL,

[varchame] [varchar] (20) collate chinese_prc_ci_as not null,

[Caddress] [varchar] (100) Collate Chinese_prc_ci_as not null,

[CPHONE] [VARCHAR] (20) Collate Chinese_prc_ci_as NOT NULL,

[email] [varchar] (100) collate chinese_prc_ci_as not null,

[ID_NUMBER] [varchar] (20) Collate Chinese_prc_ci_as not null

) On [primary]

Go

/ ****** Object: table [dbo]. [Price_info] script date: 2004-9-11

14:41:51

****** /

Create Table [DBO]. [Price_info]

[TYPE] [25) Collate Chinese_PRC_CI_AS Not Null,

[state] [char] (10) Collate chinese_prc_ci_as not null,

[price] [int] Not null

) On [primary]

Go

/ ****** Object: table [dbo]. [Provider_info] Script date: 2004-9-11

14:41:52

****** /

Create Table [DBO]. [Provider_info]

[PNAME] [25) Collate Chinese_PRC_CI_AS Not Null,

[PPHONE] [20) collate Chinese_prc_ci_as not null,

[pcount] NOT NULL,

[ptype] [char] (10) Collate chinese_prc_ci_as not null

) On [primary]

Go

/ ****** Object: table [dbo]. [Reserve_info] script date: 2004-9-11

14:41:52

****** /

Create Table [DBO]. [RESERVE_INFO] (

[CID] [INT] NOT NULL,

[csn] [int] Not null,

[bdate] [datetime] NOT NULL,

[rdate] [datetime] NOT NULL

) On [primary]

Go

Alter Table [DBO]. [Car_info] with nocheck add

Constraint [PK_CAR_INFO] Primary Key Clustered

(

[csn]

) On [primary]

Go

Alter Table [DBO]. [Client_info] with nocheck addconstraint [pk_client_info] Primary Key Clustered

(

[CID]

) On [primary]

Go

Alter Table [DBO]. [Reserve_info] with nocheck add

ConsTRAINT [PK_RESERVE_INFO] Primary Key Clustered

(

[csn]

) On [primary]

Go

Alter Table [DBO]. [Price_info] with nocheck add

ConsTRAINT [ix_price_info] unique nonclustered

(

[Type],

[state]

) On [primary]

Go

Create Index [ix_car_info] on [dbo]. [Car_info] ([type], [state]) on [primary]

Go

Alter Table [DBO]. [RESERVE_INFO] Add

Constraint [fk_reserve_info_car_info] Foreign Key

(

[csn]

References [dbo]. [Car_info] (

[csn]

),

Constraint [fk_reserve_info_client_info] Foreign Key

(

[CID]

References [dbo]. [Client_info] (

[CID]

)

Go

Third, database application development

1. Flow chart or functional composition block diagram

According to the needs of the system, four parts of the entire system are divided into five modules. Among them, customer information, resource information, supplier information, separately as a module, service information is decomposed into order information and price query two modules, each module separately operates a table in the database. The workflow chart of the entire system is as follows:

Start

end

Management main interface

Vehicle Information

Customer Information

order information

price information

Supply information

Whether to quit

Yes

no

After the program starts, enter the main interface of the program. In the main interface of the program, you can choose to enter the respective individual modules to perform corresponding information query and management. In each individual module, you just entered all information, you can insert, delete, modify, and queries according to the needs of the information.

2. Main module introduction

1) The system is divided into five main modules. Although the content of the five modules is different, their functions and operations are similar:

Customer information is used to manage the information of the registered customer, and the customer information can be deleted according to the user's registration, or modify it.

The vehicle information is used to manage the information of the company's existing taxi. After purchasing new vehicles, you can add the vehicle information. After the vehicle is scrapped, you can delete relevant information, and you can modify the vehicle mileage of the vehicle.

Order Information When you register a customer online or otherwise, add it to the database, you can delete, edit the wrong order information.

The price information module does not provide a lot of functions, and can only query the price, no additional deletion is available.

The supplier module can display all supplier information, you can complete the functions such as adding, deleting, editing, query.

2) The flowchart of each module is shown below:

Enter the module

Show all records

Select a record

Delete Record

edit

Increasing record

Modify record

Inquire

Show results

Reread database

Exit module

drop out

Yes

Yes

Yes

Yes

Yes

no

no

no

no

no

Yes

no

3. Application Development Environment: Language, Database application uses Visual C 6.0 development, the form of dialog boxes, and the background database uses SQL Serve 2000. Developing databases with Visual C is simple, flexible, visiting speed, good scalability, access to different types of databases. Database applications for database applications with Visual C 6.0, there are five database access technology: ODBC API, MFC ODBC, DAO, OLE DB, and ADO technology.

We use ADO technology to operate in the program. ADO is currently a popular client database programming technology in a Windows environment. ADO is an advanced programming interface established on the underlying technology of OLE DB, so it has a powerful data processing function (handling various types of data sources, distributed data processing, etc.) and extremely simple, easy to use Programming interfaces and thus have been widely used.

ADO technology provides database access technology, like DAO, but it provides more flexible techniques than DAO and RDO (remote object access) and a more wide application. ADO technology simplifies OLE DB operation, and a large number of COM interfaces are used in the OLE DB program, while ADO encapsulates these COM interfaces, so ADO is a high-level access technology.

The following is a programming model of the ADO program:

Initialize the COM library, introduce the ADO library definition file.

Connect the required database with the Connection object.

Use the establishment of a good connection, execute the SQL command through the Connection, Command object, or use the Recordset object to obtain the result set.

Transaction processing using the Connection object.

Close the connection, release the object.

In the ADO programming model, the Connection object, the Command object, and the Recordset object are three most important ADO objects. Where the Connection object represents the open, contact with the data source, the only session representing the data source. Before using the ADO to access the database, you must first create a connection object before you open to the database. Command objects are used to perform SQL statement commands, especially in the executed SQL statement, is performed, which is more convenient to perform with a Command object. The Recordset object is used to obtain the result set after the database operation, or the result returns the result to the database through the increase, delete and modification of the result set.

Although there are no MFC classes that can be used with ADO object design applications, there are some ADO support classes to easily use ADO objects. Use the smart pointer _ConnectionPtr, _RecordSetPtr, etc. It is convenient to create an ADO object such as the connection object, record the set object.

The ADO is connected to the SQL Server database. SQL Server 2000 is the latest version of the latest version of Microsoft. After experiencing the two versions of SQL Server 6.5 and 7.0, Microsoft finally started to develop to large-scale business sectors. I remember that in the previous article, I will locate it into small and medium-sized applications, this feeling has continued to 2000 editions. This is actually a kind of misunderstanding. For a long time in the past, Microsoft has invited the world's best database experts and specializing in the amount of information, which is an unprecedented geographic information system. With strong performance and functional support, with its own use of ease of use, SQL Server can be said to be a good choice for developers to develop database development.

4. Program development process

The ADO object is used directly in the program so that access to the database is more easily controlled. (1) Configure the data source to ensure that the program can access the database correctly.

(2) Creating a dialog-based project in the VC. Import the ADO dynamic link library file in the corresponding header file and initialize the COM environment in the initialization function of the program.

(3) Add a new dialog to add a corresponding member variable for the newly generated dialog class, such as the ADO object M_PConnection, M_PRecordset, open the connection in the initialization function of the dialog, and obtain the result set.

(4) In the new dialog box, add controls and add event handlers to each control to complete the operation of the corresponding database.

(5) Add a control function to the main dialog, call the dialog module just now.

(6) Compile execution, process the error until correct.

(7) After each module is added, repeat (3), (4), (5), (6)

(8) Later, in order to verify the database connection, a new dialog is added to enter the username and password for entering the SQL Server server when entering the database.

Fourth, the operating instructions

1. This program compiles in Visual C 6.0 through the Window XP environment.

2. First configure the ODBC data source, set the username and password accessed by SQL Server. Before running, make sure the required database has been added to the ODBC Data Source System DSN, named TAXI. The program is originally connected to the username and password of SQL Server, but considers the versatility of the program to different database settings, and the username and password of the SQL Server database are required to open the SQL Server database when opening each module dialog.

3. The correctness of the database and the corresponding table must be guaranteed. The problem now encountered is the SQL script that can be guided by SQL Server's SQL Export Wizard, can only generate the corresponding database and table. However, there is no data record in the table, which is to pay attention to when running the program.

4. The corresponding processing for the error is lacking in the program. For various reasons, various operations involving the database, there must be a variety of runtime errors. For example, the username and password of the input database are incorrect, and errors cannot be connected correctly. There is also a runtime error that can occur when adding a record, deleting record, and modifying a record in a database. Due to the simplification of the program, the processing of these errors is not very good. This should be noted when running the program.

5. The query of each module dialog is only required to enter the WHERE clause part of the SQL statement when query. Taking customer information query as an example: a customer who needs to query the number 101, just enter "CID = 101", it is possible. After the query is complete, the SQL statement of the entire query will be displayed in the corresponding edit box. If you don't know the column names in the corresponding database, you can view the corresponding columns in the List Control control, and the column names in the column name are column names in the database.

6. Each individual module is started by the respective button of the main interface strategy, and each module appears in the form of a modal dialog. Turn off each module dialog and return to the main interface strategy. In the main interface stages, there are also some programs that operate.

7. Each module in the program appears in the form of a modal dialog, so only one module can be processed each time.

8. ADO technology is based on CoM, ensuring that the corresponding dynamic connection library file can be imported correctly. 9. Perhaps there are some errors that have not found in the program, because all the reasons are not improved.

10. The ADO dynamic link library file used in the program is copied in the folder to the DLL folder.

Five, reference

Database management system Zhou Lizhu, etc., Tsinghua University Press Publishing

Visual C Object-Oriented and Visual Program Design Huang Wei Tong edited, Tsinghua University Press Publishing

Visual C Network and Database Programming Yan Guopeng Xiao Jiaping Gu Songdong is edited, China Power Press Publishing

VC database programming practices Han Shi Ming, Science Press Publishing

Visual C 6.0 Database Development and Engineering Practice is Technical Edge, People's Posts and Telecommunications Publishing House

转载请注明原文地址:https://www.9cbs.com/read-114810.html

New Post(0)