Пример #1
0
        /// <summary>
        /// 获取组
        /// </summary>
        /// <param name="joinTable"></param>
        /// <param name="incDisabled"></param>
        /// <param name="incUnVisible"></param>
        /// <param name="p_pgids"></param>
        /// <returns></returns>
        protected DataTable DoGetGroups(QTable joinTable, bool incDisabled, bool incUnVisible, params int[] p_pgids)
        {
            if (p_pgids == null || p_pgids.Length < 1)
            {
                return(null);
            }

            //-------------------------------------
            GroupM g  = new GroupM();
            SQuery SQ = new SQuery();

            SQ.From(g.NoLock());

            if (joinTable != null)
            {
                SQ.InnerJoin(joinTable.NoLock()).On(g.PGID == joinTable["PGID"]);
            }

            SQ.Where(g.P_PGID.In(p_pgids));

            if (incDisabled == false)
            {
                SQ.And(g.Is_Disabled != 1);
            }

            if (incUnVisible == false)
            {
                SQ.And(g.Is_Visibled != 0);
            }

            return(SQ.OrderBy(g.Order_Index)
                   .Select());
        }
Пример #2
0
        /// <summary>
        /// 获取用户相关的组
        /// </summary>
        /// <param name="puid">用户PUID</param>
        /// <param name="p_pgids">目标组的P_PGID组</param>
        /// <returns></returns>
        protected List <Group> DoGetGroupsInUser(int puid, params int[] p_pgids)
        {
            GroupM g  = new GroupM();
            SQuery SQ = new SQuery();

            User_LinkedM ul = new User_LinkedM();

            ul.IncludeAll(false);


            SQ.From(g)
            .InnerJoin(ul).On(g.PGID == ul.LK_OBJT_ID).And(ul.LK_OBJT == Group.LK_OBJT);

            SQ.Where(QCondition.TRUE);

            if (p_pgids.Length > 0)
            {
                SQ.And(g.P_PGID.In(p_pgids));
            }

            return
                (SQ.And(ul.PUID == puid)
                 .And(g.Is_Disabled != true)
                 .And(g.Is_Visibled != false)
                 .OrderBy(g.Order_Index, OrderType.ASC)
                 .Select <Group>());
        }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pgCode">代码模式:3301|33%|33__01%</param>
        /// <param name="incDisabled"></param>
        /// <param name="incUnVisible"></param>
        /// <returns></returns>
        private SQuery GetUsersQuery(string pgCode, bool incDisabled, bool incUnVisible)
        {
            UserM        u  = new UserM();
            User_LinkedM ul = new User_LinkedM();
            GroupM       g  = new GroupM();

            ul.IncludeAll(false);
            ul.LK_OBJT_ID.IsInc  = true;
            ul.LK_OBJT_ID.AsName = "PGID";

            SQuery SQ = NewSQ();

            SQ.From(u)
            .InnerJoin(ul)
            .On(u.PUID == ul.PUID).And(ul.LK_OBJT == Group.LK_OBJT)
            .InnerJoin(g)
            .On(ul.LK_OBJT_ID == g.PGID)
            .Where(g.PG_Code.Like(pgCode));

            if (incDisabled == false)
            {
                SQ.And(u.Is_Disabled != true);
            }

            if (incUnVisible == false)
            {
                SQ.And(u.Is_Visibled != false);
            }

            return(SQ);
        }
Пример #4
0
        private SQuery GetUsersQuery(bool incDisabled, bool incUnVisible, params int[] pgids)
        {
            UserM        u  = new UserM();
            User_LinkedM ul = new User_LinkedM();

            ul.IncludeAll(false);
            ul.LK_OBJT_ID.IsInc  = true;
            ul.LK_OBJT_ID.AsName = "PGID";

            SQuery SQ = NewSQ();

            SQ.From(u)
            .InnerJoin(ul)
            .On(u.PUID == ul.PUID)
            .Where(ul.LK_OBJT_ID.In(pgids))
            .And(ul.LK_OBJT == Group.LK_OBJT);

            if (incDisabled == false)
            {
                SQ.And(u.Is_Disabled != true);
            }

            if (incUnVisible == false)
            {
                SQ.And(u.Is_Visibled != false);
            }

            SQ.OrderBy(u.CN_Name);

            return(SQ);
        }
Пример #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="puid"></param>
        /// <param name="incDisabled"></param>
        /// <param name="forView"></param>
        /// <returns></returns>
        public SQuery GetInGroupsSQ(int puid, bool incDisabled, bool forView)
        {
            GroupM       g  = new GroupM();
            User_LinkedM ul = new User_LinkedM();

            SQuery SQ = new SQuery();

            ul.IncludeAll(false);

            if (forView == true)
            {
                g.IncludeAll(false);
                g.PGID.IsInc = true;
            }

            SQ.From(g.NoLock())
            .InnerJoin(ul).On(g.PGID == ul.LK_OBJT_ID)
            .Where(ul.PUID == puid);

            if (incDisabled == false)
            {
                SQ.And(g.Is_Disabled != 1);
            }

            if (DEFINE_VALUE > 0)
            {
                SQ.And(g.R_PGID == DEFINE_VALUE.ToString());
            }

            if (forView == false)
            {
                SQ.OrderBy(g.Order_Index);
            }

            return(SQ);
        }
Пример #6
0
        /// <summary>
        /// 获取指定包里的资源
        /// </summary>
        /// <param name="packageIds">包ID组</param>
        /// <param name="incDisabled">是否包括忆禁用的部分</param>
        /// <returns>资源列表</returns>
        public List <Resource> GetResources(bool incDisabled, params int[] packageIds)
        {
            ResourceM        r  = new ResourceM();
            Resource_LinkedM rl = new Resource_LinkedM();

            rl.IncludeAll(false);

            SQuery SQ = NewSQ();

            SQ.From(r)
            .InnerJoin(rl)
            .On(rl.RSID == r.RSID)
            .Where(r.RSID != "0")
            .And(rl.LK_OBJT == Package.LK_OBJT)
            .And(rl.LK_OBJT_ID.In(packageIds));

            if (incDisabled == false)
            {
                SQ.And(r.Is_Disabled == false);
            }

            if (_OrderColumnName == null)
            {
                SQ.OrderBy(r.Order_Index);
            }
            else
            {
                if (r.Contains(_OrderColumnName))
                {
                    SQ.OrderBy(r[_OrderColumnName]);
                }
                else if (rl.Contains(_OrderColumnName))
                {
                    SQ.OrderBy(r[_OrderColumnName]);
                }
                else if (_OrderColumnName.IndexOf(",") > 0)
                {
                    SQ.OrderBy(r.CN_Name.Exp(_OrderColumnName));
                }
                else
                {
                    SQ.OrderBy(r.Order_Index);
                }
            }

            return(SQ.Select <Resource>());
        }
Пример #7
0
        private SQuery _SQ_GetInUserResources(int puid, params int[] packageIds)
        {
            if (puid <= 0)
            {
                throw new BCFException("GetInUserResources(puid)::@puid 必须大于0");
            }

            ResourceExView   rv = new ResourceExView(false);
            Resource_LinkedM rl = new Resource_LinkedM();
            SQuery           SQ = NewSQ();

            //------>>找出属于用户所在组(部门,角色)
            QView tempView = GroupService.G.GetInGroupsSQ(puid, false, true).SubSelect();

            //-------<<

            //------>>找出属于用户个人所有的RSID
            tempView = SQ.From(rl)
                       .BeginWhere(rl.LK_OBJT == User.LK_OBJT)
                       .And(rl.LK_OBJT_ID == puid)
                       .End()
                       .BeginOr(rl.LK_OBJT == Group.LK_OBJT)
                       .And(rl.LK_OBJT_ID.In(tempView))
                       .End()
                       .SubSelect(rl.RSID, rl.LK_OBJT, rl.P_Express).As("RL");
            //------<<

            SQ.From(rv)
            .Join(tempView, JoinType.Inner)
            .On(rv.RSID == tempView.Column(rl.RSID))
            .Where(rv.Is_Disabled != 1)
            .And(rv.PKG_Is_Disabled == false);

            if (packageIds.Length > 0)
            {
                SQ.And(rv.PGID.In(packageIds));
            }

            SQ.Distinct();

            this._Sort(SQ, rv);

            return(SQ);
        }