public override System.Data.DataSet GetList(Guid treeNodeID, Guid userID, OrderExpression order, List<SearchExpression> searchExpression, PagingInfo pagingInfo)
        {
            Query.Query query = new Query.Query(this);
            query.UserFields = this.GetUserFields(userID, treeNodeID, FieldPlaceHolder.Grid);
            query.OrderExpression = order;

            foreach (SearchExpression expr in searchExpression)
            {
                // InList
                if (expr.FieldID == new Guid("11111111-0000-1111-0000-6097b75f5d3d") && expr.FieldName == "ID")
                {
                    Aspect.Domain.DictionaryTree entity = this.DictionaryTrees.Single(d => d.ID == treeNodeID);
                    expr.FieldName = string.Format("[{0}].[{1}]", entity.Alias, entity.PK);
                }
            }

            query.SearchExpression = this.ValidateSearchExpression(query.UserFields, searchExpression);
            string sql = query.BuildListQuery(treeNodeID);
            using (CommonDataProvider provider = new CommonDataProvider())
            {
                if (pagingInfo.Enabled)
                {
                    StringBuilder cursor = new StringBuilder();
                    cursor.AppendLine("DECLARE @handle int, @rows int;");
                    cursor.AppendLine("EXEC sp_cursoropen @handle OUT,");
                    cursor.AppendFormat("'{0}',", sql.Replace("'", "''"));
                    cursor.AppendLine("1,1,@rows OUT SELECT @rows;");
                    cursor.AppendFormat("EXEC sp_cursorfetch @handle, 16, {0}, {1}\n", pagingInfo.Start + 1, pagingInfo.Limit);
                    cursor.AppendLine("EXEC sp_cursorclose @handle;");
                    return provider.ExecuteCommand(cursor.ToString());
                }
                else
                {
                    return provider.ExecuteCommand(sql);
                }

            }
        }
 public override string getQuery(Guid treeNodeID, Guid userID, OrderExpression order, List<SearchExpression> searchExpression)
 {
     Query.Query query = new Query.Query(this);
     query.UserFields = this.GetUserFields(userID, treeNodeID, FieldPlaceHolder.Grid);
     query.OrderExpression = order;
     query.SearchExpression = this.ValidateSearchExpression(query.UserFields, searchExpression);
     string sql = query.BuildListQuery(treeNodeID);
     return sql;
 }
 public override System.Data.DataRow GetEntity(Guid ID, Guid userID, Guid treeNodeID)
 {
     Query.Query query = new Query.Query(this);
     query.UserFields = this.GetUserFields(userID, treeNodeID, FieldPlaceHolder.GridCard);
     string sql = query.BuildEntityQuery(ID, treeNodeID);
     using (CommonDataProvider provider = new CommonDataProvider())
     {
         System.Data.DataSet ds = provider.ExecuteCommand(sql);
         if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) return ds.Tables[0].Rows[0];
         else return null;
     }
 }