コード例 #1
0
ファイル: ManMessage.cs プロジェクト: guojianbin/buffalobro
 /// <summary>
 /// 初始化本类的信息
 /// </summary>
 /// <param name="entityInfo">类信息</param>
 public MyClass_ManMessage(BQLEntityTableHandle parent, string propertyName)
     : base(EntityInfoManager.GetEntityHandle(typeof(TestAddIn.ManMessage)), parent, propertyName)
 {
     _title      = CreateProperty("Title");
     _content    = CreateProperty("Content");
     _belongUser = CreateProperty("BelongUser");
 }
コード例 #2
0
ファイル: BQLDbBase.cs プロジェクト: guojianbin/buffalobro
        /// <summary>
        /// 查询表
        /// </summary>
        /// <typeparam name="E"></typeparam>
        /// <param name="lstScope">条件</param>
        /// <returns></returns>
        public List <E> SelectList <E>(ScopeList lstScope)
            where E : EntityBase, new()
        {
            Type                 eType   = typeof(E);
            List <E>             retlist = null;
            BQLEntityTableHandle table   = _oper.DBInfo.FindTable(eType);

            if (CommonMethods.IsNull(table))
            {
                _oper.DBInfo.ThrowNotFondTable(eType);
            }
            BQLQuery BQL = GetSelectSql(lstScope, table);

            if (!lstScope.HasPage)
            {
                retlist = QueryList <E>(BQL, lstScope.ShowEntity, lstScope.UseCache);
                DataAccessCommon.FillEntityChidList(retlist, lstScope);
                return(retlist);
            }
            using (BatchAction ba = _oper.StarBatchAction())
            {
                retlist = QueryPageList <E>(BQL, lstScope.PageContent, lstScope.ShowEntity, lstScope.UseCache);
                DataAccessCommon.FillEntityChidList(retlist, lstScope);
                return(retlist);
            }
        }
コード例 #3
0
        public TableAliasNameManager(BQLEntityTableHandle pEntityinfo)
        {
            _primaryTable = new AliasTableMapping(pEntityinfo, this, null);
            string key = pEntityinfo.GetEntityKey();

            _dicKeyTable[key] = _primaryTable;
        }
コード例 #4
0
ファイル: DataAccessCommon.cs プロジェクト: radtek/buffalobro
        /// <summary>
        /// 填充子集合
        /// </summary>
        /// <param name="showTable"></param>
        /// <param name="?"></param>
        public static void FillEntityChidList(IList lst, ShowChildItem showTable)
        {
            Stack <BQLEntityTableHandle> stkTables = new Stack <BQLEntityTableHandle>();
            BQLEntityTableHandle         curTable  = showTable.ChildItem;

            while (true)
            {
                stkTables.Push(curTable);
                curTable = curTable.GetParentTable();
                if (CommonMethods.IsNull(curTable) || string.IsNullOrEmpty(curTable.GetPropertyName()))
                {
                    break;
                }
            }
            IEnumerable    curList     = lst;
            Queue <object> lastObjects = new Queue <object>();
            ScopeList      empty       = new ScopeList();

            while (stkTables.Count > 0)
            {
                BQLEntityTableHandle table    = stkTables.Pop();
                ScopeList            lstScope = null;
                if (stkTables.Count == 0)
                {
                    lstScope = showTable.FilterScope;
                }
                else
                {
                    lstScope = empty;
                }
                FillEntityChidList(curList, table.GetPropertyName(), lastObjects, table.GetParentTable().GetEntityInfo().EntityType, lstScope);
                curList     = lastObjects;
                lastObjects = new Queue <object>();
            }
        }
コード例 #5
0
 /// <summary>
 /// 初始化本类的信息
 /// </summary>
 /// <param name="entityInfo">类信息</param>
 public MyClass_ManBase(BQLEntityTableHandle parent, string propertyName)
     : base(EntityInfoManager.GetEntityHandle(typeof(TestAddIn.ManBase)), parent, propertyName)
 {
     _id         = CreateProperty("Id");
     _state      = CreateProperty("State");
     _lastUpdate = CreateProperty("LastUpdate");
 }
コード例 #6
0
ファイル: DBInfo.cs プロジェクト: radtek/buffalobro
        /// <summary>
        /// 通过实体类型查找对应的BQL表信息
        /// </summary>
        /// <param name="entityType"></param>
        /// <returns></returns>
        public BQLEntityTableHandle FindTable(string fullName)
        {
            BQLEntityTableHandle ret = null;

            _dicTables.TryGetValue(fullName, out ret);
            return(ret);
        }
コード例 #7
0
 /// <summary>
 /// 初始化本类的信息
 /// </summary>
 /// <param name="parent">父表信息</param>
 /// <param name="propertyName">属性名</param>
 public Management_View_GoodsShelf_Storage(Type entityType, BQLEntityTableHandle parent, string propertyName)
     : base(entityType, parent, propertyName)
 {
     _storageName = CreateProperty("StorageName");
     _goodShelf   = CreateProperty("GoodShelf");
     _id          = CreateProperty("Id");
 }
コード例 #8
0
        /// <summary>
        /// 查找所属的表映射信息
        /// </summary>
        /// <returns></returns>
        private AliasTableMapping FindMapping(BQLEntityTableHandle table)
        {
            AliasTableMapping ret = null;
            string            key = table.GetEntityKey();

            _dicKeyTable.TryGetValue(key, out ret);
            return(ret);
        }
コード例 #9
0
ファイル: BarCodeGauge.cs プロジェクト: guojianbin/buffalobro
 /// <summary>
 /// 初始化本类的信息
 /// </summary>
 /// <param name="parent">父表信息</param>
 /// <param name="propertyName">属性名</param>
 public Management_BarCodeGauge(Type entityType, BQLEntityTableHandle parent, string propertyName)
     : base(entityType, parent, propertyName)
 {
     _id              = CreateProperty("Id");
     _customCode      = CreateProperty("CustomCode");
     _state           = CreateProperty("State");
     _maxSerialnumber = CreateProperty("MaxSerialnumber");
 }
コード例 #10
0
        //private Dictionary<string, EntityBase> _dicInstance = new Dictionary<string, EntityBase>();//已经实例化的实体

        //private IList _baseList;

        /// <summary>
        /// 别名映射
        /// </summary>
        /// <param name="table"></param>
        /// <param name="aliasName"></param>
        public AliasTableMapping(BQLEntityTableHandle table, TableAliasNameManager belongManager, EntityMappingInfo mappingInfo)
        {
            _belongManager = belongManager;
            _entityInfo    = table.GetEntityInfo();
            _table         = new BQLAliasHandle(table, _belongManager.NextTableAliasName());
            _mappingInfo   = mappingInfo;
            InitParam(table);
        }
コード例 #11
0
        /// <summary>
        /// 添加一个项
        /// </summary>
        /// <param name="prm">查询子项</param>
        public new void Add(BQLEntityTableHandle prm)
        {
            ShowChildItem item = new ShowChildItem();

            item.ChildItem   = prm;
            item.FilterScope = new ScopeList();
            base.Add(item);
        }
コード例 #12
0
        /// <summary>
        /// 添加一个项
        /// </summary>
        /// <param name="prm">查询子项</param>
        /// <param name="filter">筛选条件</param>
        public void Add(BQLEntityTableHandle prm, ScopeList filter)
        {
            ShowChildItem item = new ShowChildItem();

            item.ChildItem   = prm;
            item.FilterScope = filter;
            base.Add(item);
        }
コード例 #13
0
ファイル: ManEmployee.cs プロジェクト: guojianbin/buffalobro
 /// <summary>
 /// 初始化本类的信息
 /// </summary>
 /// <param name="entityInfo">类信息</param>
 public MyClass_ManEmployee(BQLEntityTableHandle parent, string propertyName)
     : base(EntityInfoManager.GetEntityHandle(typeof(TestAddIn.ManEmployee)), parent, propertyName)
 {
     _name    = CreateProperty("Name");
     _pwd     = CreateProperty("Pwd");
     _classId = CreateProperty("ClassId");
     _remark  = CreateProperty("Remark");
     _IDCard  = CreateProperty("IDCard");
 }
コード例 #14
0
 /// <summary>
 /// 初始化本类的信息
 /// </summary>
 /// <param name="parent">父表信息</param>
 /// <param name="propertyName">属性名</param>
 public Management_SampleGression(Type entityType, BQLEntityTableHandle parent, string propertyName)
     : base(entityType, parent, propertyName)
 {
     _id             = CreateProperty("Id");
     _sampleCode     = CreateProperty("SampleCode");
     _storageId      = CreateProperty("StorageId");
     _goodShelfId    = CreateProperty("GoodShelfId");
     _goodLocationId = CreateProperty("GoodLocationId");
 }
コード例 #15
0
ファイル: DBInfo.cs プロジェクト: radtek/buffalobro
        /// <summary>
        /// 添加到库信息
        /// </summary>
        /// <param name="table"></param>
        internal void AddToDB(BQLEntityTableHandle table)
        {
            string key = table.GetEntityInfo().EntityType.FullName;

            if (!_dicTables.ContainsKey(key))
            {
                _dicTables[key] = table;
            }
        }
コード例 #16
0
 /// <summary>
 /// 初始化本类的信息
 /// </summary>
 /// <param name="parent">父表信息</param>
 /// <param name="propertyName">属性名</param>
 public Management_SampleBack(Type entityType, BQLEntityTableHandle parent, string propertyName)
     : base(entityType, parent, propertyName)
 {
     _id         = CreateProperty("Id");
     _sampleCode = CreateProperty("SampleCode");
     _userId     = CreateProperty("UserId");
     _backTime   = CreateProperty("BackTime");
     _b_remark   = CreateProperty("B_remark");
 }
コード例 #17
0
 /// <summary>
 /// 初始化本类的信息
 /// </summary>
 /// <param name="parent">父表信息</param>
 /// <param name="propertyName">属性名</param>
 public Management_GoodsLocation(Type entityType, BQLEntityTableHandle parent, string propertyName)
     : base(entityType, parent, propertyName)
 {
     _id           = CreateProperty("Id");
     _locationCode = CreateProperty("LocationCode");
     _boxNum       = CreateProperty("BoxNum");
     _goodsShelfId = CreateProperty("GoodsShelfId");
     _storageId    = CreateProperty("StorageId");
     _remark       = CreateProperty("Remark");
 }
コード例 #18
0
        /// <summary>
        /// 输出别名表
        /// </summary>
        /// <param name="paramHandle"></param>
        /// <returns></returns>
        public string GetTableAliasName(BQLEntityTableHandle table)
        {
            AliasTableMapping mapping = FindMapping(table);

            if (mapping != null)
            {
                return(mapping.TableInfo.GetAliasName());
            }
            return(null);
        }
コード例 #19
0
 /// <summary>
 /// 初始化本类的信息
 /// </summary>
 /// <param name="parent">父表信息</param>
 /// <param name="propertyName">属性名</param>
 public Management_SampleRecord(Type entityType, BQLEntityTableHandle parent, string propertyName)
     : base(entityType, parent, propertyName)
 {
     _id         = CreateProperty("Id");
     _s_userId   = CreateProperty("S_userId");
     _sampleCode = CreateProperty("SampleCode");
     _s_remark   = CreateProperty("S_remark");
     _employTime = CreateProperty("EmployTime");
     _recordType = CreateProperty("RecordType");
 }
コード例 #20
0
ファイル: OutRecode.cs プロジェクト: guojianbin/buffalobro
 /// <summary>
 /// 初始化本类的信息
 /// </summary>
 /// <param name="parent">父表信息</param>
 /// <param name="propertyName">属性名</param>
 public Management_OutRecode(Type entityType, BQLEntityTableHandle parent, string propertyName)
     : base(entityType, parent, propertyName)
 {
     _id             = CreateProperty("Id");
     _sampleBarCode  = CreateProperty("SampleBarCode");
     _storageId      = CreateProperty("StorageId");
     _goodShelfId    = CreateProperty("GoodShelfId");
     _goodLocationId = CreateProperty("GoodLocationId");
     _outTime        = CreateProperty("OutTime");
     _userId         = CreateProperty("UserId");
 }
コード例 #21
0
 /// <summary>
 /// 初始化本类的信息
 /// </summary>
 /// <param name="parent">父表信息</param>
 /// <param name="propertyName">属性名</param>
 public Management_View_Message(Type entityType, BQLEntityTableHandle parent, string propertyName)
     : base(entityType, parent, propertyName)
 {
     _id         = CreateProperty("Id");
     _state      = CreateProperty("State");
     _lastUpdate = CreateProperty("LastUpdate");
     _title      = CreateProperty("Title");
     _content    = CreateProperty("Content");
     _belongUser = CreateProperty("BelongUser");
     _userName   = CreateProperty("UserName");
 }
コード例 #22
0
        /// <summary>
        /// 添加一个项
        /// </summary>
        /// <param name="prm">查询子项</param>
        /// <param name="filter">筛选条件</param>
        public void Add(BQLEntityTableHandle prm, BQLCondition filterCondition)
        {
            ScopeList filter = new ScopeList();

            filter.Add(filterCondition);
            ShowChildItem item = new ShowChildItem();

            item.ChildItem   = prm;
            item.FilterScope = filter;
            base.Add(item);
        }
コード例 #23
0
 /// <summary>
 /// 初始化本类的信息
 /// </summary>
 /// <param name="entityInfo">类信息</param>
 public MyClass_ManUsers(BQLEntityTableHandle parent, string propertyName)
     : base(EntityInfoManager.GetEntityHandle(typeof(TestAddIn.ManUsers)), parent, propertyName)
 {
     _name     = CreateProperty("Name");
     _remark   = CreateProperty("Remark");
     _userType = CreateProperty("UserType");
     _classId  = CreateProperty("ClassId");
     _image    = CreateProperty("Image");
     _age      = CreateProperty("Age");
     _password = CreateProperty("Password");
 }
コード例 #24
0
        /// <summary>
        /// 添加子表
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        public bool AddChildTable(BQLEntityTableHandle table)
        {
            string key = table.GetEntityKey();
            bool   ret = false;

            if (!_dicKeyTable.ContainsKey(key))
            {
                _dicKeyTable[key] = _primaryTable.AddChildTable(table);
                ret = true;
            }
            return(ret);
        }
コード例 #25
0
ファイル: Users.cs プロジェクト: guojianbin/buffalobro
 /// <summary>
 /// 初始化本类的信息
 /// </summary>
 /// <param name="parent">父表信息</param>
 /// <param name="propertyName">属性名</param>
 public Management_Users(Type entityType, BQLEntityTableHandle parent, string propertyName)
     : base(entityType, parent, propertyName)
 {
     _id        = CreateProperty("Id");
     _userID    = CreateProperty("UserID");
     _userName  = CreateProperty("UserName");
     _userPwd   = CreateProperty("UserPwd");
     _storageId = CreateProperty("StorageId");
     _authority = CreateProperty("Authority");
     _isEnable  = CreateProperty("IsEnable");
     _classId   = CreateProperty("ClassId");
 }
コード例 #26
0
        /// <summary>
        /// 获取本次查询需要显示的字段集合
        /// </summary>
        /// <param name="lstScope">范围查询集合</param>
        /// <returns></returns>
        private static string GetSelectParams(ScopeList lstScope)
        {
            if (lstScope == null)
            {
                return(AllParamNames);
            }

            StringBuilder ret = new StringBuilder();

            BQLEntityTableHandle table = CurEntityInfo.DBInfo.FindTable(typeof(T));

            if (CommonMethods.IsNull(table))
            {
                CurEntityInfo.DBInfo.ThrowNotFondTable(typeof(T));
            }
            List <BQLParamHandle> propertyNames = lstScope.GetShowProperty(table);


            if (propertyNames.Count > 0)
            {
                foreach (BQLParamHandle property in propertyNames)
                {
                    BQLEntityParamHandle eproperty = property as BQLEntityParamHandle;
                    if (CommonMethods.IsNull(eproperty))
                    {
                        continue;
                    }
                    EntityPropertyInfo info = eproperty.PInfo;
                    if (info != null)
                    {
                        ret.Append(CurEntityInfo.DBInfo.CurrentDbAdapter.FormatParam(info.ParamName) + ",");
                    }
                }
            }
            else
            {
                foreach (EntityPropertyInfo info in CurEntityInfo.PropertyInfo)
                {
                    if (info != null)
                    {
                        ret.Append(CurEntityInfo.DBInfo.CurrentDbAdapter.FormatParam(info.ParamName) + ",");
                    }
                }
            }


            if (ret.Length > 0)
            {
                return(ret.ToString(0, ret.Length - 1));
            }
            return(AllParamNames);
        }
コード例 #27
0
ファイル: BQLDbBase.cs プロジェクト: guojianbin/buffalobro
        /// <summary>
        /// 执行sql语句,返回Reader
        /// </summary>
        /// <param name="sql">sql语句</param>
        /// <param name="objPage">分页对象</param>
        public IDataReader QueryReader(ScopeList lstScope, Type tableType)
        {
            BQLEntityTableHandle table = _oper.DBInfo.FindTable(tableType);

            if (CommonMethods.IsNull(table))
            {
                _oper.DBInfo.ThrowNotFondTable(tableType);
            }

            BQLQuery BQL = GetSelectSql(lstScope, table);

            return(QueryReader(BQL, null, lstScope.UseCache));
        }
コード例 #28
0
        /// <summary>
        /// 添加子表
        /// </summary>
        /// <param name="table">子表</param>
        public AliasTableMapping AddChildTable(BQLEntityTableHandle table)
        {
            AliasTableMapping            retTable  = null;
            Stack <BQLEntityTableHandle> stkTables = new Stack <BQLEntityTableHandle>();
            BQLEntityTableHandle         curTable  = table;

            do
            {
                stkTables.Push(curTable);
                curTable = curTable.GetParentTable();
            } while (!CommonMethods.IsNull(curTable));

            AliasTableMapping lastTable = null;//上一个表

            while (stkTables.Count > 0)
            {
                BQLEntityTableHandle cTable = stkTables.Pop();

                string pName = cTable.GetPropertyName();
                if (string.IsNullOrEmpty(pName))
                {
                    lastTable = this;
                    retTable  = this;
                }
                else
                {
                    if (!lastTable._dicChildTables.ContainsKey(pName))
                    {
                        EntityInfoHandle  entityInfo = retTable.EntityInfo;
                        EntityMappingInfo mapInfo    = entityInfo.MappingInfo[pName];
                        if (mapInfo != null)
                        {
                            retTable = new AliasTableMapping(cTable, _belongManager, mapInfo);
                            lastTable._dicChildTables[pName] = retTable;
                            lastTable = retTable;
                        }
                        else
                        {
                            throw new MissingMemberException("实体:" + entityInfo.EntityType.FullName + "中找不到属性:" + pName + "");
                        }
                    }
                    else
                    {
                        retTable  = lastTable._dicChildTables[pName];
                        lastTable = retTable;
                    }
                }
            }
            return(retTable);
        }
コード例 #29
0
        /// <summary>
        /// 获取主表的别名信息
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        public BQLAliasHandle GetPrimaryAliasHandle(BQLTableHandle table)
        {
            BQLEntityTableHandle eHandle = table as BQLEntityTableHandle;

            if (Buffalo.Kernel.CommonMethods.IsNull(eHandle))
            {
                return(null);
            }
            if (eHandle.GetEntityInfo() == _primaryTable.EntityInfo)
            {
                return(_primaryTable.TableInfo);
            }
            return(null);
        }
コード例 #30
0
        /// <summary>
        /// 初始化字段
        /// </summary>
        /// <param name="table"></param>
        /// <param name="paramIndex"></param>
        private void InitParam(BQLEntityTableHandle table)
        {
            _dicParams = new Dictionary <string, BQLAliasParamHandle>();

            foreach (EntityPropertyInfo info in table.GetEntityInfo().PropertyInfo)
            {
                string prmAliasName     = _belongManager.NextParamAliasName(_table.GetAliasName());
                BQLAliasParamHandle prm = BQL.Tables[_table.GetAliasName()][info.ParamName].As(prmAliasName);


                _dicPropertyInfo[prmAliasName] = info;
                prm.ValueDbType = info.SqlType;
                _dicParams[info.PropertyName] = prm;
            }
        }