您的位置:首页 > 科技 > 能源 > 珠海网络营销外包收费情况_用手机怎么制作app软件_seo是什么职业_财经新闻最新消息

珠海网络营销外包收费情况_用手机怎么制作app软件_seo是什么职业_财经新闻最新消息

2025/1/11 14:32:10 来源:https://blog.csdn.net/s1t16/article/details/145001524  浏览:    关键词:珠海网络营销外包收费情况_用手机怎么制作app软件_seo是什么职业_财经新闻最新消息
珠海网络营销外包收费情况_用手机怎么制作app软件_seo是什么职业_财经新闻最新消息

1.项目简介

  本项目是一个户籍管理系统,用于记录住户身份信息,提供新户登记(增加)、户籍变更(修改)、户籍注销(删除)、户籍查询、曾用名查询、迁户记录查询以及创建备份、删除备份共8个功能。

1.1. 软件环境与开发工具

  • 操作系统:Windows 10 Home China 1809 17763
  • 数据库:SQL Server Express 2017
  • 集成开发环境:Embarcadero Delphi Architect 10.3

2. 数据库设计

2.1. 概要结构设计

  数据库Manager共包括以下3张表:

表名

说明

People

存储用户信息,是程序的核心表

Rename

存储用户改名记录,作为曾用名表

Move

存储用户的住址变更记录,作为户籍变更历史

Controller

存储系统管理员账户信息

2.2. 数据表结构分析

  4张数据表的字段分别列举如下:

字段名

含义

类型

Name

姓名

NVARCHAR(10)

Sex

性别

NCHAR(2)

ID_Num

身份证号(主键)

CHAR(18)

Address

户籍地址

NVARCHAR(100)

Tel_No

联系方式

NUMERIC(12, 0)

Date

更新时间

DATETIME

字段名

含义

类型

ID_Num

身份证号(主键)

CHAR(18)

Old_Name

曾用名

CHAR(10)

Date

改名时间(升序索引)

DATETIME

字段名

含义

类型

ID_Num

身份证号(主键)

CHAR(18)

Address

曾用户籍地

NVARCHAR(100)

Date

迁户时间(升序索引)

DATETIME

字段名

含义

类型

Username

用户名(主键)

NCHAR(10)

Alias

别名

NCHAR(10)

Password

密码

VARBINARY(128)

2.3建表语句

USE [Manager]
GO
EXEC sys.sp_dropextendedproperty @name=N'MS_Description' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Rename', @level2type=N'CONSTRAINT',@level2name=N'FK_Rename_People'
GO
EXEC sys.sp_dropextendedproperty @name=N'MS_Description' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'People', @level2type=N'CONSTRAINT',@level2name=N'CK_Tel_Limit'
GO
EXEC sys.sp_dropextendedproperty @name=N'MS_Description' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'People', @level2type=N'CONSTRAINT',@level2name=N'CK_Sex_Limit'
GO
EXEC sys.sp_dropextendedproperty @name=N'MS_Description' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'People', @level2type=N'CONSTRAINT',@level2name=N'CK_ID_Limit'
GO
EXEC sys.sp_dropextendedproperty @name=N'MS_Description' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'People', @level2type=N'COLUMN',@level2name=N'Date'
GO
EXEC sys.sp_dropextendedproperty @name=N'MS_Description' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'People', @level2type=N'COLUMN',@level2name=N'Tel_No'
GO
EXEC sys.sp_dropextendedproperty @name=N'MS_Description' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'People', @level2type=N'COLUMN',@level2name=N'Address'
GO
EXEC sys.sp_dropextendedproperty @name=N'MS_Description' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'People', @level2type=N'COLUMN',@level2name=N'ID_Num'
GO
EXEC sys.sp_dropextendedproperty @name=N'MS_Description' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'People', @level2type=N'COLUMN',@level2name=N'Sex'
GO
EXEC sys.sp_dropextendedproperty @name=N'MS_Description' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'People', @level2type=N'COLUMN',@level2name=N'Name'
GO
EXEC sys.sp_dropextendedproperty @name=N'MS_Description' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Move', @level2type=N'CONSTRAINT',@level2name=N'FK_Move_People'
GO
ALTER TABLE [dbo].[People] DROP CONSTRAINT [CK_Tel_Limit]
GO
ALTER TABLE [dbo].[People] DROP CONSTRAINT [CK_Sex_Limit]
GO
ALTER TABLE [dbo].[People] DROP CONSTRAINT [CK_ID_Limit]
GO
ALTER TABLE [dbo].[Rename] DROP CONSTRAINT [FK_Rename_People]
GO
ALTER TABLE [dbo].[People] DROP CONSTRAINT [FK_People_People]
GO
ALTER TABLE [dbo].[Move] DROP CONSTRAINT [FK_Move_People]
GO
/****** Object:  Index [IX_Rename_1]    Script Date: 2019/5/27 1:20:03 ******/
DROP INDEX [IX_Rename_1] ON [dbo].[Rename]
GO
/****** Object:  Index [IX_Rename]    Script Date: 2019/5/27 1:20:03 ******/
DROP INDEX [IX_Rename] ON [dbo].[Rename]
GO
/****** Object:  Index [IX_Move_1]    Script Date: 2019/5/27 1:20:03 ******/
DROP INDEX [IX_Move_1] ON [dbo].[Move]
GO
/****** Object:  Index [IX_Move]    Script Date: 2019/5/27 1:20:03 ******/
DROP INDEX [IX_Move] ON [dbo].[Move]
GO
/****** Object:  Table [dbo].[Rename]    Script Date: 2019/5/27 1:20:03 ******/
DROP TABLE [dbo].[Rename]
GO
/****** Object:  Table [dbo].[People]    Script Date: 2019/5/27 1:20:03 ******/
DROP TABLE [dbo].[People]
GO
/****** Object:  Table [dbo].[Move]    Script Date: 2019/5/27 1:20:03 ******/
DROP TABLE [dbo].[Move]
GO
USE [master]
GO
/****** Object:  Database [Manager]    Script Date: 2019/5/27 1:20:03 ******/
DROP DATABASE [Manager]
GO
/****** Object:  Database [Manager]    Script Date: 2019/5/27 1:20:03 ******/
CREATE DATABASE [Manager] ON  PRIMARY 
( NAME = N'Citizens', FILENAME = N'D:\Program_Files_(x64)\Microsoft\SQL_Server_2017\Instances\MSSQL14.EXPRESS17\MSSQL\UserData\Citizens.mdf' , SIZE = 8192KB , MAXSIZE = 1048576KB , FILEGROWTH = 1%)LOG ON 
( NAME = N'Citizens_log', FILENAME = N'D:\Program_Files_(x64)\Microsoft\SQL_Server_2017\Instances\MSSQL14.EXPRESS17\MSSQL\UserData\Citizens_log.ldf' , SIZE = 8192KB , MAXSIZE = 1048576KB , FILEGROWTH = 1%)
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [Manager].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [Manager] SET ANSI_NULL_DEFAULT OFF 
GO
ALTER DATABASE [Manager] SET ANSI_NULLS OFF 
GO
ALTER DATABASE [Manager] SET ANSI_PADDING OFF 
GO
ALTER DATABASE [Manager] SET ANSI_WARNINGS OFF 
GO
ALTER DATABASE [Manager] SET ARITHABORT OFF 
GO
ALTER DATABASE [Manager] SET AUTO_CLOSE ON 
GO
ALTER DATABASE [Manager] SET AUTO_SHRINK OFF 
GO
ALTER DATABASE [Manager] SET AUTO_UPDATE_STATISTICS ON 
GO
ALTER DATABASE [Manager] SET CURSOR_CLOSE_ON_COMMIT OFF 
GO
ALTER DATABASE [Manager] SET CURSOR_DEFAULT  GLOBAL 
GO
ALTER DATABASE [Manager] SET CONCAT_NULL_YIELDS_NULL OFF 
GO
ALTER DATABASE [Manager] SET NUMERIC_ROUNDABORT OFF 
GO
ALTER DATABASE [Manager] SET QUOTED_IDENTIFIER OFF 
GO
ALTER DATABASE [Manager] SET RECURSIVE_TRIGGERS OFF 
GO
ALTER DATABASE [Manager] SET  DISABLE_BROKER 
GO
ALTER DATABASE [Manager] SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
GO
ALTER DATABASE [Manager] SET DATE_CORRELATION_OPTIMIZATION OFF 
GO
ALTER DATABASE [Manager] SET TRUSTWORTHY OFF 
GO
ALTER DATABASE [Manager] SET ALLOW_SNAPSHOT_ISOLATION OFF 
GO
ALTER DATABASE [Manager] SET PARAMETERIZATION SIMPLE 
GO
ALTER DATABASE [Manager] SET READ_COMMITTED_SNAPSHOT OFF 
GO
ALTER DATABASE [Manager] SET HONOR_BROKER_PRIORITY OFF 
GO
ALTER DATABASE [Manager] SET RECOVERY SIMPLE 
GO
ALTER DATABASE [Manager] SET  MULTI_USER 
GO
ALTER DATABASE [Manager] SET PAGE_VERIFY CHECKSUM  
GO
ALTER DATABASE [Manager] SET DB_CHAINING OFF 
GO
USE [Manager]
GO
/****** Object:  Table [dbo].[Move]    Script Date: 2019/5/27 1:20:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Move]([ID_Num] [char](18) NOT NULL,[Address] [nvarchar](100) NOT NULL,[Date] [datetime] NOT NULL
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[People]    Script Date: 2019/5/27 1:20:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[People]([Name] [nvarchar](10) NOT NULL,[Sex] [nchar](2) NOT NULL,[ID_Num] [char](18) NOT NULL,[Address] [nvarchar](100) NOT NULL,[Tel_No] [numeric](12, 0) NOT NULL,[Date] [datetime] NOT NULL,CONSTRAINT [PK_People] PRIMARY KEY CLUSTERED 
([ID_Num] 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
/****** Object:  Table [dbo].[Rename]    Script Date: 2019/5/27 1:20:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Rename]([ID_Num] [char](18) NOT NULL,[Old_Name] [char](10) NOT NULL,[Date] [datetime] NOT NULL
) ON [PRIMARY]
GO
INSERT [dbo].[Move] ([ID_Num], [Address], [Date]) VALUES (N'440101200101010101', N'北京市', CAST(N'2019-05-27T00:14:47.990' AS DateTime))
INSERT [dbo].[Move] ([ID_Num], [Address], [Date]) VALUES (N'440111201111111111', N'上海', CAST(N'2019-05-27T00:34:22.500' AS DateTime))
INSERT [dbo].[Move] ([ID_Num], [Address], [Date]) VALUES (N'440111201111111111', N'杭州', CAST(N'2019-05-27T00:35:12.933' AS DateTime))
INSERT [dbo].[Move] ([ID_Num], [Address], [Date]) VALUES (N'440111201111111111', N'杭州', CAST(N'2019-05-27T00:35:44.370' AS DateTime))
INSERT [dbo].[People] ([Name], [Sex], [ID_Num], [Address], [Tel_No], [Date]) VALUES (N'John', N'男 ', N'440101200101010101', N'北京市', CAST(13333333333 AS Numeric(12, 0)), CAST(N'2019-05-27T00:23:28.633' AS DateTime))
INSERT [dbo].[People] ([Name], [Sex], [ID_Num], [Address], [Tel_No], [Date]) VALUES (N'Ben', N'男 ', N'440111201111111111', N'杭州', CAST(13333333333 AS Numeric(12, 0)), CAST(N'2019-05-27T00:35:44.367' AS DateTime))
INSERT [dbo].[Rename] ([ID_Num], [Old_Name], [Date]) VALUES (N'440101200101010101', N'Alice     ', CAST(N'2019-05-27T00:08:35.767' AS DateTime))
INSERT [dbo].[Rename] ([ID_Num], [Old_Name], [Date]) VALUES (N'440101200101010101', N'Alice     ', CAST(N'2019-05-27T00:14:47.987' AS DateTime))
INSERT [dbo].[Rename] ([ID_Num], [Old_Name], [Date]) VALUES (N'440101200101010101', N'Cindarela ', CAST(N'2019-05-27T00:15:07.933' AS DateTime))
INSERT [dbo].[Rename] ([ID_Num], [Old_Name], [Date]) VALUES (N'440101200101010101', N'Alice     ', CAST(N'2019-05-27T00:18:24.390' AS DateTime))
INSERT [dbo].[Rename] ([ID_Num], [Old_Name], [Date]) VALUES (N'440101200101010101', N'Bob       ', CAST(N'2019-05-27T00:19:22.057' AS DateTime))
INSERT [dbo].[Rename] ([ID_Num], [Old_Name], [Date]) VALUES (N'440101200101010101', N'Ben       ', CAST(N'2019-05-27T00:20:54.577' AS DateTime))
INSERT [dbo].[Rename] ([ID_Num], [Old_Name], [Date]) VALUES (N'440101200101010101', N'John      ', CAST(N'2019-05-27T00:23:28.633' AS DateTime))
INSERT [dbo].[Rename] ([ID_Num], [Old_Name], [Date]) VALUES (N'440111201111111111', N'Alice     ', CAST(N'2019-05-27T00:34:22.500' AS DateTime))
INSERT [dbo].[Rename] ([ID_Num], [Old_Name], [Date]) VALUES (N'440111201111111111', N'Ben       ', CAST(N'2019-05-27T00:35:12.930' AS DateTime))
INSERT [dbo].[Rename] ([ID_Num], [Old_Name], [Date]) VALUES (N'440111201111111111', N'Ben       ', CAST(N'2019-05-27T00:35:44.370' AS DateTime))
SET ANSI_PADDING ON
GO
/****** Object:  Index [IX_Move]    Script Date: 2019/5/27 1:20:03 ******/
CREATE NONCLUSTERED INDEX [IX_Move] ON [dbo].[Move]
([ID_Num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [IX_Move_1]    Script Date: 2019/5/27 1:20:03 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_Move_1] ON [dbo].[Move]
([Date] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object:  Index [IX_Rename]    Script Date: 2019/5/27 1:20:03 ******/
CREATE NONCLUSTERED INDEX [IX_Rename] ON [dbo].[Rename]
([ID_Num] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  Index [IX_Rename_1]    Script Date: 2019/5/27 1:20:03 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_Rename_1] ON [dbo].[Rename]
([Date] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = ON, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Move]  WITH CHECK ADD  CONSTRAINT [FK_Move_People] FOREIGN KEY([ID_Num])
REFERENCES [dbo].[People] ([ID_Num])
GO
ALTER TABLE [dbo].[Move] CHECK CONSTRAINT [FK_Move_People]
GO
ALTER TABLE [dbo].[People]  WITH CHECK ADD  CONSTRAINT [FK_People_People] FOREIGN KEY([ID_Num])
REFERENCES [dbo].[People] ([ID_Num])
GO
ALTER TABLE [dbo].[People] CHECK CONSTRAINT [FK_People_People]
GO
ALTER TABLE [dbo].[Rename]  WITH CHECK ADD  CONSTRAINT [FK_Rename_People] FOREIGN KEY([ID_Num])
REFERENCES [dbo].[People] ([ID_Num])
GO
ALTER TABLE [dbo].[Rename] CHECK CONSTRAINT [FK_Rename_People]
GO
ALTER TABLE [dbo].[People]  WITH CHECK ADD  CONSTRAINT [CK_ID_Limit] CHECK  ((len([ID_Num])=(15) OR len([ID_Num])=(18)))
GO
ALTER TABLE [dbo].[People] CHECK CONSTRAINT [CK_ID_Limit]
GO
ALTER TABLE [dbo].[People]  WITH CHECK ADD  CONSTRAINT [CK_Sex_Limit] CHECK  (([Sex]='男' OR [Sex]='女'))
GO
ALTER TABLE [dbo].[People] CHECK CONSTRAINT [CK_Sex_Limit]
GO
ALTER TABLE [dbo].[People]  WITH CHECK ADD  CONSTRAINT [CK_Tel_Limit] CHECK  ((len([Tel_No])>=(10) AND len([Tel_No])<=(12)))
GO
ALTER TABLE [dbo].[People] CHECK CONSTRAINT [CK_Tel_Limit]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'身份证绑定' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Move', @level2type=N'CONSTRAINT',@level2name=N'FK_Move_People'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'姓名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'People', @level2type=N'COLUMN',@level2name=N'Name'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'性别' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'People', @level2type=N'COLUMN',@level2name=N'Sex'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'身份证号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'People', @level2type=N'COLUMN',@level2name=N'ID_Num'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'家庭住址' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'People', @level2type=N'COLUMN',@level2name=N'Address'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'联系方式' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'People', @level2type=N'COLUMN',@level2name=N'Tel_No'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'户籍变更时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'People', @level2type=N'COLUMN',@level2name=N'Date'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'限制身份证长度' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'People', @level2type=N'CONSTRAINT',@level2name=N'CK_ID_Limit'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'限制性别取值' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'People', @level2type=N'CONSTRAINT',@level2name=N'CK_Sex_Limit'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'限制号码长度' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'People', @level2type=N'CONSTRAINT',@level2name=N'CK_Tel_Limit'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'身份证号关联' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Rename', @level2type=N'CONSTRAINT',@level2name=N'FK_Rename_People'
GO
USE [master]
GO
ALTER DATABASE [Manager] SET  READ_WRITE 
GO

3.系统实现

3.1登录业务

object Form1: TForm1Left = 0Top = 0BorderStyle = bsDialogCaption = #30331#24405#35748#35777ClientHeight = 329ClientWidth = 457Color = clBtnFaceFont.Charset = DEFAULT_CHARSETFont.Color = clWindowTextFont.Height = -11Font.Name = 'Tahoma'Font.Style = []OldCreateOrder = FalsePosition = poScreenCenterVisible = TruePixelsPerInch = 96TextHeight = 13object GridPanel1: TGridPanelLeft = 100Top = 135Width = 257Height = 59Align = alClientBevelOuter = bvNoneCaption = 'GridPanel1'ColumnCollection = <itemValue = 29.999999999999990000enditemValue = 70.000000000000010000end>ControlCollection = <itemColumn = 0Control = Label1Row = 0enditemColumn = 1Control = Edit1Row = 0enditemColumn = 0Control = Label2Row = 1enditemColumn = 1Control = Edit2Row = 1end>RowCollection = <itemValue = 49.999999999999990000enditemValue = 50.000000000000020000end>ShowCaption = FalseTabOrder = 0ExplicitWidth = 254object Label1: TLabelLeft = 0Top = 0Width = 77Height = 29Align = alClientCaption = #29992#25143#21517#65306Font.Charset = DEFAULT_CHARSETFont.Color = clWindowTextFont.Height = -19Font.Name = #23435#20307Font.Style = []ParentFont = FalseExplicitLeft = 51ExplicitTop = 1ExplicitWidth = 76ExplicitHeight = 19endobject Edit1: TEditLeft = 77Top = 0Width = 180Height = 29Align = alClientFont.Charset = DEFAULT_CHARSETFont.Color = clWindowTextFont.Height = -19Font.Name = #23435#20307Font.Style = []ParentFont = FalseTabOrder = 0ExplicitLeft = 127ExplicitTop = 1ExplicitWidth = 126ExplicitHeight = 27endobject Label2: TLabelLeft = 0Top = 29Width = 77Height = 30Align = alClientCaption = #23494#30721#65306Font.Charset = DEFAULT_CHARSETFont.Color = clWindowTextFont.Height = -19Font.Name = #23435#20307Font.Style = []ParentFont = FalseExplicitLeft = 70ExplicitWidth = 57ExplicitHeight = 19endobject Edit2: TEditLeft = 77Top = 29Width = 180Height = 30Align = alClientFont.Charset = DEFAULT_CHARSETFont.Color = clWindowTextFont.Height = -19Font.Name = #23435#20307Font.Style = []ParentFont = FalsePasswordChar = '*'TabOrder = 1ExplicitLeft = 127ExplicitWidth = 126ExplicitHeight = 27endendobject Panel1: TPanelLeft = 0Top = 0Width = 457Height = 135Align = alTopBevelOuter = bvNoneCaption = 'Panel1'ShowCaption = FalseTabOrder = 1ExplicitWidth = 454object Label3: TLabelLeft = 0Top = 50Width = 457Height = 35Align = alClientAlignment = taCenterCaption = #36890#29992#25143#31821#31649#29702#31995#32479Font.Charset = DEFAULT_CHARSETFont.Color = clWindowTextFont.Height = -27Font.Name = #38582#20070Font.Style = []ParentFont = FalseExplicitWidth = 224ExplicitHeight = 27endobject Panel5: TPanelLeft = 0Top = 0Width = 457Height = 50Align = alTopBevelOuter = bvNoneCaption = 'Panel5'ShowCaption = FalseTabOrder = 0ExplicitWidth = 454endobject Panel7: TPanelLeft = 0Top = 85Width = 457Height = 50Align = alBottomBevelOuter = bvNoneCaption = 'Panel7'ShowCaption = FalseTabOrder = 1ExplicitTop = 91endendobject Panel2: TPanelLeft = 0Top = 194Width = 457Height = 135Align = alBottomBevelEdges = []BevelOuter = bvNoneCaption = 'Panel2'ShowCaption = FalseTabOrder = 2ExplicitTop = 199ExplicitWidth = 454object Panel6: TPanelLeft = 0Top = 0Width = 150Height = 25Align = alLeftBevelOuter = bvNoneCaption = 'Panel6'ShowCaption = FalseTabOrder = 0ExplicitHeight = 40endobject Panel8: TPanelLeft = 307Top = 0Width = 150Height = 25Align = alRightBevelOuter = bvNoneCaption = 'Panel8'ShowCaption = FalseTabOrder = 1ExplicitLeft = 322ExplicitHeight = 40endobject Panel9: TPanelLeft = 0Top = 25Width = 457Height = 110Align = alBottomBevelOuter = bvNoneCaption = 'Panel9'ShowCaption = FalseTabOrder = 2ExplicitTop = 30endobject GridPanel2: TGridPanelLeft = 150Top = 0Width = 157Height = 25Align = alClientBevelOuter = bvNoneCaption = 'GridPanel2'ColumnCollection = <itemValue = 50.000000000000000000enditemValue = 50.000000000000000000end>ControlCollection = <itemColumn = 0Control = Button1Row = 0enditemColumn = 1Control = Button2Row = 0end>RowCollection = <itemValue = 100.000000000000000000end>ShowCaption = FalseTabOrder = 3ExplicitLeft = 136ExplicitTop = 48ExplicitWidth = 185ExplicitHeight = 41DesignSize = (15725)object Button1: TButtonLeft = 0Top = 0Width = 78Height = 25Align = alClientCaption = #30331#24405Font.Charset = DEFAULT_CHARSETFont.Color = clWindowTextFont.Height = -19Font.Name = #23435#20307Font.Style = []ParentFont = FalseTabOrder = 0OnClick = Button1ClickExplicitLeft = 40ExplicitWidth = 75endobject Button2: TButtonLeft = 80Top = 0Width = 75Height = 25Anchors = []Caption = #21462#28040Font.Charset = DEFAULT_CHARSETFont.Color = clWindowTextFont.Height = -19Font.Name = #23435#20307Font.Style = []ParentFont = FalseTabOrder = 1OnClick = Button2ClickExplicitLeft = 40endendendobject Panel3: TPanelLeft = 0Top = 135Width = 100Height = 59Align = alLeftBevelEdges = []BevelOuter = bvNoneCaption = 'Panel3'ShowCaption = FalseTabOrder = 3endobject Panel4: TPanelLeft = 357Top = 135Width = 100Height = 59Align = alRightBevelOuter = bvNoneCaption = 'Panel4'ShowCaption = FalseTabOrder = 4ExplicitLeft = 354endobject ADOQuery1: TADOQueryConnection = DataModule1.ADOConnection1Parameters = <>Left = 24Top = 264end
end
unit Login;interfaceusesWinapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Data.DB,Data.Win.ADODB;typeTForm1 = class(TForm)GridPanel1: TGridPanel;Label1: TLabel;Panel1: TPanel;Panel2: TPanel;Edit1: TEdit;Panel3: TPanel;Panel4: TPanel;Label2: TLabel;Edit2: TEdit;Panel5: TPanel;Panel7: TPanel;Label3: TLabel;Panel6: TPanel;Panel8: TPanel;Panel9: TPanel;GridPanel2: TGridPanel;Button1: TButton;Button2: TButton;ADOQuery1: TADOQuery;procedure Button2Click(Sender: TObject);procedure Button1Click(Sender: TObject);private{ Private declarations }public{ Public declarations }end;varForm1: TForm1;implementationuses Main, Connect;{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin// 判断用户名或密码为空if (Edit1.Text = '') thenbeginshowMessage('错误:用户名不能为空!');Edit1.SetFocus;endelsebeginADOQuery1.Close;ADOQuery1.SQL.Clear;// 尝试登录ADOQuery1.SQL.Add('SELECT ''TRUE'' AS [Authorized], [Alias], [Username] FROM [Controller] WHERE [Username] = '+ '''' + Edit1.Text + ''' AND [Password] = HASHBYTES(''MD5'', ''' +Edit2.Text + ''')');ADOQuery1.Open;// 如果登陆成功if (ADOQuery1.FieldByName('Authorized').AsString = 'TRUE') thenbegin// 用户是否有别名?if (ADOQuery1.FieldByName('Alias').AsString <> '') thenbeginForm2.Label1.Caption := '欢迎您,' + trim(ADOQuery1.FieldByName('Alias').AsString)+ '!';end// 否则,显示用户名elsebeginForm2.Label1.Caption := '欢迎您,' + trim(ADOQuery1.FieldByName('Username').AsString)+ '!';end;Form1.Hide;Form2.Show;endelsebeginshowMessage('错误:用户名或密码错误!');end;end;
end;procedure TForm1.Button2Click(Sender: TObject);
beginEdit1.Text := '';Edit2.Text := '';
end;end.

3.2主启动类

unit Main;interfaceusesWinapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Menus, Vcl.StdCtrls,Vcl.Imaging.jpeg, Vcl.ExtCtrls;typeTForm2 = class(TForm)MainMenu1: TMainMenu;F1: TMenuItem;Q1: TMenuItem;M1: TMenuItem;A1: TMenuItem;G1: TMenuItem;N1: TMenuItem;M2: TMenuItem;Image1: TImage;Label1: TLabel;N2: TMenuItem;N3: TMenuItem;B1: TMenuItem;procedure FormCreate(Sender: TObject);procedure Q1Click(Sender: TObject);procedure FormClose(Sender: TObject; var Action: TCloseAction);procedure G1Click(Sender: TObject);procedure A1Click(Sender: TObject);procedure N1Click(Sender: TObject);procedure M2Click(Sender: TObject);procedure N3Click(Sender: TObject);procedure N5Click(Sender: TObject);procedure B1Click(Sender: TObject);private{ Private declarations }public{ Public declarations }end;varForm2: TForm2;implementationuses Login, Edit, Rename, Move, About, Backup, Connect;{$R *.dfm}procedure TForm2.A1Click(Sender: TObject);
beginForm4.Show;
end;procedure TForm2.B1Click(Sender: TObject);
beginForm7.Show;Form7.FileListBox1.Directory := 'D:\Program_Files_(x64)\Git\Repos\Delphi_Design\bak';Form7.FileListBox1.Update;
end;procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
beginForm1.Close;
end;procedure TForm2.FormCreate(Sender: TObject);
beginForm2.Visible := False;
end;procedure TForm2.G1Click(Sender: TObject);
beginForm3.Show;
end;procedure TForm2.M2Click(Sender: TObject);
beginForm6.Show;Form6.ADOTable1.Close;Form6.ADOTable1.Open;
end;procedure TForm2.N1Click(Sender: TObject);
beginForm5.Show;Form5.ADOTable1.Close;Form5.ADOTable1.Open;
end;procedure TForm2.N3Click(Sender: TObject);
beginForm2.Hide;Label1.Caption := '';Form1.Show;Form1.SetFocus;
end;procedure TForm2.N5Click(Sender: TObject);
beginForm7.Show;DataModule1.ADOConnection1.Close;Form7.FileListBox1.Directory := 'D:\Program_Files_(x64)\Git\Repos\Delphi_Design\bak';Form7.FileListBox1.Update;
end;procedure TForm2.Q1Click(Sender: TObject);
beginForm1.Close;
end;end.

3.3部分代码

unit Rename;interfaceusesWinapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Data.Win.ADODB, Vcl.Grids,Vcl.DBGrids;typeTForm5 = class(TForm)ADOTable1: TADOTable;DBGrid1: TDBGrid;DataSource1: TDataSource;procedure FormCreate(Sender: TObject);private{ Private declarations }public{ Public declarations }end;varForm5: TForm5;implementationuses Connect;{$R *.dfm}procedure TForm5.FormCreate(Sender: TObject);
beginADOTable1.Active := True;
end;end.

4. 系统设计与实现

5. 结论与尚存在的问题

  以下是本项目仍然存在的问题:

  1. 用户查询功能存在缺陷,无法在DBGrid中显示ADOQuery的查询结果;
  2. 数据库无法从*.bak文件中恢复。

6. 个人总结

  项目由可视化集成开发环境(快速应用程序开发工具)制作而成,对比于C/C++ MFC/QT、Java Swing/SWT、Python TKinter,Delphi具有方便、快捷的优势,在界面布局方面节省了大量的时间。但在另一方面,仍有个别功能只能通过编写代码实现,大量由Delphi自动生成的Object-Pascal代码使得项目维护难度提高。

  本次开发工作存在较大的失误,项目分工错误让我基本承担所有工作。此外项目的开工时间极度延后,导致工期不足,甚至无法完成基本功能。

  通过此次开发的教训,在后续课程设计乃至今后的生产环境开发都要提前估计工作量与工期,合理安排开发进度,杜绝临时赶工的行为。

7. 项目用法

  由于项目需要连接数据库程序,而不同设备的数据库配置可能存在差异,有别于直接连接到库文件的Microsoft Office Access、SQLite。由我使用Windows-32bit Release模式编译发布的可执行程序并不通用,所以请根据以下步骤编译运行:

  1. 项目提供了Citizens_log.ldf数据库日志文件和Citizens.mdf数据库主文件,这2个文件仅支持Microsoft SQL Server 2017及以上版本数据库的附加。对于之前的版本,项目额外提供了script.sql以实现数据库导入工作,此脚本最低兼容SQL Server 2008。脚本仅涉及架构,没有任何数据。如有测试需要,请在运行此脚本生成数据库后自行添加备用数据。
  2. 使用Delphi打开代码库中的Manager.dproj,定位至Connect.pas文件的窗体设计视图。
  3. 修改ADOConnection1控件的ConnectionString属性,点击Build选项,在数据库连接向导切换为您设备的配置(包括驱动程序、服务器名、登陆账号及密码、数据库名)。
  4. 定位至Backup.pas文件的窗体设计视图,同样地修改ADOQuery1控件的ConnectionString属性。
  5. 定位至Edit.pasMove.pasRename.pas,重新激活各个页面的ADOTable1,确认DBGrid能够正常显示数据库的内容。
  6. 以上,即可正常编译运行。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com