private void btnNopBai_Click(object sender, EventArgs e) { DialogResult kq = MessageBox.Show("Bạn có chắc muốn nộp bài thi?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (kq == DialogResult.Yes) { ChonDapAn(); double soDiem = TinhDiem(); double soCauDung = SoCauDung(); if (loai == "ThiThu") { hocSinhBUS.AddKetQuaThiThu(hocSinhLogin.MaHocSinh, maDeDuocChon, maKhoiHS, soDiem); } if (loai == "Thi") { string maDeVaKhoiTrongKyThi = dsCauHoiThi[0].MaDeVaKhoiTrongKyThi; hocSinhBUS.AddKetQuaThi(hocSinhLogin.MaHocSinh, maDeVaKhoiTrongKyThi, soDiem); } HetGioForm hetGio = new HetGioForm(hocSinhLogin, stopTimer, soDiem, soCauDung, phut, giay, loai); this.Hide(); hetGio.ShowDialog(); this.Close(); Application.Exit(); } else { return; } }
private void timer1_Tick(object sender, EventArgs e) { giay -= 1; if (giay < 0) { phut -= 1; giay = 59; } lbTimerPhut.Text = phut.ToString(); lbTimerGiay.Text = giay.ToString(); if (phut < 0) { if (loai == "ThiThu") { ChonDapAn(); double soDiem = TinhDiem(); int soCauDung = SoCauDung(); hocSinhBUS.AddKetQuaThiThu(hocSinhLogin.MaHocSinh, maDeDuocChon, maKhoiHS, soDiem); HetGioForm hetGio = new HetGioForm(hocSinhLogin, stopTimer, soDiem, soCauDung, phut, giay, loai); this.Hide(); hetGio.ShowDialog(); this.Close(); Application.Exit(); } if (loai == "Thi") { ChonDapAn(); double soDiem = TinhDiem(); int soCauDung = SoCauDung(); string maDeVaKhoiTrongKyThi = dsCauHoiThi[0].MaDeVaKhoiTrongKyThi; hocSinhBUS.AddKetQuaThi(hocSinhLogin.MaHocSinh, maDeVaKhoiTrongKyThi, soDiem); HetGioForm hetGio = new HetGioForm(hocSinhLogin, stopTimer, soDiem, soCauDung, phut, giay, loai); this.Hide(); hetGio.ShowDialog(); this.Close(); Application.Exit(); } } }