/// <summary> /// 查询数据. /// 若不分页查询,并且条件集为null, 并且类型特性上说明缓存的, 则走缓存。 /// 否则直接从数据库中查询, 不走缓存。 /// </summary> /// <typeparam name="T">类型值</typeparam> /// <param name="sqlCriteria">条件集</param> /// <param name="orderbyClause">排序集</param> /// <param name="pageIndex">起始页</param> /// <param name="pageSize">页大小</param> /// <param name="recordCount">结果集大小</param> /// <returns>结果集</returns> public List <T> Query <T>(SqlCriteria sqlCriteria, string orderbyClause, int pageIndex, int pageSize, ref int recordCount) where T : class { //if (string.IsNullOrEmpty(orderbyClause)) //{ // orderbyClause = OrmUtil.GetIdentityColumnName<T>(); //} List <T> list = new List <T>(); string tableName = OrmUtil.GetTableName <T>(); if (OrmUtil.CheckCacheFlag <T>()) { RegisterCacheTable(tableName, true); } DataTable dataTable = Query(tableName, "*", sqlCriteria, orderbyClause, pageIndex, pageSize, ref recordCount); if (dataTable != null) { list = ConvertUtil.ConvertDataToObject <T>(dataTable); } return(list); }
/// <summary> /// sql文查询 /// </summary> /// <param name="cmdText">sql文</param> /// <param name="dataAdapter">数据集</param> /// <returns>结果集</returns> public List <T> ExecuteCommand <T>(string cmdText, BeeDataAdapter dataAdapter) { List <T> list = new List <T>(); DataTable dataTable = ExecuteCommand(cmdText, dataAdapter); if (dataTable != null) { list = ConvertUtil.ConvertDataToObject <T>(dataTable); } return(list); }
/// <summary> /// 调用存储过程。 /// 一般不推荐返回值, 直接将该信息反映在结果集中更好。 /// </summary> /// <param name="spName">存储过程名</param> /// <param name="dataAdapter">数据集</param> /// <returns>返回结果集</returns> public List <T> CallSP <T>(string spName, BeeDataAdapter dataAdapter) { List <T> list = new List <T>(); DataTable dataTable = CallSP(spName, dataAdapter); if (dataTable != null) { list = ConvertUtil.ConvertDataToObject <T>(dataTable); } return(list); }
private WeiXinInvokeTree FindCurrentInvoke(BeeDataAdapter dataAdapter) { WeiXinInvokeTree result = null; string fromUserName = dataAdapter.TryGetValue <string>("fromusername", string.Empty); InvokeContext currentContext = InvokeContextManager.Instance.CurrentContext(fromUserName); // 调用链目前仅仅关心到菜单起始的文本输入链 string currentCommand = dataAdapter.TryGetValue <string>("content", string.Empty); if (string.IsNullOrEmpty(currentCommand)) { currentCommand = dataAdapter.TryGetValue <string>("eventkey", string.Empty); } string eventName = dataAdapter.TryGetValue <string>("event", string.Empty); if (string.Compare("click", eventName, true) == 0) { currentContext.MessageStack.Clear(); } WeiXinInvokeTree parentInvokeTree = null; int parentId = 0; List <string> list = (from item in currentContext.MessageStack select item.InvokeTreeName).ToList(); list.Reverse(); foreach (string item in list) { parentInvokeTree = FindChild(parentId, item); if (parentInvokeTree != null) { parentId = parentInvokeTree.Id; } else { break; } } if (parentInvokeTree != null) { parentId = parentInvokeTree.Id; } result = FindChild(parentId, currentCommand); if (result == null) { result = FindChild(parentId, "*"); } if (result == null) { result = parentInvokeTree; } else { dataAdapter["createtime"] = DateTimeUtil.GetDateTimeFromXml(dataAdapter["createtime"].ToString()); RequestMessage message = ConvertUtil.ConvertDataToObject <RequestMessage>(dataAdapter); message.InvokeTreeName = result.Name; currentContext.MessageStack.Push(message); } return(result); }