创建语句:
if exists (select 1 from sysobjects where id = object_id('tb_MembersLevel') and type = 'U') drop table tb_MembersLevel go /*==============================================================*/ /* Table: tb_MembersLevel */ /*==============================================================*/ create table tb_MembersLevel ( isid int identity(1,1) not for replication, LevelID varchar(10) not null, LevelName varchar(20) null, LevelDiscount decimal(18,2) null, MinAmount int null, CreateUser varchar(20) null, CreateDate datetime null, LastUpdateUser varchar(20) null, LastUpdateDate datetime null, constraint PK_TB_MEMBERSLEVEL primary key (LevelID) ) go declare @CurrentUser sysname select @CurrentUser = user_name() execute sp_addextendedproperty 'MS_Description', '会员等级管理', 'user', @CurrentUser, 'table', 'tb_MembersLevel' go declare @CurrentUser sysname select @CurrentUser = user_name() execute sp_addextendedproperty 'MS_Description', '自增字段', 'user', @CurrentUser, 'table', 'tb_MembersLevel', 'column', 'isid' go declare @CurrentUser sysname select @CurrentUser = user_name() execute sp_addextendedproperty 'MS_Description', '等级编号', 'user', @CurrentUser, 'table', 'tb_MembersLevel', 'column', 'LevelID' go declare @CurrentUser sysname select @CurrentUser = user_name() execute sp_addextendedproperty 'MS_Description', '等级名称', 'user', @CurrentUser, 'table', 'tb_MembersLevel', 'column', 'LevelName' go declare @CurrentUser sysname select @CurrentUser = user_name() execute sp_addextendedproperty 'MS_Description', '折扣', 'user', @CurrentUser, 'table', 'tb_MembersLevel', 'column', 'LevelDiscount' go declare @CurrentUser sysname select @CurrentUser = user_name() execute sp_addextendedproperty 'MS_Description', '最低消费金额', 'user', @CurrentUser, 'table', 'tb_MembersLevel', 'column', 'MinAmount' go declare @CurrentUser sysname select @CurrentUser = user_name() execute sp_addextendedproperty 'MS_Description', '创建人', 'user', @CurrentUser, 'table', 'tb_MembersLevel', 'column', 'CreateUser' go declare @CurrentUser sysname select @CurrentUser = user_name() execute sp_addextendedproperty 'MS_Description', '创建日期', 'user', @CurrentUser, 'table', 'tb_MembersLevel', 'column', 'CreateDate' go declare @CurrentUser sysname select @CurrentUser = user_name() execute sp_addextendedproperty 'MS_Description', '修改人', 'user', @CurrentUser, 'table', 'tb_MembersLevel', 'column', 'LastUpdateUser' go declare @CurrentUser sysname select @CurrentUser = user_name() execute sp_addextendedproperty 'MS_Description', '修改日期', 'user', @CurrentUser, 'table', 'tb_MembersLevel', 'column', 'LastUpdateDate' go
打开GZCodeGenerate Debug下的GZCode_Main.exe
添加数据库
1.选择表tb_MembersLevel
2.单结构生成
3.设置主键外键,必须设置,如果没有外键,则跟主键相同,设置哪几列可以修改
4.点击生成Model
生成结果如下
如果namespace不对,则设置运行 目录下CodeModel\Model.cs文件
重新点击生成Model结果如下
将生成的结果保存到GZVIP.Model项目下
同第2步,选择表后点击单表界面生成
生成窗体以后,在D盘根目录下(人懒,没做保存O(∩_∩)O~)
把生成的三个文件放到GZVIP.Dictionary目录下并添加到项目
该引用的引用,
设置框起来的引用复制到本地为false
如果要修改生成代码,在代码生成器运行目录下的CodeModel\Form中
只需相应修改frmBusiness.cs和frmBusiness.Designer.cs
给项目添加一个类DictionaryMain(名字自定义)
DictionaryMain类代码为:
using GZFramworkLibrary.Interface; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace GZVIP.Dictionary { public class DictionaryMain : ModuleFunctionManage { public DictionaryMain() { FunPools.AddFunction(typeof(frm_Level), "等级管理", "Level"); } } }
Level为图片名称,对应图片如下
运行项目,登录进入主界面
管理员登录如图所示,操作,添加模块选Debug\Module目录下的GZVIP.Dictionary.dll
设置模块的排序,功能的排序,后提交
提交成功后会显示系统所有模块
这里也可以设置模块和功能的排序(设置后要提交)
然后无需重启,就能看到左边多了一个字典管理
功能测试:
点击新增
填写后点击保存
会员编号自动生成为L002(递增)
查询界面
最后根据实际需求,对界面进行相应的修改
最终效果如下:
关于GZFramwork快速开发框架
作者:GarsonZhang QQ:382237285
唯一QQ交流群:288706356
欢迎提出您的宝贵意见