Exemplo n.º 1
0
        public virtual List <T> getlist <T>(PageInfo pageInfo, string where, string alias)
        {
            OrmAnalysis ormAnalysis;

            EFWCoreLib.CoreFrame.DbProvider.AbstractDatabase _oleDb = GetDb();
            ICacheManager _cache      = GetCache();
            string        _pluginName = GetPluginName();

            ormAnalysis                = OrmAnalysisFactory.CreateOrmAnalysisObject(_oleDb.DbType);
            ormAnalysis.Alias          = alias;
            ormAnalysis.Db             = _oleDb;
            ormAnalysis.entityAttrList = (List <EntityAttributeInfo>)EntityManager.GetAttributeInfo(_cache, _pluginName);

            string strsql = ormAnalysis.GetListSQL(this.GetType(), where, pageInfo);

            IDataReader result     = _oleDb.GetDataReader(strsql);
            List <T>    resultList = new List <T>();

            while (result.Read())
            {
                resultList.Add((T)ToObject(result, this, alias));
            }
            result.Close();
            result.Dispose();
            return(resultList);
        }
Exemplo n.º 2
0
        public virtual object getmodel(object key, string alias)
        {
            OrmAnalysis ormAnalysis;

            EFWCoreLib.CoreFrame.DbProvider.AbstractDatabase _oleDb = GetDb();
            ICacheManager _cache      = GetCache();
            string        _pluginName = GetPluginName();

            ormAnalysis                = OrmAnalysisFactory.CreateOrmAnalysisObject(_oleDb.DbType);
            ormAnalysis.Alias          = alias;
            ormAnalysis.Db             = _oleDb;
            ormAnalysis.entityAttrList = (List <EntityAttributeInfo>)EntityManager.GetAttributeInfo(_cache, _pluginName);
            object value  = null;
            object keyVal = key == null?ormAnalysis.GetEntityDataKeyValue(this) : key;

            string strsql = ormAnalysis.GetEntitySQL(this.GetType(), keyVal);

            System.Data.IDataReader result = _oleDb.GetDataReader(strsql);

            if (result.Read())
            {
                value = ToObject(result, this, alias);
            }
            result.Close();
            result.Dispose();

            return(value);
        }
Exemplo n.º 3
0
        public virtual int save(string alias)
        {
            OrmAnalysis ormAnalysis;

            EFWCoreLib.CoreFrame.DbProvider.AbstractDatabase _oleDb = GetDb();
            ormAnalysis                = OrmAnalysisFactory.CreateOrmAnalysisObject(_oleDb.DbType);
            ormAnalysis.Alias          = alias;
            ormAnalysis.Db             = _oleDb;
            ormAnalysis.entityAttrList = (List <EntityAttributeInfo>)EntityManager.GetAttributeInfo(GetCache(), GetPluginName());
            object keyVal = ormAnalysis.GetEntityDataKeyValue(this);

            //?Match="Custom:Guid"
            if (keyVal == null || (keyVal.GetType().Equals(typeof(int)) && Convert.ToInt32(keyVal) == 0))
            {
                string strsql = ormAnalysis.GetInsertSQL(this);
                int    ret    = 0;
                ret = _oleDb.InsertRecord(strsql);
                ormAnalysis.SetEntityValue(ormAnalysis.GetEntityDataKeyPropertyName(this), this, ret);

                return(ret);
            }
            else
            {
                string strsql = ormAnalysis.GetUpdateSQL(this);
                return(_oleDb.DoCommand(strsql));
            }
        }
        public DataTable gettable(PageInfo pageInfo, string where, string alias)
        {
            OrmAnalysis ormAnalysis;

            ormAnalysis                = OrmAnalysisFactory.CreateOrmAnalysisObject(_oleDb.DbType);
            ormAnalysis.Alias          = alias;
            ormAnalysis.Db             = _oleDb;
            ormAnalysis.entityAttrList = (List <EntityAttributeInfo>)EntityManager.GetAttributeInfo(_cache, _pluginName);
            string strsql = ormAnalysis.GetListSQL(this.GetType(), where, pageInfo);

            return(_oleDb.GetDataTable(strsql));
        }
        public int delete(object key, string alias)
        {
            OrmAnalysis ormAnalysis;

            ormAnalysis                = OrmAnalysisFactory.CreateOrmAnalysisObject(_oleDb.DbType);
            ormAnalysis.Alias          = alias;
            ormAnalysis.Db             = _oleDb;
            ormAnalysis.entityAttrList = (List <EntityAttributeInfo>)EntityManager.GetAttributeInfo(_cache, _pluginName);
            object keyVal = key == null?ormAnalysis.GetEntityDataKeyValue(this) : key;

            string strsql = ormAnalysis.GetDeleteSQL(this.GetType(), keyVal);

            return(_oleDb.DoCommand(strsql));
        }
Exemplo n.º 6
0
        public virtual DataTable gettable(PageInfo pageInfo, string where, string alias)
        {
            OrmAnalysis ormAnalysis;

            EFWCoreLib.CoreFrame.DbProvider.AbstractDatabase _oleDb = GetDb();
            ICacheManager _cache      = GetCache();
            string        _pluginName = GetPluginName();

            ormAnalysis                = OrmAnalysisFactory.CreateOrmAnalysisObject(_oleDb.DbType);
            ormAnalysis.Alias          = alias;
            ormAnalysis.Db             = _oleDb;
            ormAnalysis.entityAttrList = (List <EntityAttributeInfo>)EntityManager.GetAttributeInfo(_cache, _pluginName);
            string strsql = ormAnalysis.GetListSQL(this.GetType(), where, pageInfo);

            return(_oleDb.GetDataTable(strsql));
        }
Exemplo n.º 7
0
        public virtual int delete(object key, string alias)
        {
            OrmAnalysis ormAnalysis;

            EFWCoreLib.CoreFrame.DbProvider.AbstractDatabase _oleDb = GetDb();
            ICacheManager _cache      = GetCache();
            string        _pluginName = GetPluginName();

            ormAnalysis                = OrmAnalysisFactory.CreateOrmAnalysisObject(_oleDb.DbType);
            ormAnalysis.Alias          = alias;
            ormAnalysis.Db             = _oleDb;
            ormAnalysis.entityAttrList = (List <EntityAttributeInfo>)EntityManager.GetAttributeInfo(_cache, _pluginName);
            object keyVal = key == null?ormAnalysis.GetEntityDataKeyValue(this) : key;

            string strsql = ormAnalysis.GetDeleteSQL(this.GetType(), keyVal);

            return(_oleDb.DoCommand(strsql));
        }