public DoKho GetDoKho(int Id) { string cacheKey; DoKho objDoKho = new DoKho(); cacheKey = "nuce_web_thi_dokho_" + Id.ToString(); if (Cache[cacheKey] == null) { DataTable objTable = InitCacheDoKho(); DataRow[] drs = objTable.Select(string.Format("DoKhoID={0}", Id)); if (drs.Length > 0) { objDoKho.DoKhoID = Id; objDoKho.Ten = drs[0]["Ten"].ToString(); } else { objDoKho.DoKhoID = Id; objDoKho.Ten = ""; } Cache.Insert(cacheKey, objDoKho); } else { objDoKho = (DoKho)Cache[cacheKey]; } return(objDoKho); }
public List<Bai> LayTheoDoKho(DoKho doKho) { List<Bai> lstResult = new List<Bai>(); foreach (Bai b in InMemoryDatabase.BaiTable.Values) if (b.DoKho == doKho) lstResult.Add(b); return (List < Bai > )lstResult; }
public Bai(int id, string tenBai, String noiDung,int maFileCham, string fileCham ,DateTime ngayDang,long gioiHanThoiGian,long gioiHanBoNho, string thuMuc, string testDataZipFile,bool hienThi, DoKho doKho) { ID = id; Ten = tenBai; NoiDung = noiDung; MaFileCham = maFileCham; FileCham = fileCham; NgayDang = ngayDang; GioiHanThoiGian = gioiHanThoiGian; GioihanBoNho = gioiHanBoNho; ThuMucBai = thuMuc; TestDataZipFile = testDataZipFile; HienThi = hienThi; DoKho = doKho; }
private void button1_Click(object sender, EventArgs e) { DialogResult dialog = MessageBox.Show("Bạn có chắc là muốn chỉnh sửa ", "Thông báo ", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dialog == DialogResult.No) { return; } if (String.IsNullOrEmpty(txtNoiDung.Text) == true) { MessageBox.Show("Không được để nội dung trống . Xin mời nhập lại", "Lối", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (string.IsNullOrEmpty(txtCauA.Text) == true) { MessageBox.Show("Không được để câu A trống . Xin mời nhập lại ", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (string.IsNullOrEmpty(txtCauB.Text) == true) { MessageBox.Show("Không được để câu B trống . Xin mời nhập lại ", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (string.IsNullOrEmpty(txtCauC.Text) == true) { MessageBox.Show("Không được để câu C trống . Xin mời nhập lại ", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (string.IsNullOrEmpty(txtCauD.Text) == true) { MessageBox.Show("Không được để câu D trống . Xin mời nhập lại ", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Khoi MaKhoi = new Khoi(); DoKho doKho = new DoKho(); foreach (var b in khois) { if (b.TenKhoi == cbKhoi.Text) { MaKhoi = b; break; } } foreach (var c in dokhobus) { if (c.TenDoKho == cbDoKho.Text) { doKho = c; break; } } int ThanhCong = cauHoiBUS_HT.UpdateCauHoi(cauHoi123.MaCauHoi, txtNoiDung.Text, txtCauA.Text, txtCauB.Text, txtCauC.Text, txtCauD.Text, cbCauDung.Text, MaKhoi.MaKhoi, doKho.maDoKho); if (ThanhCong == 0) { cauHoi123.NoiDung = txtNoiDung.Text; cauHoi123.CauA = txtCauA.Text; cauHoi123.CauB = txtCauB.Text; cauHoi123.CauC = txtCauC.Text; cauHoi123.CauD = txtCauD.Text; cauHoi123.CauDung = cbCauDung.Text; cauHoi123.DoKho1 = doKho; cauHoi123.Khoi = MaKhoi; foreach (var mem in cauHois) { if (this.cauHoi123.MaCauHoi == mem.MaCauHoi) { mem.NoiDung = txtNoiDung.Text; mem.CauA = txtCauA.Text; mem.CauB = txtCauB.Text; mem.CauC = txtCauC.Text; mem.CauD = txtCauD.Text; mem.CauDung = cbCauDung.Text; mem.DoKho1 = doKho; mem.Khoi = MaKhoi; } } truyenquabenkialai(this.cauHois, cauHoi123); MessageBox.Show("Thành Công", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (ThanhCong == 1) { MessageBox.Show("Lối nằm ở chỗ không thêm được đáp án", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ThanhCong == 2) { MessageBox.Show("Lối không tìm thấy mã khối", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ThanhCong == 3) { MessageBox.Show("Lối không tìm thấy độ khó", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ThanhCong == 4) { MessageBox.Show("Bạn chưa chỉnh sửa gì để update .", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ThanhCong == 5) { MessageBox.Show("Mã câu hỏi chưa tồn tại trong bảng câu hỏi .", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ThanhCong == 6) { MessageBox.Show("Nội dung trùng với câu nào đó trong bảng câu hỏi ", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
public List<Bai> LayTheoDoKho(DoKho doKho) { throw new NotImplementedException(); }