private void btnLuu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { bool ktra = true; for (int i = 0; i < this.dgvDiemThi.RowCount; i++) { if (Convert.ToDecimal(this.dgvDiemThi.GetRowCellValue(i, DiemGiuaKy)) > 10 || Convert.ToDecimal(this.dgvDiemThi.GetRowCellValue(i, DiemGiuaKy)) < 0 || Convert.ToDecimal(this.dgvDiemThi.GetRowCellValue(i, DiemCuoiKy)) > 10 || Convert.ToDecimal(this.dgvDiemThi.GetRowCellValue(i, DiemCuoiKy)) < 0) { MessageBox.Show( "Điểm của SV " + this.dgvDiemThi.GetRowCellValue(i, MaSV).ToString() + " đã nhập sai.", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Error); ktra = false; break; } } if (ktra == true) { for (int i = 0; i < this.dgvDiemThi.RowCount; i++) { if (!dtBUS.suaDiemThi(this.dgvDiemThi.GetRowCellValue(i, MaSV).ToString(), this.cbbHocPhan.Text, Convert.ToDecimal(this.dgvDiemThi.GetRowCellValue(i, DiemGiuaKy) == null ? 0 : this.dgvDiemThi.GetRowCellValue(i, DiemGiuaKy)), Convert.ToDecimal(this.dgvDiemThi.GetRowCellValue(i, DiemCuoiKy) == null ? 0 : this.dgvDiemThi.GetRowCellValue(i, DiemCuoiKy)))) { MessageBox.Show("Khong SUA duoc. Loi !!!", "THONG BAO", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } } this.dgcDiemThi.DataSource = svBUS.getSVTheoMaHP(this.cbbHocPhan.SelectedValue.ToString()); this.dgvDiemThi.OptionsBehavior.Editable = false; this.btnLuu.Enabled = false; this.btnHuy.Enabled = false; } }
private void btnLuu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { bool ktra = true; for (int i = 0; i < this.dgvDiemThi.RowCount; i++) { if (Convert.ToDecimal(this.dgvDiemThi.GetRowCellValue(i, DiemGiuaKy)) > 10 || Convert.ToDecimal(this.dgvDiemThi.GetRowCellValue(i, DiemGiuaKy)) < 0 || Convert.ToDecimal(this.dgvDiemThi.GetRowCellValue(i, DiemCuoiKy)) > 10 || Convert.ToDecimal(this.dgvDiemThi.GetRowCellValue(i, DiemCuoiKy)) < 0) { MessageBox.Show( "Điểm của SV " + this.dgvDiemThi.GetRowCellValue(i, MaSV).ToString() + " đã nhập sai.", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Error); ktra = false; break; } } if (ktra == true) { for (int i = 0; i < this.dgvDiemThi.RowCount; i++) { if (!dtBUS.suaDiemThi(this.dgvDiemThi.GetRowCellValue(i, MaSV).ToString(), this.cbbHocPhan.Text, Convert.ToDecimal(this.dgvDiemThi.GetRowCellValue(i, DiemGiuaKy) == null ? 0 : this.dgvDiemThi.GetRowCellValue(i, DiemGiuaKy)), Convert.ToDecimal(this.dgvDiemThi.GetRowCellValue(i, DiemCuoiKy) == null ? 0 : this.dgvDiemThi.GetRowCellValue(i, DiemCuoiKy)))) { MessageBox.Show("Khong Xoa duoc. Loi !!!", "THONG BAO", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } } LoadData(); } }