Esempio n. 1
0
        protected override void AfterLoad()
        {
            itemDir = new ExcelDataItem(this, 0, tableAlias);
            var categoryStartIndex = (int)EXCEL_DATA.CATEGORY_START;
            var categoryEndIndex   = ExcelConfig.Instance.defaultTitles.Count - 1;

            foreach (var entry in data)
            {
                var curItemDir = itemDir;
                var lineData   = entry.Value;
                var id         = entry.Key;
                var itemName   = GetHeader(lineData[(int)EXCEL_DATA.NAME], id.ToString());
                for (int i = categoryStartIndex; i <= categoryEndIndex && i < lineData.Count; ++i)
                {
                    var category = lineData[i];
                    if (category == null || category == string.Empty)
                    {
                        break;
                    }
                    if (!curItemDir.items.TryGetValue(new KeyValuePair <int, string>(0, category), out ExcelDataItem value))
                    {
                        value = new ExcelDataItem(this, 0, category);
                        curItemDir.AddItem(value);
                    }
                    curItemDir = value;
                }
                curItemDir.AddItem(new ExcelDataItem(this, id, itemName));
            }
        }
Esempio n. 2
0
 public bool SameItem(ExcelDataItem item)
 {
     if (item == null || item.config == null)
     {
         return(false);
     }
     if (this.config == null || id == 0)
     {
         return(false);
     }
     return(item.config.idSpace == this.config.idSpace && item.header == this.header);
 }
Esempio n. 3
0
 public void AddItem(ExcelDataItem item)
 {
     items[new KeyValuePair <int, string>(item.id, item.header)] = item;
 }