Esempio n. 1
0
        //下级管理器对象
        public CBaseObjectMgr GetSubObjectMgr(string sTbCode, Type type)
        {
            string sKey = sTbCode.ToLower();

            if (m_sortSubObjectMgr.ContainsKey(sKey))
            {
                return(m_sortSubObjectMgr[sKey]);
            }

            CTable table = (CTable)Ctx.TableMgr.FindByCode(sTbCode);

            if (table == null)
            {
                return(null);
            }
            if (table.ColumnMgr.FindByCode(string.Format("{0}_id", this.TbCode))
                == null)
            {
                return(null);
            }

            object         obj    = Activator.CreateInstance(type);
            CBaseObjectMgr objMgr = (CBaseObjectMgr)obj;

            objMgr.Ctx      = Ctx;
            objMgr.TbCode   = sTbCode;
            objMgr.m_Parent = this;
            string sWhere = string.Format(" {0}_id='{1}'", this.TbCode, this.Id);

            objMgr.Load(sWhere, false);
            Ctx.AddBaseObjectMgrCache(sTbCode, this.Id, objMgr);

            m_sortSubObjectMgr.Add(sKey, objMgr);
            return(objMgr);
        }