/// <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()); }
//--------------------------------------------- #endregion /// <summary> /// 通过PGID获取PG_Code /// </summary> /// <param name="pgid">PGID</param> /// <returns>PG_Code</returns> public string PGIDToCode(int pgid) { GroupM g = new GroupM(); return(g.NoLock() .Where(g.PGID == pgid) .SelectValue <string>(g.PG_Code, null)); }
/// <summary> /// /// </summary> /// <param name="pgid"></param> /// <returns></returns> public bool Exists(int pgid) { if (pgid == 0) { return(false); } GroupM g = new GroupM(); return(g.NoLock().Where(g.PGID == pgid).Exists()); }
/// <summary> /// 是否存有组(@列=值) /// </summary> /// <param name="col">列</param> /// <param name="val">值</param> /// <returns></returns> public bool Exists(QColumn col, int val) { GroupM g = new GroupM(); g.Where(col == val); if (DEFINE_VALUE > 0) { g.And(g.R_PGID == DEFINE_VALUE); } return(g.NoLock().Exists()); }
/// <summary> /// 通过PG_Code获取PGID /// </summary> /// <param name="code">PG_Code</param> /// <returns>PGID</returns> public int CodeToPGID(string code) { GroupM g = new GroupM(); g.Where(g.PG_Code == code); if (DEFINE_VALUE > 0) { g.And(g.R_PGID == DEFINE_VALUE); } return(g.NoLock().SelectValue <int>(g.PGID, 0)); }
/// <summary> /// 获取所有组 /// </summary> /// <returns></returns> protected List <T> DoGetGroups() { GroupM g = new GroupM(); g.Where(g.Is_Visibled != 0); if (DEFINE_VALUE > 0) { g.And(g.R_PGID == DEFINE_VALUE); } return(g.NoLock() .OrderBy(g.Order_Index) .Select <T>()); }
/// <summary> /// 是否存有子级 /// </summary> /// <param name="pgid">组PGID</param> /// <param name="incDisabled">是否包括禁用的</param> /// <param name="incUnVisible">是否包括不可见的</param> /// <returns></returns> public bool ExistsChildern(int pgid, bool incDisabled, bool incUnVisible) { GroupM g = new GroupM(); g.Where(g.P_PGID == pgid); if (incDisabled == false) { g.And(g.Is_Disabled != 1); } if (incUnVisible == false) { g.And(g.Is_Visibled == 1); } return(g.NoLock().Exists()); }
/// <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); }