/// <summary> /// Loads the data. /// </summary> /// Created by SMK private void LoadData() { var data = new ItemType(Business.Common.Config.ConnectionString); lstType = new List<ItemTypeInfo>(); itemData = new Item(Business.Common.Config.ConnectionString); var lstCarInfo = data.SelectAll(); var rootNode = new TreeNode("Hạng mục"); foreach (var item in lstCarInfo) { item.Name = string.Format("{1} - [{0}]", item.Name, item.Description); var node = new TreeNode(item.Name); node.Tag = item; rootNode.Nodes.Add(node); lstType.Add(item); var lst = itemData.GetItemList(item.Id); foreach (var p in lst) { Type type = p.GetType(); var proName = type.GetProperty("Name"); var proId = type.GetProperty("Id"); var Namevalue = proName.GetValue(p, null); var Idvalue = proId.GetValue(p, null); var child = new TreeNode(Namevalue as string); child.Tag = Idvalue; node.Nodes.Add(child); } } tvItem.Nodes.Add(rootNode); tvItem.CollapseAll(); }
/// <summary> /// Loads the data. /// </summary> /// Created by SMK private void LoadData() { itemTypeData = new ItemType(Config.ConnectionString); itemData = new Item(Config.ConnectionString); itemPriceData = new ItemPrice(Config.ConnectionString); var lstCarInfo = itemTypeData.SelectAll(); var rootNode = new TreeNode("Hạng mục"); foreach (var item in lstCarInfo) { item.Name = string.Format("{1} - [{0}]", item.Name, item.Description); var node = new TreeNode(item.Name); node.Tag = item; rootNode.Nodes.Add(node); } tvItemType.Nodes.Add(rootNode); tvItemType.ExpandAll(); // Load Car list LoadCar(); }