コード例 #1
0
        private List <int> GetDefaultGroupIDs()
        {
            List <int> defaultGroupIDs = null;
            string     sql             = "";

            try {
                DbInfo = new DatabaseWrapper(Lcf);
                DbInfo.Connect();

                if (!DbInfo.ColumnExists(GroupQB.GROUP_TBLE_NAME, GroupQB.GROUP_DEFAULT_COL))
                {
                    Logger.LogError(5, "Column " + GroupQB.GROUP_DEFAULT_COL + " does not exist in table " + GroupQB.GROUP_TBLE_NAME + ". Cannot get default Group IDs!");
                    return(null);
                }

                sql             = GroupQB.GetSelectDefaultGroupIdsSql();
                defaultGroupIDs = DbInfo.GetIntegerList(sql);
                if (defaultGroupIDs == null)
                {
                    Logger.LogError(5, "Failed to get default group IDs!");
                    return(null);
                }
                if (defaultGroupIDs.Count == 0)
                {
                    Logger.Log("No default group is found in the system when using SQL " + sql);
                }
            } catch (Exception ex) {
                Logger.LogError(5, "Failed to get default group IDs at: " + ex);
                defaultGroupIDs = null;
            } finally {
                if (DbInfo != null)
                {
                    DbInfo.Disconnect();
                }
            }
            return(defaultGroupIDs);
        }