Beispiel #1
0
        public void AddFileItem(string url, string createDate, string order, string key)
        {
            Int16 iOrderMax = 0;

            if (this.FileItemList == null)
            {
                this.FileItemList = new List <FileInfoItem>();
            }

            bool isFileItemExist = false;

            foreach (FileInfoItem itemFile in this.FileItemList)
            {
                if (itemFile.Key == key)
                {
                    isFileItemExist = true;
                    break;
                }

                if (Convert.ToInt16(itemFile.Order) >= iOrderMax)
                {
                    iOrderMax = Convert.ToInt16(itemFile.Order);
                }
            }

            if (!isFileItemExist)
            {
                FileInfoItem file = new FileInfoItem();
                file.Url = url;
                file.Key = key;

                if (Convert.ToInt16(order) == 0)
                {
                    file.Order = (iOrderMax + 1).ToString();
                }
                else
                {
                    file.Order = order;
                }

                file.CreateDate       = createDate;
                file.CreateDateString = "[ " + file.Order + " ] " + TimeFormat.GetTime((Convert.ToUInt64(createDate) * 1000).ToString()).ToString("yyyy-MM-dd HH:mm:ss");

                this.FileItemList.Insert(0, file);
            }

            this.FilterMaxItem(Global.iMaxFileNum);
        }
Beispiel #2
0
        public void AddFileItem(string url, string createDate, string order, string key)
        {
            Int16 iOrderMax = 0;

            if (this.FileItemList == null)
            {
                this.FileItemList = new List<FileInfoItem>();
            }

            bool isFileItemExist = false;

            foreach (FileInfoItem itemFile in this.FileItemList)
            {
                if (itemFile.Key == key)
                {
                    isFileItemExist = true;
                    break;
                }

                if (Convert.ToInt16(itemFile.Order) >= iOrderMax)
                {
                    iOrderMax = Convert.ToInt16(itemFile.Order);
                }
            }

            if (!isFileItemExist)
            {
                FileInfoItem file = new FileInfoItem();
                file.Url = url;
                file.Key = key;

                if (Convert.ToInt16(order) == 0)
                {
                    file.Order = (iOrderMax + 1).ToString();
                }
                else
                {
                    file.Order = order;
                }
                
                file.CreateDate = createDate;
                file.CreateDateString = "[ " + file.Order + " ] " + TimeFormat.GetTime((Convert.ToUInt64(createDate) * 1000).ToString()).ToString("yyyy-MM-dd HH:mm:ss");

                this.FileItemList.Insert(0, file);
            }

            this.FilterMaxItem(Global.iMaxFileNum);
        }