1、核心模块(Nello)
类AppSettings提供以下静态方法:
//Windows应用程序用此方法访问App.config的AppSettings配置项,Web应用程序用此方法访问Web.config的AppSettings配置项
public static string Get(string key)
类ClassFactory提供以下方法:
//获取网站类文件(AppCode目录下的类文件)所在的程序集
public static System.Reflection.Assembly GetAppCodeAssembly()
//根据提供者名称获取数据库提供者工厂类
public static System.Data.Common.DbProviderFactory GetDbProviderFactory(string providername)
//从指定程序集获取指定类名的类的实例并根据类型参数进行转换
public static T GetObject<T>(string assemblyName, string className)
//从AppCode程序集获取指定类名的类的实例并根据类型参数进行转换
public static T GetObject<T>(string className)
//从指定程序集获取指定类名的类型
public static System.Type GetTypeByName(string assemblyName, string className)
//从AppCode程序集获取指定类名的类型
public static System.Type GetTypeByName(string className)
//调用指定对象的方法
public static void Invoke(object obj, string methodName)
//从配置文件中获取连接字符串
public static string ConnectionString { get; }
//从配置文件中获取数据库提供者工厂类
public static System.Data.Common.DbProviderFactory DbProviderFactory { get; }
类DataTypeUtil提供以下方法:
//从对象中获取指定类型的值
public static object GetValue(Nello.DataType dataType, object value)
类DataUtil提供以下方法:
//执行交叉表查询
//参数:
//srcTable: 源表,即要返回的表
//destTable: 目的表,即要从中获取数据的表
//srcKey: 源表中要与目的表关联的外键字段名
//destKey: 目的表中要与源表外键关联的主键字段名
//destColName: 要从目的表获取的值对应的字段名
//newColName: 源表中要增加的新字段名称
public static System.Data.DataTable DoCrossTableQuery(System.Data.DataTable srcTable, System.Data.DataTable destTable, string srcKey, string destKey, string destColName, string newColName)
//当源表跟目的表不是同一个表时,可使用此重载
public static System.Data.DataTable DoCrossTableQuery(System.Data.DataTable srcTable, System.Data.DataTable destTable, string srcKey, string destKey, string destColName)
//当源表跟目的表不是同一个表且源表跟目的表键名相同时,可使用此重载
public static System.Data.DataTable DoCrossTableQuery(System.Data.DataTable srcTable, System.Data.DataTable destTable, string keyName, string destColName)
//将DataRow中的数据写入object中
public static void ExchangeData(object obj, System.Data.DataRow row)
//将object中的数据按照指定的传递类型(全部传递或匹配传递)传递至DataRow中
public static void ExchangeData(System.Data.DataRow row, object obj, Nello.ExchangeType et)
//将object中的数据匹配传递至DataRow中
public static void ExchangeData(System.Data.DataRow row, object obj)
//将Hashtable中的数据按照指定的传递类型(全部传递或匹配传递)传递至DataRow中
public static void ExchangeData(System.Data.DataRow row, System.Collections.Hashtable ht, Nello.ExchangeType et)
//将DataRow中的数据按照指定的传递类型(全部传递或匹配传递)传递至Hashtable中
public static void ExchangeData(System.Collections.Hashtable ht, System.Data.DataRow row, Nello.ExchangeType et)
//将Hashtable中的数据匹配传递至DataRow中
public static void ExchangeData(System.Data.DataRow row, System.Collections.Hashtable ht)
//将DataRow中的数据匹配传递至Hashtable中
public static void ExchangeData(System.Collections.Hashtable ht, System.Data.DataRow row)
//获取DataTable中指定行的数据
public static System.Collections.ArrayList GetArrayList(System.Data.DataRow row)
//获取DataTable中指定列的数据
public static System.Collections.ArrayList GetArrayList(System.Data.DataColumn col)
//将DataTable进行分页
public static System.Data.DataTable GetDataTabePerPage(System.Data.DataTable dt, int index, int size)
//将Hashtable解析为字符串,用于暂存
public static string Parse(System.Collections.Hashtable ht)
//将字符串解析为Hashtable,用于取暂存
public static System.Collections.Hashtable Parse(string str)
类DateUtil提供以下方法:
//将字符串解析为DateTime对象
public static System.DateTime GetDateTime(string s)
//将当前日期时间按yyyyMMddHHmmss的格式转换为字符串
public static string GetNowString()
//将日期按指定的格式转换为字符串
public static string GetString(System.DateTime dt, string format)
//根据DateTime对象获取星期值
public static string GetWeek(System.DateTime dt)
//获取当前日期的星期值
public static string GetWeek()
类DESUtil提供以下方法:
//使用指定的密钥解密已加密的字符串
public static string Decrypt(string origin, string key)
//使用默认的密钥解密已加密的字符串
public static string Decrypt(string origin)
//使用指定的密钥加密字符串
public static string Encrypt(string origin, string key)
//使用默认的密钥加密字符串
public static string Encrypt(string origin)
//默认的密钥
public const string KEY
类ExcelUtil提供以下方法:
// DataTable导出至Excel并以指定的文件名下载到客户端
public static void Export(System.Data.DataTable dt, string fileName)
// DataTable导出至Excel并以默认的文件名下载到客户端
public static void Export(System.Data.DataTable dt)
// DataTable导出至Excel并在客户端Excel应用程序中打开
public static void ExportToExcel(System.Data.DataTable dt)
//将服务器端Excel文件导入至DataTable
public static System.Data.DataTable Import(string fullPath)
类FileUtil提供以下方法:
//将字符串写入文件中,若文件不存在则创建文件
public static void AppendText(string path, string text)
//使用二进制格式的响应将服务器端文件下载到客户端
public static void DownloadFile(string fullPath)
//得到指定目录下的文件列表 FileUtil.GetFileNames(Request.PhysicalApplicationPath, new string[] { ".aspx"});
public static System.Collections.ArrayList GetFileNames(string startpath, params string[] filetypes)
//打开一个文本文件,读取文件的所有行,然后关闭该文件。
public static string ReadAllText(string path)
//上传文件到服务器端指定的目录下面 上传的文件有页面上的Files控件指定
public int UploadFile(string folder, out System.Collections.ArrayList lstFileName, out string fileDescription)
类HashUtil提供以下方法:
//返回经过MD5加密的不含分隔符的字符串的小写副本
public static string GetMD5(string inputString)
//返回经过SHA1加密的不含分隔符的字符串的小写副本
public static string GetSHA1(string inputString)
接口IconnectionInfo提供了基本的获取连接字符串的方法,应用程序可通过实现此接口自由地定义获取连接字符串的方法:
//获取或设置连接字符串
string ConnectionString { set; get; }
类StringUtil提供以下方法:
//得到8位的由字母或数字组成的随机字符串
public static string GetRandomString()
//得到指定长度的由字母或数字组成的随机字符串
public static string GetRandomString(int bits)
//根据模板字符串得到相应的随机字符串
public static string GetRandomString(string template)
//使用指定的分隔符将集合组合成字符串
public static string Join(string sep, System.Collections.ICollection co)
//使用逗号(,)将集合组合成字符串
public static string Join(System.Collections.ICollection co)
//使用指定的分隔符和引号符将枚举数组合成字符串
public static string Join(string sep, System.Collections.IEnumerable enu, string quot)
//使用指定的分隔符将枚举数组合成字符串
public static string Join(string sep, System.Collections.IEnumerable enu)
//使用逗号(,)将枚举数组合成字符串
public static string Join(System.Collections.IEnumerable enu)
//使用指定的分隔符将键值对组合成字符串
public static string Join(string sep, System.Collections.IDictionary dic)
//使用分隔号(|)将键值对组合成字符串
public static string Join(System.Collections.IDictionary dic)
类Util提供以下方法:
//将一个或多个枚举常数的名称或数字值的字符串表示转换成等效的枚举对象。
public static T GetEnum<T>(object enumobj)
//获取由正则表达式匹配的组的值列表。
public static System.Collections.Generic.List<string> GetGroupValues(string text, string pattern)
//判断字符串是否为中文
public static bool IsChinese(string inputstr)
//判断字符串是否为Guid
public static bool IsGuid(string s)
//返回一个只含有字母和数字的全局统一标识符字符串
public static string NewGuid()
2、DAO模块(Nello.Data)
类Business提供以下方法:
//根据表示层传入的数据对数据库进行新增操作
public static int Add(System.Collections.Hashtable ht, string tableName)
//根据表示层传入的项目ID删除一行数据库记录
public static int Delete(string tableName, string key, string value)
//根据表示层传入的项目ID返回一行数据库记录
public static System.Data.DataTable GetItem(string tableName, string key, string value)
//返回指定数据库表的所有记录
public static System.Data.DataTable GetItems(string tableName)
//根据表示层传入的数据对数据库进行修改操作
public static int Modify(System.Collections.Hashtable ht, string tableName, string keyName)
//设置当前记录为删除状态
public static int Remove(string tableName, string key, string value)
类Linker提供以下方法:
//添加参数
public void AddParameter(System.Data.DbType dbtype, System.Data.ParameterDirection
direction, string name, object value)
//添加输入参数
public void AddParameter(System.Data.DbType dbtype, string name, object value)
//添加字符串型的输入参数
public void AddParameter(string name, object value)
//执行查询语句并返回结果集中第一行的第一列
public object ExecuteScalar(string sql)
//执行查询语句并返回结果集中第一行
public System.Data.DataRow ExecuteDataRow(string sql)
//执行查询语句并返回结果集
public System.Data.DataTable ExecuteDataTable(string sql)
//执行查询语句并返回DataSet结果集
public System.Data.DataSet ExecuteDataSet(string sql)
//执行SQL语句并返回受影响的行数
public int ExecuteNonQuery(string sql)
//建立并打开一个基于事务的连接
public void Open()
//提交事务
public void Commit()
//回滚事务
public void Rollback()
//关闭连接
public void Close()
//获取或设置SQL命令类型
public System.Data.CommandType CommandType { set; get; }
//获取或设置连接字符串
public string ConnectionString { set; get; }
//获取或设置数据提供程序工厂类
public System.Data.Common.DbProviderFactory DbProviderFactory { set; get; }
类LinkerUtil提供以下方法:
//使用默认连接字符串执行查询语句并返回结果集中第一行
public static System.Data.DataRow ExecuteDataRow(string s)
//使用指定连接字符串执行查询语句并返回结果集中第一行
public static System.Data.DataRow ExecuteDataRow(string cnnStr, string s)
//使用默认连接字符串执行查询语句并返回DataSet结果集
public static System.Data.DataSet ExecuteDataSet(string s)
//使用指定连接字符串执行查询语句并返回DataSet结果集
public static System.Data.DataSet ExecuteDataSet(string cnnStr, string s)
//使用默认连接字符串执行查询语句并返回结果集
public static System.Data.DataTable ExecuteDataTable(string s)
//使用指定连接字符串执行查询语句并返回结果集
public static System.Data.DataTable ExecuteDataTable(string cnnStr, string s)
//使用默认连接字符串执行SQL语句并返回受影响的行数
public static int ExecuteNonQuery(string s)
//使用指定连接字符串执行SQL语句并返回受影响的行数
public static int ExecuteNonQuery(string cnnStr, string s)
//使用默认连接字符串执行查询语句并返回结果集中第一行的第一列
public static object ExecuteScalar(string s)
//使用指定连接字符串执行查询语句并返回结果集中第一行的第一列
public static object ExecuteScalar(string cnnStr, string s)
类SqlUtil提供以下方法:
//将键值转换为insert语句的字段列表
public static string JoinKeys(System.Collections.Hashtable ht)
//将键值对转换为update语句的主体
public static string JoinPairs(System.Collections.Hashtable ht)
//将值转换为insert语句的值列表
public static string JoinValues(System.Collections.Hashtable ht)
//按给定内容连接Where子句
public static string JoinWheres(System.Collections.Hashtable ht)
//获取并删除实体中的键值,用于update语句
public static string PopItem(System.Collections.Hashtable ht, string key)
3、WEB模块(Nello.Web)
接口IDataControl为Nello框架WEB控件提供了基本的属性以支持生成SQL语句:
// 该控件的数据类型
Nello.DataType DataType { set; get; }
//该控件的值
object DataValue { set; get; }
//是否在框架中忽略此控件
bool IsIgnore { set; get; }
类JavaScript提供以下方法:
//窗体元素加载完时触发指定的脚本,可在脚本中引用窗体元素
public static void Run(System.Web.UI.Page page, string pScript)
//页面刚加载时触发指定的脚本,不可在脚本中引用页面元素
public static void Run(string pScript)
//将脚本添加至窗体的开始标记之后
public static void AddToFormBegin(System.Web.UI.Page page, string pScript)
//将脚本添加至窗体的结束标记之前
public static void AddToFormEnd(System.Web.UI.Page page, string pScript)
//弹出对话框显示指定的消息
public static void Alert(string msg)
//弹出对话框显示指定的消息
public static void Alert(System.Web.UI.Page page, string msg)
//弹出对话框显示指定的消息并重定向至指点定的URL
public static void AlertAndRedirect(string msg, string url)
//关闭窗口
public static void CloseWindow()
//不缓存页面
public static void NoCache()
//根据键名获取已解密的Cookie值
public static string GetCookie(string pName)
//根据键名获取Cookie值
public static string GetCookie(string pName, bool isEnc)
//使用默认有效天数存储Cookie
public static void SetCookie(string pName, string pValue, bool isEnc)
//以加密的方式存储Cookie
public static void SetCookie(string pName, string pValue, double days)
//存储Cookie
public static void SetCookie(string pName, string pValue, double days, bool isEnc)
//使指定控件获得焦点
public static void SetFocus(System.Web.UI.Page page, System.Web.UI.Control ctl)
//根据指定参数打开窗口
public static void Open(System.Web.UI.Page page, string pURL, int height, int width, int top, int left)
//在默认位置打开默认大小的窗口
public static void Open(System.Web.UI.Page page, string pURL)
//根据指定参数打开窗口
public static void Open(string pURL, int height, int width, int top, int left)
//在默认位置打开默认大小的窗口
public static void Open(string pURL)
//重定向至指定的页面
public static void Redirect(System.Web.UI.Page page, string url)
类MenuWrapper提供以下方法:
//获取或设置数据源
public System.Data.DataTable Datasource { set; get; }
//按顺序设置数据源的字段名
public string FieldNames { set; get; }
//获取或设置树控件
public System.Web.UI.WebControls.Menu MenuControl { set; get; }
//获取或设置根ID
public string RootId { set; get; }
//呈现控件
public void Render()
类PageUtil提供以下方法:
//给页面上的模板变量赋值
public static void Assign(System.Web.UI.Control container, string key, string value)
//将实体值从页面传至Hashtable
public static void ExchangeData(System.Collections.Hashtable ht, System.Web.UI.Page page)
//将实体值从Hashtable传至页面
public static void ExchangeData(System.Web.UI.Page page, System.Collections.Hashtable ht)
//将数据表从DataTable传至页面
public static void ExchangeData(System.Web.UI.Page page, System.Data.DataTable dt)
//获取控件列表内的所有控件的名称列表
public static List<string> GetControlNames(List< System.Web.UI.Control> controls)
//获取指定容器内的所有控件列表
public static List<Control> GetControls(System.Web.UI.Control container)
//设置指定容器内控件的有效性
public static void SetEnabled(System.Web.UI.Control container, bool enabled)
类TreeViewWrapper提供以下方法:
//呈现控件
public void Render()
//设置树所有节点的选中状态
public static void SetChecked(System.Web.UI.WebControls.TreeNodeCollection nodes)
//将列表中的值对应的树节点设置为选中状态
public static void SetNodesChecked(System.Web.UI.WebControls.TreeNodeCollection nodes, System.Collections.IList nodevalues)
//设置树所有节点的为未选中状态
public static void UnCheckedAll(System.Web.UI.WebControls.TreeNodeCollection nodes)
//获取或设置树控件的数据源
public System.Data.DataTable Datasource { set; get; }
//获取或设置树控件的字段列表
public string FieldNames { set; get; }
//获取或设置根ID
public string RootId { set; get; }
//获取或设置树控件
public System.Web.UI.WebControls.TreeView TreeView { set; get; }
类WebUtil提供以下方法:
//获取WEB应用程序BIN目录的路径
public static string BinDirectory { get; }
//获取当前页面的名称
public static string PageName { get; }
//获取网站目录的路径
public static string WebSiteDirectory { get; }
4、WEB控件模块(Nello.Web.WebControls)
WEB控件ContextMenu提供以下方法:
//设置菜单,示例:"新建,打开,修改,保存"
public void SetMenus(string smenus)
//设置上下文菜单的源控件
public void SetSource(System.Web.UI.WebControls.WebControl ctl)
//菜单Click事件
public event Nello.Web.Controls.ContextMenu.ClickEventHandle MenuClick
WEB控件ModalDialog提供以下方法:
//为URL添加QueryString
public void AddQueryString(string sKey, string sValue)
//显示模式对话框
public void Open(string url, int width, int height)
//显示默认大小的模式对话框
public void Open(string url)
//显示模式对话框并设置窗体类型为新增
public void OpenAdd(string url, int width, int height)
//显示默认大小的模式对话框并设置窗体类型为新增
public void OpenAdd(string url)
//显示模式对话框并设置窗体类型为修改
public void OpenEdit(string url, int width, int height)
//显示默认大小的模式对话框并设置窗体类型为修改
public void OpenEdit(string url)
//关闭模式对话框并返回指定值
public static void ReturnBack(System.Web.UI.Page page, string returnValue)
//模式对话框返回(即Text属性改变)时触发
public event Nello.Web.Controls.ModalDialog.ReturnEventHandler Return
WEB输入控件由以下部分组成:Ncalendar为日历选择控件,NcheckBox为复选框控件,NTextBox为文本框控件, NDropDownList为下拉框控件,Ncommand为输入控件的支持控件。
WEB输出控件由以下部分组成:NGridView为数据网格控件,NPager为分页控件。