Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="rsid"></param>
        /// <param name="puid"></param>
        /// <param name="exp"></param>
        /// <param name="tran"></param>
        /// <returns></returns>
        public static bool JoinToUser(int rsid, int puid, PExpress exp, QDbTran tran)
        {
            if (rsid == 0 || rsid == 0)
            {
                return(false);
            }

            Resource_LinkedM rl = new Resource_LinkedM();

            rl.RSID.Value       = rsid;
            rl.LK_OBJT.Value    = User.LK_OBJT;
            rl.LK_OBJT_ID.Value = puid;
            rl.LK_Operate.Value = "+";
            rl.P_Express.Value  = (byte)exp;

            if (rl.Where(rl.RSID == rsid)
                .And(rl.LK_OBJT == User.LK_OBJT)
                .And(rl.LK_OBJT_ID == puid).NoLock().Exists())
            {
                return(false);
            }
            else
            {
                return(rl.Insert(tran));
            }
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="defines"></param>
        /// <returns></returns>
        protected bool DoClearGroups(params int[] defines)
        {
            if (defines.Length < 1)
            {
                throw new BCFException("defines 参数不能为空");
            }

            GroupM           g  = new GroupM();
            Resource_LinkedM rl = new Resource_LinkedM();
            User_LinkedM     ul = new User_LinkedM();

            QView pgidS = g.Where(g.R_PGID.In(defines)).SubSelect(g.PGID);

            bool temp = true;

            //清理,与功能间的关联
            //
            temp = rl.Where(rl.LK_OBJT_ID.In(pgidS))
                   .And(rl.LK_OBJT == Group.LK_OBJT)
                   .Delete() && temp;

            //清理,与用户之间的关联
            //
            temp = ul.Where(ul.LK_OBJT_ID.In(pgidS))
                   .And(ul.LK_OBJT == Group.LK_OBJT)
                   .Delete() && temp;

            //清空组
            //
            temp = g.Where(g.R_PGID.In(defines)).Delete() && temp;

            return(temp);
        }
Beispiel #3
0
        public bool ClearUsers()
        {
            string[] unClearPUIDs = new string[] { "0", "1" };

            //清理,与功能间的关联
            //
            Resource_LinkedM rl = new Resource_LinkedM();

            rl.Where(rl.LK_OBJT == User.LK_OBJT)
            .And(rl.LK_OBJT_ID.Unin(unClearPUIDs))
            .Delete();

            //清理,与组之音的关联
            //
            User_LinkedM ul = new User_LinkedM();

            ul.Where(ul.PUID.Unin(unClearPUIDs)).Delete();

            //清理用户数据
            //
            UserM u = new UserM();

            u.Where(u.PUID.Unin(unClearPUIDs)).Delete();

            return(true);
        }
Beispiel #4
0
        public bool RemoveLink(QDbTran tran, string rsid, int lk_objt, int lk_objt_id)
        {
            Resource_LinkedM rl = new Resource_LinkedM();

            return(rl.Where(rl.RSID == rsid)
                   .And(rl.LK_OBJT == lk_objt)
                   .And(rl.LK_OBJT_ID == lk_objt_id).Delete(tran));
        }
Beispiel #5
0
        /// <summary>
        /// 获取与Group[@pgid]之间的连接关系
        /// </summary>
        public List <Resource_Linked> GetInGroupLinked(int pgid, QDbTran tran)
        {
            if (pgid < 1)
            {
                return(null);
            }

            Resource_LinkedM rl = new Resource_LinkedM();

            return(rl.Where(rl.LK_OBJT == Group.LK_OBJT)
                   .And(rl.LK_OBJT_ID == pgid)
                   .Select <Resource_Linked>());
        }
Beispiel #6
0
        /// <summary>
        /// 清除与Group[@pgid]之间的连接关系
        /// </summary>
        public bool ClearInGroupLinked(string pgid, QDbTran tran)
        {
            if (pgid == null || pgid.Length < 1)
            {
                return(false);
            }

            Resource_LinkedM rl = new Resource_LinkedM();

            return(rl.Where(rl.LK_OBJT == Group.LK_OBJT)
                   .And(rl.LK_OBJT_ID == pgid)
                   .Delete(tran));
        }
Beispiel #7
0
        /// <summary>
        /// 清除与User[@puid]之间的连接关系
        /// </summary>
        public bool ClearInUserLinked(string puid, QDbTran tran)
        {
            if (puid == null || puid.Length == 0)
            {
                return(false);
            }

            Resource_LinkedM rl = new Resource_LinkedM();

            return(rl.Where(rl.LK_OBJT == User.LK_OBJT)
                   .And(rl.LK_OBJT_ID == puid)
                   .Delete(tran));
        }
Beispiel #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="rsid"></param>
        /// <param name="pgid"></param>
        /// <param name="tran"></param>
        /// <returns></returns>
        public static bool LeaveGroup(int rsid, int pgid, QDbTran tran)
        {
            if (pgid == 0 || rsid == 0)
            {
                return(false);
            }

            Resource_LinkedM rl = new Resource_LinkedM();

            return
                (rl.Where(rl.LK_OBJT == Group.LK_OBJT)
                 .And(rl.LK_OBJT_ID == pgid)
                 .And(rl.RSID == rsid).Delete(tran));
        }
Beispiel #9
0
        /// <summary>
        /// 移除与资源之间的关联
        /// </summary>
        /// <param name="tran">事务对象</param>
        /// <param name="rsidS">资源RSID组</param>
        /// <returns></returns>
        public bool RemoveResourceLink(QDbTran tran, params int[] rsidS)
        {
            if (this.PGID == 0 || rsidS.Length == 0)
            {
                return(false);
            }

            Resource_LinkedM rl = new Resource_LinkedM();

            return(rl.Where(rl.LK_OBJT == Group.LK_OBJT)
                   .And(rl.LK_OBJT_ID == this.PGID)
                   .And(rl.RSID.In(rsidS))
                   .Delete(tran));
        }
Beispiel #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="rsid"></param>
        /// <param name="puid"></param>
        /// <param name="tran"></param>
        /// <returns></returns>
        public static bool LeaveUser(int rsid, int puid, QDbTran tran)
        {
            if (rsid == 0 || puid == 0)
            {
                return(false);
            }

            Resource_LinkedM rl = new Resource_LinkedM();

            return
                (rl.Where(rl.LK_OBJT == User.LK_OBJT)
                 .And(rl.LK_OBJT_ID == puid)
                 .And(rl.RSID == rsid)
                 .Delete(tran));
        }
Beispiel #11
0
        /// <summary>
        /// 移除资源,同时移除资源与其它对象的关联信息
        /// </summary>
        /// <param name="rsids">资源ID组</param>
        /// <param name="tran">事务</param>
        public bool RemoveResource(QDbTran tran, params int[] rsids)
        {
            Resource_LinkedM rl = new Resource_LinkedM();
            ResourceM        r  = new ResourceM();

            //删除关联表数据
            //
            bool temp = true;

            temp = temp && rl.Where(rl.RSID.In(rsids)).Delete(tran);

            //删除资源表数据
            temp = temp && r.Where(r.RSID.In(rsids)).Delete(tran);

            return(temp);
        }
Beispiel #12
0
        internal bool RemoveLink(QView lkidView, QDbTran tran)
        {
            Resource_LinkedM rl = new Resource_LinkedM();

            return(rl.Where(rl.LK_OBJT_ID.In(lkidView)).Delete(tran));
        }
Beispiel #13
0
        /// <summary>
        /// 移除与"Group"或"User"的关联
        /// </summary>
        /// <param name="lkidS">关联对象的ID组(组ID或用户ID)</param>
        /// <param name="tran">事务</param>
        /// <returns>是否成功</returns>
        public bool RemoveLink(QDbTran tran, params int[] lkidS)
        {
            Resource_LinkedM rl = new Resource_LinkedM();

            return(rl.Where(rl.LK_OBJT_ID.In(lkidS)).Delete(tran));
        }