private void FDSThoiKhoaBieu_Load(object sender, EventArgs e) { //Đổi tên Form this.Text = "Thời khóa biểu " + strThu[iThuSelect].ToString(); btnPrevThu.Enabled = false; dsLichHoc = CHoatDong_BLL.loadDSLichHocTuan(strMaSV); loadDataGrid(); }
private void tmiThemSuKien_Click(object sender, EventArgs e) { FThemSuKien frm = new FThemSuKien(strMaSV); frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowDialog(); suKiens = CHoatDong_BLL.loadSuKienTrongNgay(strMaSV); indexSuKien = -1; if (suKiens.Rows.Count != 0) { lblNext_Click(this.lblNext, new EventArgs()); lblPrev.Enabled = false; } }
private void btnThem_Click(object sender, EventArgs e) { #region LayDuLieuTuForm int iCoutHD = CHoatDong_BLL.countHoatDong(); #endregion int iThu = (int)numbThu.Value; if (CHoatDong_BLL.themLichHoc(strMaSV, iThu, "HD" + iCoutHD, cmbMonHoc.SelectedValue.ToString(), true, dtmpTu.Value, dtmpDen.Value, txtMoTa.Text, lblMauLich.BackColor.ToArgb()) == false) { MessageBox.Show("Thêm lỗi"); return; } this.Close(); return; }
/// <summary> /// Load dữ liệu lịch học từ database và đưa đến listSuKienUC để sau đó đưa vào lineTableUC /// </summary> private bool loadLichHocTrongNgay() { lichHocs = CHoatDong_BLL.loadLichHocTrongNgay(strMaSV); if (lichHocs == null) { listSuKienUC = null; return(false); } listSuKienUC = new List <SuKien>(); foreach (DataRow dr in lichHocs.Rows) { Color clSuKien = Color.FromArgb(int.Parse(dr["MauMucDo"].ToString())); SuKien sk = new SuKien(clSuKien, DateTime.Parse(dr["GioBD"].ToString()), DateTime.Parse(dr["GioKT"].ToString()), CMonHoc_BLL.loadTenMon(dr["MaMon"].ToString())); listSuKienUC.Add(sk); } return(true); }
/// <summary> /// Su kiện của ghi chú. /// </summary> private void loadSuKienGhiChu() { suKiens = CHoatDong_BLL.loadSuKienTrongNgay(strMaSV); try { lblThoiGian.Text = DateTime.Parse(suKiens.Rows[indexSuKien]["GioBD"].ToString()).ToShortDateString() + "\n" + DateTime.Parse(suKiens.Rows[indexSuKien]["GioKT"].ToString()).ToShortDateString(); lblThongTin.Text = CMonHoc_BLL.loadTenMon(suKiens.Rows[indexSuKien]["MaMon"].ToString()) + "\n" + suKiens.Rows[indexSuKien]["GhiChuHD"].ToString(); } catch (Exception) { MessageBox.Show("Lỗi load dữ liệu sự kiện, không có sự kiện nào"); } if (suKiens.Rows.Count <= 1) { lblNext.Enabled = false; } }
private void btnThem_Click(object sender, EventArgs e) { int iCountHD = CHoatDong_BLL.countHoatDong(); DateTime DtmGioBD = DateTime.Parse(dtmpNgayBatDau.Value.ToShortDateString() + " " + dtmpThoiGianBatDau.Value.ToShortTimeString()); DateTime DtmGioKT = DateTime.Parse(dtmpNgayDen.Value.ToShortDateString() + " " + dtmpThoiGianDen.Value.ToShortTimeString()); if (DtmGioBD > DtmGioKT) { MessageBox.Show("Thời gian bạn nhập không hợp lý."); return; } if (CHoatDong_BLL.themHoatDong(strMaSV, "HD" + iCountHD, cmbMonHoc.SelectedValue.ToString(), false, DtmGioBD, DtmGioKT, txtMoTa.Text)) { MessageBox.Show("Thêm thành công."); this.Close(); } else { MessageBox.Show("Thêm thất bại."); } }