Example #1
0
        public static void LoadBatchListOnCombo(ComboTree cb, Action onChangedAction, int batchId = 0)
        {
            var loader = new BatchCollection();

            if (batchId != 0)
            {
                loader.LoadItem(batchId);
            }
            else
            {
                loader.LoadAllItemsFromDb();
            }

            cb.Nodes.Clear();

            foreach (var item in loader.Items)
            {
                var node = new Node()
                {
                    Name = item.Id.ToString(),
                    Text = $@"{item.BatchName} - {item.Semester}",
                    Tag  = item,
                    //Image = Properties.Resources.Address_Book_16
                };
                cb.Nodes.Add(node);
            }

            if (cb.Nodes.Count != 0)
            {
                cb.SelectedNode = cb.Nodes[cb.Nodes.Count - 1];
            }
            if (onChangedAction != null)
            {
                cb.TextChanged += (s, e) => { onChangedAction(); }
            }
            ;
        }
    }
 public virtual void LoadItems()
 {
     ItemDataCollection.LoadAllItemsFromDb();
     ShowItems();
 }
 protected override IEnumerable <Entity> LoadItems()
 {
     ItemDataCollection.LoadAllItemsFromDb();
     return(ItemDataCollection.Items);
 }