关于开发框架字段名管理功能(frmFieldNameMgr类)


关于字段名管理
用于管理和维护表的字段信息以及字段对应的中文名称。通常我们设计数据库是采用英文或拼音定义字段名称的,通过字段名管理,可以定义中文名称,主要用于代码生成器生成程序界面,标签Label组件的Text属性对应中文名称。

通过以下两种方式打开字段名管理界面:
1. 开发框架系统管理模块的【字段名管理】

2. 代码生成器工具菜单的【字段名管理】

若通过代码生成器打开【字段名管理】界面,是通过.NET反射机制动态创建系统管理模块的CSFrameworkV5.SystemModule.frmFieldNameMgr类,创建窗体实例。
C# Code:
/// <summary>
/// 通过反射机制打开系统模块的【字段名管理】界面
/// </summary>
/// <param name="owner"></param>
/// <param name="DB"></param>
/// <param name="tableName"></param>
public static void OpenFieldNameMgr(Form owner, string DB, string tableName)
{
string file = Application.StartupPath + @"\" + Globals.DEF_SYSTEM_MODULE;
if (!File.Exists(file)) throw new CustomException("文件不存在!\r\n" + file);
//通过反射,调用类的静态方法打开窗体
Assembly systemDLL = Assembly.LoadFile(file);
Type T = systemDLL.GetType(GlobalsGenerator.FullName_frmFieldNameMgr_Type, true, true);
if (T != null)
{
//public static void Exceute(Form ownerForm, string dataSetID, string dataSetDBName, string tableName, string loginAccount, bool isExternalCall)
MethodInfo M = T.GetMethod("Exceute");
if (M != null)
M.Invoke(owner, new object[] { owner, MyLoginer.CurrentUser.DataSetID, DB, tableName, MyLoginer.CurrentUser.Account, true });
else
throw new CustomException("没有找到frmFieldNameMgr.Exceute静态方法!");
//测试
//if (M != null) M.Invoke(null, new object[] { this, "CSFrameworkV45_Normal", "tb_AR" , Loginer.CurrentUser});
}
else
throw new CustomException("没有找到" + GlobalsGenerator.FullName_frmFieldNameMgr_Type + "类!");
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
/// 通过反射机制打开系统模块的【字段名管理】界面
/// </summary>
/// <param name="owner"></param>
/// <param name="DB"></param>
/// <param name="tableName"></param>
public static void OpenFieldNameMgr(Form owner, string DB, string tableName)
{
string file = Application.StartupPath + @"\" + Globals.DEF_SYSTEM_MODULE;
if (!File.Exists(file)) throw new CustomException("文件不存在!\r\n" + file);
//通过反射,调用类的静态方法打开窗体
Assembly systemDLL = Assembly.LoadFile(file);
Type T = systemDLL.GetType(GlobalsGenerator.FullName_frmFieldNameMgr_Type, true, true);
if (T != null)
{
//public static void Exceute(Form ownerForm, string dataSetID, string dataSetDBName, string tableName, string loginAccount, bool isExternalCall)
MethodInfo M = T.GetMethod("Exceute");
if (M != null)
M.Invoke(owner, new object[] { owner, MyLoginer.CurrentUser.DataSetID, DB, tableName, MyLoginer.CurrentUser.Account, true });
else
throw new CustomException("没有找到frmFieldNameMgr.Exceute静态方法!");
//测试
//if (M != null) M.Invoke(null, new object[] { this, "CSFrameworkV45_Normal", "tb_AR" , Loginer.CurrentUser});
}
else
throw new CustomException("没有找到" + GlobalsGenerator.FullName_frmFieldNameMgr_Type + "类!");
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761

扫一扫加微信


版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网