Esempio n. 1
0
        public override string GetListSQL(Type type, string strWhere, EFWCoreLib.CoreFrame.DbProvider.SqlPagination.PageInfo pageInfo)
        {
            string strsql = "";
            string fields = "";

            string where = "";
            try
            {
                TableAttributeInfo         tableAttribute            = GetTableAttributeInfo(type);
                List <ColumnAttributeInfo> columnAttributeCollection = tableAttribute.ColumnAttributeInfoList;

                for (int i = 0; i < columnAttributeCollection.Count; i++)
                {
                    ColumnAttributeInfo columnAttributeInfo = columnAttributeCollection[i];
                    fields += (fields == "" ? "" : ",") + columnAttributeInfo.FieldName + " as " + columnAttributeInfo.PropertyName;
                }

                where  = JoinWhere(tableAttribute.IsGB, strWhere);
                strsql = "select {0} from {1} {2}";
                strsql = string.Format(strsql, fields, tableAttribute.TableName + " as T1", where);

                if (pageInfo != null)
                {
                    if (pageInfo.KeyName == null)
                    {
                        pageInfo.KeyName = tableAttribute.DataKeyFieldName;
                    }
                    strsql = EFWCoreLib.CoreFrame.DbProvider.SqlPagination.SqlPage.FormatSql(strsql, pageInfo, Db);
                }
                return(strsql);
            }
            catch (Exception err)
            {
                throw new Exception(err.Message + "SQL:" + strsql);
            }
        }
Esempio n. 2
0
 public override string GetListSQL <T>(string strWhere, EFWCoreLib.CoreFrame.DbProvider.SqlPagination.PageInfo pageInfo)
 {
     return(GetListSQL(typeof(T), strWhere, pageInfo));
 }