单表演练之客户资料
一、数据库新建表 dt_data_Customer
表结构预览:
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
GarsonZhang www.yesdotnet.com
二、代码生成器生成代码
1)生成Model代码
生成代码复制到项目Model层
2)创建BLL类
在 YESWinDemo.Business 项目中新建类 BLL_Customer.cs
代码如下:
public class BLL_Customer : Base.bllBaseUser { public BLL_Customer() : base(typeof(dt_Data_Customer)) { } }
GarsonZhang www.yesdotnet.com
3)生成窗体
生成代码:
复制窗体代码文件到项目
打开frm_Customer.cs 代码页,并完善 using 引用
三、功能注册
在模块的 Management.cs 中注册功能
FunctionCollection.AddFunction(typeof(frm_Customer), "客户资料", "Function_Custome");
四、界面调整
根据实际需求,调整界面的布局,省略
五、测试
运行项目,在数据字典模块就能看到功能 <客户资料> 了
测试功能 <增> <删> <改> <查> 没问题
版权声明:本文为YES开发框架网发布内容,转载请附上原文出处连接
YESWinform YES开发框架