Пример #1
0
        public static void BindingKetCau(System.Windows.Forms.TreeView treeViewKetCau)
        {
            treeViewKetCau.Nodes.Clear();
            BLL_KetCau        obj    = new BLL_KetCau();
            List <NhomKetCau> dsNhom = obj.NhomKetCau_GetList(string.Empty);

            if (dsNhom != null)
            {
                var listNhom = (from nhom in dsNhom
                                orderby nhom.SapXep
                                select nhom);

                foreach (NhomKetCau n in listNhom)
                {
                    System.Windows.Forms.TreeNode root = treeViewKetCau.Nodes.Add(n.MaNhomKetCau.ToString(), n.TenNhomKetCau);

                    List <KetCau> dsKetCau = obj.GetList(n.MaNhomKetCau, string.Empty);
                    if (dsKetCau != null)
                    {
                        foreach (KetCau kc in dsKetCau)
                        {
                            root.Nodes.Add(kc.MaKetCau.ToString(), kc.TenKetCau);
                        }
                    }
                }

                treeViewKetCau.ExpandAll();
            }
        }
Пример #2
0
        public static void BindingKetCau(System.Windows.Forms.ComboBox cboKetCau, int maNhomKetCau)
        {
            cboKetCau.Items.Clear();
            BLL_KetCau    obj  = new BLL_KetCau();
            List <KetCau> list = obj.GetList(maNhomKetCau, string.Empty);

            if (list != null)
            {
                KetCau item = new KetCau();
                item.MaKetCau  = -1;
                item.TenKetCau = "Kết cấu - chọn -";
                list.Insert(0, item);
                cboKetCau.DataSource    = list;
                cboKetCau.ValueMember   = "MaKetCau";
                cboKetCau.DisplayMember = "TenKetCau";
            }
        }