protected void btCapNhat_Click(object sender, EventArgs e) { if (Request.Cookies["ADMIN"] == null) return; try { class_TracNghiem ob = new class_TracNghiem(); string cmd = string.Format("EXEC dbo.Session_Update_2015 {0}, N'{1}', '{2} {3}', {4}, {5}, {6}", lbKyThi.Text, tbKyThi.Text, ob.convertDate(tbNgayBD.Text), tbGioBD.Text, tbThoiGian.Text, tbDiemYC.Text, cbNhom.Checked ? "1" : "0"); DataSet ds = ob.fillDataset(cmd); if (ds.Tables[0].Rows[0][0].ToString() == "1") { lbKyThi.Text = ds.Tables[0].Rows[0][1].ToString(); TextBox tbSoLuong, tbDiemCH, tbYeuCau; foreach (GridViewRow dr in gvLinhVuc.Rows) { tbSoLuong = (TextBox)dr.FindControl("tbSoLuong"); tbDiemCH = (TextBox)dr.FindControl("tbDiemCH"); tbYeuCau = (TextBox)dr.FindControl("tbYeuCau"); cmd = string.Format("EXEC dbo.Session_Part_Update {0}, {1}, {2}, {3}, {4}", lbKyThi.Text, dr.Cells[6].Text, tbSoLuong.Text, tbDiemCH.Text, tbYeuCau.Text); ob.fillDataset(cmd); } Load_Data(); lbError.Text = "Cập nhật kỳ thi thành công"; } else lbError.Text = "Không thể cập nhật kỳ thi"; } catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình cập nhật. " + ex.Message; } }
protected void btCapNhat_Click(object sender, EventArgs e) { if (Request.Cookies["ADMIN"] == null) return; try { Convert.ToInt32(lbID.Text); } catch { lbID.Text = "0"; } try { class_TracNghiem ob = new class_TracNghiem(); string cmd = string.Format("EXEC dbo.Session_Update {0}, N'{1}', {2}, '{3} {4}', {5}", lbID.Text, tbKyThi.Text, tbCauHoi.Text, ob.convertDate(tbNgay.Text), tbGio.Text, tbThoiGian.Text); ob.fillDataset(cmd); btBoQua_Click(sender, e); gvSessions.DataSource = ob.fillDataset("EXEC dbo.Admin_List"); gvSessions.DataBind(); } catch { } }