Beispiel #1
0
        private static int Compare(ListFolder x, ListFolder y)
        {
            int retVal = 0;

            if (x == null)
            {
                if (y != null)
                {
                    retVal = -1;
                }
            }
            else
            {
                if (y == null)
                {
                    retVal = 1;
                }
                else
                {
                    retVal = x._parentFolderId.CompareTo(y._parentFolderId);
                    if (retVal == 0)
                    {
                        retVal = x._listFolderId.CompareTo(y._listFolderId);
                    }
                }
            }

            return(retVal);
        }
Beispiel #2
0
        public static ListFolder Load(IDataRecord reader)
        {
            ListFolder ret = new ListFolder();

            ret._listFolderId   = (int)reader["ListFolderId"];
            ret._name           = reader["Name"].ToString();
            ret._parentFolderId = (int)reader["ParentFolderId"];
            ret._projectId      = Helper.NullToNulableInt32(reader["ProjectId"]);
            ret._isPrivate      = (bool)reader["IsPrivate"];
            ret._creatorId      = Helper.NullToInt32(reader["CreatorId"]);
            ret._creationDate   = (DateTime)reader["CreationDate"];

            return(ret);
        }
Beispiel #3
0
        public static ListFolder Load(IDataRecord reader)
        {
            ListFolder ret = new ListFolder();

            ret._listFolderId = (int)reader["ListFolderId"];
            ret._name = reader["Name"].ToString();
            ret._parentFolderId = (int)reader["ParentFolderId"];
            ret._projectId = Helper.NullToNulableInt32(reader["ProjectId"]);
            ret._isPrivate = (bool)reader["IsPrivate"];
            ret._creatorId = Helper.NullToInt32(reader["CreatorId"]);
            ret._creationDate = (DateTime)reader["CreationDate"];

            return ret;
        }
Beispiel #4
0
        private void CalculateOutline(IDictionary <int, ListFolder> folders)
        {
            if (_outlineLevel < 1)
            {
                if (_parentFolderId > 0)
                {
                    ListFolder parent = folders[_parentFolderId];
                    parent.CalculateOutline(folders);

                    parent._hasChildren = true;
                    _outlineLevel       = parent._outlineLevel + 1;
                    _outlineNumber      = parent._outlineNumber + ".";
                }
                else
                {
                    _outlineLevel  = 1;
                    _outlineNumber = string.Empty;
                }
                _outlineNumber += _listFolderId.ToString(CultureInfo.InvariantCulture);
            }
        }
Beispiel #5
0
        public static IDictionary <int, ListFolder> LoadList(DBHelper source)
        {
            Dictionary <int, ListFolder> ret = new Dictionary <int, ListFolder>();

            using (IDataReader reader = source.RunTextDataReader("SELECT * FROM [LIST_FOLDERS]"))
            {
                while (reader.Read())
                {
                    ListFolder item = Load(reader);
                    if (!ret.ContainsKey(item._listFolderId))
                    {
                        ret.Add(item._listFolderId, item);
                    }
                }
            }

            // Calculate OutlineLevel, OutlineNumber, HasChildren.
            foreach (ListFolder folder in ret.Values)
            {
                folder.CalculateOutline(ret);
            }

            return(ret);
        }
Beispiel #6
0
        private static int Compare(ListFolder x, ListFolder y)
        {
            int retVal = 0;

            if (x == null)
            {
                if (y != null)
                    retVal = -1;
            }
            else
            {
                if (y == null)
                    retVal = 1;
                else
                {
                    retVal = x._parentFolderId.CompareTo(y._parentFolderId);
                    if (retVal == 0)
                        retVal = x._listFolderId.CompareTo(y._listFolderId);
                }
            }

            return retVal;
        }