Beispiel #1
0
        private void btnGetGio_Click(object sender, EventArgs e)
        {
            try
            {
                if (DateTime.Parse(dtpBatDau.Value.ToShortDateString()) >
                    DateTime.Parse(dtpKetThuc.Value.ToShortDateString()))
                {
                    BatLoi.ThongBao2("Vui lòng kiểm tra lại ngày");
                    return;
                }
            }
            catch (Exception)
            {
                BatLoi.ThongBao2("Vui lòng kiểm tra lại ngày");
                return;
            }
            dgrDanhSach.Rows.Clear();
            double ttday = (dtpKetThuc.Value - dtpBatDau.Value).TotalDays;

            for (int i = 0; i <= ttday; i++)
            {
                string st = dtpBatDau.Value.AddDays(i).ToString("dd/MM/yyyy");
                dgrDanhSach.Rows.Add(st, " 7:00", "Xóa");
                dgrDanhSach.Rows.Add(st, " 9:00", "Xóa");
                dgrDanhSach.Rows.Add(st, " 13:00", "Xóa");
                dgrDanhSach.Rows.Add(st, " 15:00", "Xóa");
            }
        }
Beispiel #2
0
 private void rtChucNang_Click(object sender, EventArgs e)
 {
     if (!DangNhap)
     {
         rtMain.Select();
         BatLoi.ThongBao2("Vui lòng đăng nhập để sử dụng chương trình");
     }
 }
Beispiel #3
0
 void Active_Form()
 {
     if (!XuLyXml.HasCreatedLevel())
     {
         if (BatLoi.DgResul("Bậc học chưa được cài đặt, bạn có muốn cài đặt không?"))
         {
             frmQlBacHoc qlbh = new frmQlBacHoc();
             qlbh.ShowDialog();
         }
     }
 }
Beispiel #4
0
 private void btnHuongDanSuDung_Click(object sender, EventArgs e)
 {
     if (File.Exists("Help.chm"))
     {
         Process.Start("Help.chm");
     }
     else
     {
         BatLoi.ThongBao2("Lỗi: Không tìm thấy file Help.chm");
     }
 }
Beispiel #5
0
 bool KiemTra(string Text)
 {
     if (Text.Trim() == "")
     {
         return(BatLoi.ThongBao2("Vui lòng nhập tên bậc học"));
     }
     foreach (DataGridViewRow r in dgrDanhSach.Rows)
     {
         if (Convert.ToString(r.Cells[0].Value).ToLower() == Text.ToLower())
         {
             return(BatLoi.ThongBao2("Bậc này đã có trong danh sách"));
         }
     }
     return(!BatLoi.ThongBao2("Thêm thành công"));
 }
 bool KiemTra()
 {
     if (BatLoi.TextNull(txtTenPhong.Text, "Vui lòng nhập tên phòng") &&
         BatLoi.TextNull(txtSoLuong.Text, "Vui lòng nhập số chỗ ngồi") &&
         BatLoi.SoLuong(txtSoLuong.Text, "Số lượng chỗ ngồi sai, vui lòng kiểm tra lại"))
     {
         foreach (DataGridViewRow r in dgrDanhSach.Rows)
         {
             if (Convert.ToString(r.Cells[0].Value).ToLower() == txtTenPhong.Text.ToLower())
             {
                 return(BatLoi.ThongBao2("Phòng này đã có trong danh sách"));
             }
         }
         return(!BatLoi.ThongBao2("Thêm thành công"));
     }
     return(false);
 }
Beispiel #7
0
        private void btnLoadFile_Click(object sender, EventArgs e)
        {
            DialogResult rs = openFileDialog.ShowDialog();

            try
            {
                if (rs == DialogResult.OK)
                {
                    XuLyDataGridView.LoadData(grwDanhSach, openFileDialog.FileName);
                    grwDanhSach.Columns[2].Width = 300;
                    btnChonNhom.Enabled          = btnXuatExcel.Enabled = btnInKetQua.Enabled = true;
                    btnChonPhong.Enabled         = btnXepLichThi.Enabled = false;
                    ShowStatus("Load Dữ Liệu Thành Công");
                }
            }
            catch (Exception)
            {
                BatLoi.ThongBao2("Lỗi! Không thể load dữ liệu từ file đã chọn");
            }
        }
Beispiel #8
0
 void Active_Form(bool active)
 {
     DangNhap = active;
     if (active)
     {
         btnDangNhap.Text        = "Đăng Xuất";
         this.btnCapNhat.Enabled = true;
         if (!XuLyXml.DaTaoBacHoc())
         {
             if (BatLoi.DgResul("Bậc học chưa được cài đặt, bạn có muốn cài đặt không?"))
             {
                 frmQlBacHoc qlbh = new frmQlBacHoc();
                 qlbh.ShowDialog();
             }
         }
     }
     else
     {
         this.btnDangNhap.Text   = "Đăng Nhập";
         this.btnCapNhat.Enabled = false;
     }
 }
Beispiel #9
0
 private void btnXuatExcel_Click(object sender, EventArgs e)
 {
     try
     {
         if (grwDanhSach.Rows.Count == 0)
         {
             BatLoi.ThongBao2("Chưa có dữ liệu để lưu");
             return;
         }
         if (saveFileDialog.ShowDialog() == DialogResult.OK)
         {
             saveFileName = saveFileDialog.FileName;
             DataColumn c = ((DataTable)grwDanhSach.DataSource).Columns["NHÓM"];
             ((DataTable)grwDanhSach.DataSource).Columns.Remove(c);
             Excel.Export((DataTable)grwDanhSach.DataSource, saveFileName, "KẾT QUẢ XẾP LỊCH THI");
             ((DataTable)grwDanhSach.DataSource).Columns.Add(c);
             ShowStatus("Lưu Kết Quả Thành Công");
         }
     }
     catch (Exception)
     {
         ShowStatus("Đã xảy ra lỗi... Dữ liệu chưa được lưu");
     }
 }