예제 #1
0
        protected virtual void LoadItemsFromTable(DropDownTreeItem item, object idValue, DataTable table, bool isStr, string idField, string parentIDField, string txtfiled, string valuefiled)
        {
            string str;

            if (isStr)
            {
                str = "{0} = '{1}'";
            }
            else
            {
                str = "{0} = {1}";
            }
            try
            {
                foreach (DataRow row in table.Select(string.Format(str, parentIDField, idValue)))
                {
                    DropDownTreeItem item2 = new DropDownTreeItem();
                    item2.LoadFromDataRow(row, txtfiled, valuefiled);
                    item.Items.Add(item2);
                    this.LoadItemsFromTable(item2, row[idField], table, isStr, idField, parentIDField, txtfiled, valuefiled);
                }
            }
            catch
            {
                throw new ArgumentException("Table or filed name error!", table.TableName);
            }
        }
예제 #2
0
        protected override int AddItem(ViewStatePartBase item)
        {
            DropDownTreeItem item2 = (DropDownTreeItem)item;

            item2.DropDownTree = this.DropDownTree;
            item2.Owner        = this.Owner;
            item2.Init();
            return(base.AddItem(item2));
        }
예제 #3
0
 public virtual void LoadFromTable(DataTable table, bool isStr, string idField, string parentIDField, string txtfiled, string valuefiled)
 {
     try
     {
         this.Items.Clear();
         foreach (DataRow row in table.Select(string.Format("{0} =0", parentIDField)))
         {
             DropDownTreeItem item = new DropDownTreeItem();
             item.LoadFromDataRow(row, txtfiled, valuefiled);
             this.Items.Add(item);
             this.LoadItemsFromTable(item, row[idField], table, isStr, idField, parentIDField, txtfiled, valuefiled);
         }
     }
     catch
     {
         throw new ArgumentException("Table or filed name error!", table.TableName);
     }
 }
예제 #4
0
 public DropDownTreeItem GetItemByValue(string _value)
 {
     if (!this.IsEmpty)
     {
         foreach (DropDownTreeItem item in base.InnerList)
         {
             if (item.Value == _value)
             {
                 return(item);
             }
             DropDownTreeItem itemByValue = item.Items.GetItemByValue(_value);
             if (itemByValue != null)
             {
                 return(itemByValue);
             }
         }
     }
     return(null);
 }
예제 #5
0
        protected virtual string GetTabText()
        {
            DropDownTreeItemCollection items;

            if (this.Level == 0)
            {
                return(string.Empty);
            }
            DropDownTreeItem owner = this.Owner;

            if (this.Level > 1)
            {
                items = owner.Owner.Items;
            }
            else
            {
                items = this.DropDownTree.Items;
            }
            if (owner.Index == (items.Count - 1))
            {
                return(string.Format("{0}{1}", owner.GetTabText(), "  " + this.DropDownTree.TabString));
            }
            return(string.Format("{0}{1}", owner.GetTabText(), "│" + this.DropDownTree.TabString));
        }
예제 #6
0
 public int IndexOf(DropDownTreeItem item)
 {
     return(base.InnerList.IndexOf(item));
 }
예제 #7
0
 public int Add(DropDownTreeItem item)
 {
     return(this.AddItem(item));
 }