private void ThemDocGia_Load(object sender, EventArgs e)
        {
            dt = data.loadDocGia();

            int mdg = timSTT(dt, "Mã độc giả");

            txtmdg.Text = mdg.ToString();

            CTL.Lop dataLop = new CTL.Lop();
            DataTable dtLop = dataLop.loadLop();
            ComboboxItem item;
            for (int i = 0; i < dtLop.Rows.Count; i++)
            {
                item = new ComboboxItem();
                item.Text = dtLop.Rows[i]["Lớp"].ToString();
                item.Value = dtLop.Rows[i]["Lớp"].ToString();
                cbxlop.Items.Add(item);
            }

            String[] gioitinh = { "Nam", "Nữ", "Khác" };

            for (int i = 0; i < gioitinh.Count(); i++)
            {
                item = new ComboboxItem();
                item.Text = gioitinh[i];
                item.Value = gioitinh[i];
                cbxgioitinh.Items.Add(item);
            }

            if (cbxlop.Items.Count > 0)
                cbxlop.SelectedIndex = 0;
            cbxgioitinh.SelectedIndex = 0;
        }
        private void SuaDocGia_Load(object sender, EventArgs e)
        {
            DOCGIA dg = data.timDocGia(mdg);
            HOCSINH hs = data.timHocSinh(mdg);
            NHANVIEN nv = data.timNhanVien(mdg);

            txtmdg.Text = dg.madocgia;
            txtten.Text = dg.hoten;

            if (dg.tinhtrang == true)
                cbtinhtrang.Checked = true;
            else
                cbtinhtrang.Checked = false;

            String[] gioitinh = { "Nam", "Nữ", "Khác" };

            ComboboxItem item;
            for (int i = 0; i < gioitinh.Count(); i++)
            {
                item = new ComboboxItem();
                item.Text = gioitinh[i];
                item.Value = gioitinh[i];
                cbxgioitinh.Items.Add(item);
            }

            CTL.Lop dataLop = new CTL.Lop();
            DataTable dtLop = dataLop.loadLop();
            for (int i = 0; i < dtLop.Rows.Count; i++)
            {
                item = new ComboboxItem();
                item.Text = dtLop.Rows[i]["Lớp"].ToString();
                item.Value = dtLop.Rows[i]["Lớp"].ToString();
                cbxlop.Items.Add(item);
            }

            for (int i = 0; i < cbxgioitinh.Items.Count; i++)
            {
                if (cbxgioitinh.Items[i].ToString() == dg.gioitinh)
                {
                    cbxgioitinh.SelectedIndex = i;
                    break;
                }
            }

            dngaysinh.Value = (DateTime)dg.ngaysinh;
            dngaylap.Value = (DateTime)dg.ngaylap;

            if (hs != null)
            {
                lbllop.Enabled = true;
                cbxlop.Enabled = true;
                for (int i = 0; i < cbxlop.Items.Count; i++)
                {
                    if (hs.lop == (cbxlop.Items[i] as ComboboxItem).Value.ToString())
                    {
                        cbxlop.SelectedIndex = i;
                        break;
                    }
                }
            }
            else if (nv != null)
            {
                lbllop.Enabled = false;
                cbxlop.Enabled = false;
            }
        }