Exemple #1
0
        private void Load_cmbNhomCha()
        {
            var cmb = cmbNhomCha;

            cmb.Tag = 0;
            clsNhom   cls = new clsNhom();
            DataTable dt;

            //if (!m_bCapNhat)
            //{
            //    dt = cls.SelectAll();
            //}
            //else
            //{
            //    dt = cls.SelectAll_ParentNodes(m_iID_Nhom);
            //}
            dt = cls.SelectAll();
            dt.DefaultView.RowFilter = "TonTai = 1";
            dt.DefaultView.Sort      = "ID_Nhom ASC";
            dt = dt.DefaultView.ToTable();
            cmb.Properties.DataSource    = dt;
            cmb.Properties.DisplayMember = "Ten_Nhom";
            cmb.Properties.ValueMember   = "ID_Nhom";
            cmb.Tag = 1;
        }
Exemple #2
0
        public void LoadfgBan_Nhom()
        {
            var fg = fgBan_Nhom;

            fg.Tag = 0;
            fg.BeginUpdate();
            clsNhom   cls = new clsNhom();
            DataTable dt  = cls.SelectAll();

            dt.DefaultView.RowFilter = "TonTai = 1";
            fg.ClearRows();
            fg.SetDataSource(dt);

            //Add Node 0 công việc con
            for (int r = fg.Rows.Fixed; r < fg.Rows.Count; ++r)
            {
                fg.Rows[r].Visible = false;
                fg.Rows.InsertNode(r + 1, 0);
                GetDataTwoRow(r + 1, r);
                ++r;
            }
            for (int r = fg.Rows.Fixed; r < fg.Rows.Count; r++)
            {
                if (!fg.Rows[r].Visible)
                {
                    fg.Rows.Remove(r);
                    r = r - 1;
                }
            }

            for (int r = fg.Rows.Fixed; r < fg.Rows.Count; ++r)
            {
                if (fg.Rows[r].Node.Level == 0 && fg.Rows[r].Visible && IsNode0(r))
                {
                    r = TimCongViecGoc(r, 1);
                }
            }
            int level = 1;

            while (TonTaiCongViecGoc(level))
            {
                for (int r1 = fg.Rows.Fixed; r1 < fg.Rows.Count; ++r1)
                {
                    if (fg.Rows[r1].Node.Level == level && fg.Rows[r1].Visible)
                    {
                        r1 = TimCongViecGoc(r1, level + 1);
                    }
                }
                ++level;
            }
            //chỉ số cột hiển thị cây
            fg.Tree.Column = 4;

            for (int r = fg.Rows.Fixed; r < fg.Rows.Count; ++r)
            {
                if (!fg.Rows[r].Visible)
                {
                    fg.Rows.Remove(r);
                    --r;
                }
            }
            SetSTT();
            fg.Row = -1;
            fg.EndUpdate();
            fg.Tag = 1;
            fgBan_Nhom.Tree.Show(0);
        }