WinFramework轻量级开发框架 - 单表数据字典窗体开发指南
C/S结构快速开发框架/软件快速开发平台
WinFrameworkV2.1轻量级框架
原创软件@csframework.com
目录
一、数据库新建表 dt_data_Customer
1.1 表结构预览
1.2 SQL语句
CREATE TABLE [dbo].[dt_Data_Customer](
[isid] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[CustomerID] [varchar](20) NOT NULL,
[CustomerName] [nvarchar](200) NULL,
[ZJM] [nvarchar](20) NULL,
[CustomerAddress] [nvarchar](200) NULL,
[Contacts] [nvarchar](20) NULL,
[Phone] [varchar](20) NULL,
[Remark] [nvarchar](500) NULL,
[Status] [int] NULL,
[CreateUser] [varchar](20) NULL,
[CreateDate] [datetime] NULL,
[LastUpdateUser] [varchar](20) NULL,
[LastUpdateDate] [datetime] NULL,
CONSTRAINT [PK_DT_DATA_CUSTOMER] PRIMARY KEY CLUSTERED
(
[CustomerID] 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
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'自增列' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dt_Data_Customer', @level2type=N'COLUMN',@level2name=N'isid'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'客户编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dt_Data_Customer', @level2type=N'COLUMN',@level2name=N'CustomerID'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'客户名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dt_Data_Customer', @level2type=N'COLUMN',@level2name=N'CustomerName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'助记码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dt_Data_Customer', @level2type=N'COLUMN',@level2name=N'ZJM'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'客户地址' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dt_Data_Customer', @level2type=N'COLUMN',@level2name=N'CustomerAddress'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'联系人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dt_Data_Customer', @level2type=N'COLUMN',@level2name=N'Contacts'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'联系电话' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dt_Data_Customer', @level2type=N'COLUMN',@level2name=N'Phone'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dt_Data_Customer', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'状态' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dt_Data_Customer', @level2type=N'COLUMN',@level2name=N'Status'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dt_Data_Customer', @level2type=N'COLUMN',@level2name=N'CreateUser'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'创建时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dt_Data_Customer', @level2type=N'COLUMN',@level2name=N'CreateDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'最后修改人' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dt_Data_Customer', @level2type=N'COLUMN',@level2name=N'LastUpdateUser'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'最后修改时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dt_Data_Customer', @level2type=N'COLUMN',@level2name=N'LastUpdateDate'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'基础资料-客户资料' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'dt_Data_Customer'
GO
二、代码生成器生成代码
2.1 生成Model代码
2.2 复制.cs代码文件到vs解决方案
把生成的代码dt_Data_Customer.cs复制到项目的Model层,WinFrameworkDemo.Models\Business目录下:
2.3 创建BLL类
在 WinFrameworkWinDemo.Business\Data 项目中新建类 BLL_Customer.cs
代码如下:
public class BLL_Customer : Base.bllBaseUser
{
public BLL_Customer()
: base(typeof(dt_Data_Customer))
{
}
}
2.4 生成窗体
生成代码:
复制窗体代码文件到项目
打开frm_Customer.cs 代码页,并完善 using 引用
三、功能注册
在当前模块的 Management.cs 中注册新功能:
当前模块-数据字典模块:WinFrameworkDemo.Dictionary
FunctionCollection.AddFunction(typeof(frm_Customer), "客户资料", "Function_Custome");
C# 全选
FunctionCollection.AddFunction(typeof(frm_Customer), "客户资料", "Function_Customer");
四、界面调整
根据实际需求,调整界面的布局,省略。
4.1 调整查询界面
4.2 调整编辑界面
五、测试新功能
运行项目,在数据字典模块就能看到功能 <客户资料> 了
测试功能 <增> <删> <改> <查> 没问题
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
WinFramework C/S框架网