private void btnCapNhat_Click(object sender, EventArgs e) { DataTable dtTemp = dtSinhVien.GetChanges(); if (dtTemp != null) { foreach (DataRow dr in dtTemp.Rows) { // update vao bang KQHT_ThanhPhanDiem for (int i = 0; i < grbThi.Columns.Count; i++) { if ("" + dr[grbThi.Columns[i].FieldName] != "") { try { pKQHT_DiemThiInfo.Diem = float.Parse(dr[grbThi.Columns[i].FieldName].ToString()); pKQHT_DiemThiInfo.HocKy = Program.HocKy; pKQHT_DiemThiInfo.IDDM_NamHoc = Program.IDNamHoc; pKQHT_DiemThiInfo.IDDM_MonHoc = int.Parse(grvMonThi.GetDataRow(grvMonThi.FocusedRowHandle)["DM_MonHocID"].ToString()); pKQHT_DiemThiInfo.IDHT_User = Program.objUserCurrent.HT_UserID; pKQHT_DiemThiInfo.LyDo = ""; pKQHT_DiemThiInfo.IDSV_SinhVien = int.Parse(dr["SV_SinhVienID"].ToString()); pKQHT_DiemThiInfo.NgayTao = DateTime.Now; pKQHT_DiemThiInfo.LanThi = int.Parse(grvDotThi.GetDataRow(grvDotThi.FocusedRowHandle)["LanThi"].ToString()); pKQHT_DiemThiInfo.IDXL_MonHocTrongKy = (TotNghiep == true?0: int.Parse(dr["XL_MonHocTrongKyID"].ToString())); oBKQHT_DiemThi.Add(pKQHT_DiemThiInfo); // neu la mon tot nghiep add luon vao bang TongKetMon if (TotNghiep == true) { pKQHT_DiemTongKetMonInfo.Diem = float.Parse(dr[grbThi.Columns[i].FieldName].ToString()); pKQHT_DiemTongKetMonInfo.HocKy = Program.HocKy; pKQHT_DiemTongKetMonInfo.IDDM_NamHoc = Program.IDNamHoc; pKQHT_DiemTongKetMonInfo.IDDM_MonHoc = int.Parse(grvMonThi.GetDataRow(grvMonThi.FocusedRowHandle)["DM_MonHocID"].ToString()); pKQHT_DiemTongKetMonInfo.LyDo = ""; pKQHT_DiemTongKetMonInfo.IDSV_SinhVien = int.Parse(dr["SV_SinhVienID"].ToString()); pKQHT_DiemTongKetMonInfo.LanThi = int.Parse(grvDotThi.GetDataRow(grvDotThi.FocusedRowHandle)["LanThi"].ToString()); oBKQHT_DiemTongKetMon.Add(pKQHT_DiemTongKetMonInfo); } } catch { // error } } } } ThongBao("Cập nhật thành công!"); } else { ThongBao("Bạn cần thay đổi thông tin trước khi cập nhật!"); } }
private void btnGhepPhach_Click(object sender, EventArgs e) { if (dtSinhVien == null || dtSinhVien.Rows.Count <= 0) { return; } DataTable dtChange = dtSinhVien.GetChanges(); if (dtChange != null) { ThongBao("Dữ liệu đã thay đổi, bạn cần lưu lại trước khi ghép phách."); return; } if (ThongBaoChon("Sau khi ghép phách bạn sẽ không được thay đổi điểm số!\nBạn có chắc chắn muốn ghép phách không?") != DialogResult.Yes) { return; } pKQHT_DiemThiInfo.IDXL_MonHocTrongKy = IDXL_MonHocTrongKy; pKQHT_DiemThiInfo.IDDM_MonHoc = IDDM_MonHoc; pKQHT_DiemThiInfo.IDDM_NamHoc = Program.IDNamHoc; pKQHT_DiemThiInfo.HocKy = Program.HocKy; pKQHT_DiemThiInfo.IDHT_User = Program.objUserCurrent.NS_GiaoVienID; pKQHT_DiemThiInfo.LanThi = int.Parse(cmbLanThi.Text); double Diem; foreach (DataRow dr in dtSinhVien.Rows) { try { if ("" + dr["Diem"] == "") { Diem = -1; } else { Diem = double.Parse(dr["Diem"].ToString()) - (double.Parse(dr["Diem"].ToString()) * double.Parse("0" + dr["MucPhatQuyChe"]) / 100); } pKQHT_DiemThiInfo.Diem = Math.Round(Diem, 0, MidpointRounding.AwayFromZero); pKQHT_DiemThiInfo.IDSV_SinhVien = int.Parse(dr["IDSV_SinhVien"].ToString()); oBKQHT_DiemThi.Add(pKQHT_DiemThiInfo); } catch { } } oBKQHT_DanhSachDuThi.UpdateDaChuyenDiem(true, IDXL_MonHocTrongKy, pKQHT_DiemThiInfo.LanThi); grvMonHoc_FocusedRowChanged(null, null); }
private void btnCapNhat_Click(object sender, EventArgs e) { DataTable dtTemp = dtSinhVien.GetChanges(); if (dtTemp != null) { foreach (DataRow dr in dtTemp.Rows) { if (dr.RowState == DataRowState.Modified) { // update vao bang KQHT_ThanhPhanDiem for (int i = 0; i < grbNhapDiem.Columns.Count; i++) { if ("" + dr[grbNhapDiem.Columns[i].FieldName] != "") { try { if (rdNhapDiem.EditValue.ToString() == "0") { pKQHT_DiemThanhPhanInfo.HocKy = Program.HocKy; pKQHT_DiemThanhPhanInfo.IDDM_NamHoc = Program.IDNamHoc; pKQHT_DiemThanhPhanInfo.IDDM_MonHoc = int.Parse(cmbMonHoc.EditValue.ToString()); pKQHT_DiemThanhPhanInfo.IDHT_User = Program.objUserCurrent.HT_UserID; pKQHT_DiemThanhPhanInfo.IDKQHT_ThanhPhanDiem = int.Parse(grbNhapDiem.Columns[i].FieldName); pKQHT_DiemThanhPhanInfo.LyDo = ""; pKQHT_DiemThanhPhanInfo.Diem = float.Parse(dr[grbNhapDiem.Columns[i].FieldName].ToString()); pKQHT_DiemThanhPhanInfo.IDSV_SinhVien = int.Parse(dr["SV_SinhVienID"].ToString()); pKQHT_DiemThanhPhanInfo.NgayTao = DateTime.Now; pKQHT_DiemThanhPhanInfo.IDXL_MonHocTrongKy = int.Parse(cmbMonHoc.GetColumnValue("XL_MonHocTrongKyID").ToString()); oBKQHT_DiemThanhPhan.Add(pKQHT_DiemThanhPhanInfo); } else { pKQHT_DiemThiInfo.HocKy = Program.HocKy; pKQHT_DiemThiInfo.IDDM_NamHoc = Program.IDNamHoc; pKQHT_DiemThiInfo.IDDM_MonHoc = int.Parse(cmbMonHoc.EditValue.ToString()); pKQHT_DiemThiInfo.IDHT_User = Program.objUserCurrent.HT_UserID; pKQHT_DiemThiInfo.LyDo = ""; pKQHT_DiemThiInfo.Diem = float.Parse(dr[grbNhapDiem.Columns[i].FieldName].ToString()); pKQHT_DiemThiInfo.IDSV_SinhVien = int.Parse(dr["SV_SinhVienID"].ToString()); pKQHT_DiemThiInfo.NgayTao = DateTime.Now; pKQHT_DiemThiInfo.LanThi = int.Parse(cmbLanThi.EditValue.ToString()); pKQHT_DiemThiInfo.IDXL_MonHocTrongKy = int.Parse(cmbMonHoc.GetColumnValue("XL_MonHocTrongKyID").ToString()); oBKQHT_DiemThi.Add(pKQHT_DiemThiInfo); } } catch { // error } } } } } ThongBao("Cập nhật thành công!"); } else { ThongBao("Bạn cần thay đổi thông tin trước khi cập nhật!"); } }