예제 #1
0
        public static string BuildTreeNodeSearchString(string systemGroupCode, TreeNodeSearchType searchType, string typeColumnName)
        {
            string systemGroupFullID = SystemManageDAO.GetSystemGroupFullID(systemGroupCode);

            switch (searchType)
            {
            case TreeNodeSearchType.AllSubNodeIncludeSelf:
                return(string.Format(" {1} in ( select GroupCode from SystemGroup where FullID  like '{0}%'  ) ", systemGroupFullID, typeColumnName));

            case TreeNodeSearchType.AllSubNodeNotIncludeSelf:
                return(string.Format(" {1} in ( select GroupCode from SystemGroup where FullID  FullCode like '{0}%' and FullID <> {'0'}  ) ", systemGroupFullID, typeColumnName));

            case TreeNodeSearchType.FirstChildNode:
                return(string.Format(" {1} in ( select GroupCode from SystemGroup where FullID = '{0}'  ) ", systemGroupFullID, typeColumnName));

            case TreeNodeSearchType.AllSubLeafNode:
                return(string.Format("  {1} in ( select GroupCode from SystemGroup c where FullID like '{0}%' and Not Exists ( select * from SystemGroup e where e.ParentCode = c.systemGroupCode  ) ) ", systemGroupFullID, typeColumnName));

            case TreeNodeSearchType.AllSubNotLeafNode:
                return(string.Format("  {1} in ( select GroupCode from SystemGroup c where FullID like '{0}%' and Exists ( select * from SystemGroup e where e.ParentCode = c.systemGroupCode  ) ) ", systemGroupFullID, typeColumnName));

            case TreeNodeSearchType.OnlySelfNode:
                return(string.Format(" {1}  = '{0}'  ) ", systemGroupCode, typeColumnName));
            }
            return("");
        }