private async void txtLop_Leave(object sender, EventArgs e)
        {
            Lop = await apis.GetLop(main.HocKy, txtLop.Text.ToString());

            if (Lop != null)
            {
                lblBaoLoi.Text      = "";
                lblThongTinLop.Text = @"Chuyên ngành: " + Lop.chuyenNganh + ",  Khoá: " + Lop.khoa + ",  Quân số: " + Lop.quanSo + ",  Giảng đường: " + Lop.giangDuong;
                this.Text           = "Xếp thời khoá biểu lớp " + Lop.ten;
                typingTiet.lop      = Lop;
                await LoadData();

                dateNgay.Focus();
                cbxTietHoc.Enabled  = true;  txtMonHoc.Enabled = true;   txtBaiBuoi.Enabled = true;
                cbxHinhThuc.Enabled = true; txtDiaDiem.Enabled = true;  txtGiangVien.Enabled = true;
                gridTietHoc.Enabled = true;
            }
            else
            {
                if (txtLop.Text.ToString() != "")
                {
                    lblBaoLoi.Text = "Lớp này chưa có trong cơ sở dữ liệu!";
                }
                cbxTietHoc.Enabled  = false; txtMonHoc.Enabled = false; txtBaiBuoi.Enabled = false;
                cbxHinhThuc.Enabled = false; txtDiaDiem.Enabled = false; txtGiangVien.Enabled = false;
                gridTietHoc.Enabled = false;
            }
        }
Exemple #2
0
        private async void btnXacNhan_Click(object sender, EventArgs e)
        {
            if (txtTen.Text.ToString() == "" || cbxChuyenNganh.Text.ToString() == "" || txtKhoa.Text.ToString() == "" || txtQuanSo.Text.ToString() == "" || txtGiangDuong.Text.ToString() == "")
            {
                return;
            }

            Lop lop = new Lop();

            lop.ten        = txtTen.Text; lop.chuyenNganh = cbxChuyenNganh.Text;
            lop.khoa       = Int32.Parse(txtKhoa.Text); lop.quanSo = Int32.Parse(txtQuanSo.Text);
            lop.giangDuong = txtGiangDuong.Text;
            lop.tieuDoan   = txtTieuDoan.Text;
            lop.hocKy      = hocKy;
            string cn = cbxChuyenNganh.Text;

            Lop chk = await apis.GetLop(lop);

            if (chk != null)
            {
                DialogResult dal = MessageBox.Show("Lớp này đã tồn tại", "Lỗi nhập", MessageBoxButtons.OK);
                return;
            }

            JObject ex = await apis.PostLop(lop);

            await loadData();
        }
Exemple #3
0
        private async void txtLop_Leave(object sender, EventArgs e)
        {
            if (txtLop.Text.ToString() == "" || txtLop.Text.ToString() == "Tất cả lớp")
            {
                txtLop.Text         = "Tất cả lớp";
                lblThongTinLop.Text = "Áp dụng cho toàn trường";
                lop = null;
                await LoadData();

                return;
            }
            lop = await apis.GetLop(main.HocKy, txtLop.Text.ToString());

            if (lop != null)
            {
                lblThongTinLop.Text = @"Chuyên ngành: " + lop.chuyenNganh + ",  Khoá: " + lop.khoa + ",  Quân số: " + lop.quanSo + ",  Giảng đường: " + lop.giangDuong;
                await LoadData();
            }
            else
            {
                lblThongTinLop.Text      = "Lớp này chưa có trong cơ sở dữ liệu!";
                gridNgayNghis.DataSource = null;
                lop = null;
                txtLop.Focus();
            }
        }
        private async void btnXemTkbLop_ItemClick(object sender, ItemClickEventArgs e)
        {
            string choosed = cbxXemTheo.EditValue.ToString();
            string str     = txtTkbHocKy.EditValue == null ? "" : txtTkbHocKy.EditValue.ToString();

            if (choosed == "Lớp")
            {
                Lop lop = await apis.GetLop(HocKy, str);

                if (lop != null)
                {
                    TkbHocKyLopForm tKB_HK = new TkbHocKyLopForm(this, lop);
                    tKB_HK.tietHocs = await apis.GetTietHocs(HocKy, lop, "");

                    tKB_HK.MdiParent = this;
                    tKB_HK.Show();
                }
                else
                {
                    DialogResult dal = MessageBox.Show("Lớp không tồn tại", "Lỗi", MessageBoxButtons.OK);
                }
            }
            else
            {
                TieuDoan td = await apis.GetTieuDoan(str);

                if (td != null)
                {
                    TkbHocKyTieuDoanForm frm = new TkbHocKyTieuDoanForm(this, str);
                    frm.lops = await apis.GetLopsByTieuDoan(HocKy, str);

                    frm.MdiParent = this;
                    frm.Show();
                }
                else
                {
                    DialogResult dal = MessageBox.Show("Tiểu đoàn không tồn tại", "Lỗi", MessageBoxButtons.OK);
                }
            }
        }
        private async Task LoadData()
        {
            string str = txtLop.Text;

            lop = await apis.GetLop(hocKy, str);

            if (lop == null)
            {
                tietHocs = null;
            }
            else
            {
                this.Text     = "Tra cứu tiết học lớp " + lop.ten;
                lblTitle.Text = "Tra cứu tiết học lớp " + lop.ten;
            }

            tietHocs = lop == null? null : await apis.GetTietHocsNgay(hocKy, lop, ngay);

            gridTietHoc.DataSource = tietHocs;
        }