protected override void SaveDetail() { try { foreach (var row in dgv_DanhSach.Rows) { var hs = new DiemThi { MaSV = int.Parse(row.Cells["MaSV"].Text), Diem = double.Parse(row.Cells["TongDiem"].Text), IdNamHoc = _idnamhoc, HocKy = _hocky }; _listThongke.Add(hs); } if (_listThongke.Count > 0) { InsertData.ThemThongKe(_listThongke); MessageBox.Show(@"Thêm thành công"); } } catch (Exception ex) { Log2File.LogExceptionToFile(ex); } }
private void btnXoa_Click(object sender, EventArgs e) { int index; try { index = Int32.Parse(txtSTT.Text); } catch { MessageBox.Show("Số thứ tự của Điểm thi bị xóa phải là số nguyên", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (index > DB.DiemThis.Count || index < 1) { MessageBox.Show("STT của Điểm thi bị xóa phải nằm trong khoảng 0 đến số lượng điểm thi", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DiemThi a = DB.DiemThis[index - 1]; DB.DiemThis.Remove(a); MessageBox.Show("Xóa thông tin điểm thi thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); }
private void button1_Click(object sender, EventArgs e) { string maSv = textBoxMaSv.Text; string maMh = (string)comboBoxMaMh.SelectedValue; string lanThi = (string)comboBoxLanThi.SelectedItem; string diemThi = textBoxDiemThi.Text; if (checkFormat(diemThi)) { if (SinhVien.CheckSinhVienExits(maSv)) { DiemThi d = new DiemThi(maSv, maMh, Convert.ToInt32(lanThi), Convert.ToInt32(diemThi)); if (DiemThi.insertDiem(d)) { MessageBox.Show("Them Diem Thanh Cong"); } else { MessageBox.Show("Them Diem That Bai", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Sinh Vien " + maSv + " khong ton tai!!!!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void SaveDetail1() { try { foreach (var row in dgv_DanhSach.Rows) { var hs = new DiemThi { MaSV = int.Parse(row.Cells["MaSV"].Text), Diem = double.Parse(row.Cells["DiemThi"].Text), IdNamHoc = _idnamhoc, HocKy = _hocky }; _listThongke.Add(hs); } if (_listThongke.Count > 0 || _listUpdate.Count > 0) { UpdateData.UpdateDiemThi(_listUpdate); InsertData.ThemThongKe(_listThongke); MessageBox.Show(@"Lưu lại thành công"); } } catch (Exception ex) { Log2File.LogExceptionToFile(ex); } }
public ActionResult DeleteConfirmed(string id) { DiemThi diemThi = db.DiemThis.Find(id); db.DiemThis.Remove(diemThi); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "MaSv,TenSv,MaMh,TenMh,Diem")] DiemThi diemThi) { if (ModelState.IsValid) { db.Entry(diemThi).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(diemThi)); }
public ActionResult Create([Bind(Include = "MaSv,TenSv,MaMh,TenMh,Diem")] DiemThi diemThi) { if (ModelState.IsValid) { db.DiemThis.Add(diemThi); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(diemThi)); }
// GET: DiemThis/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DiemThi diemThi = db.DiemThis.Find(id); if (diemThi == null) { return(HttpNotFound()); } return(View(diemThi)); }
/// <summary> /// Thêm bảng thống kê /// </summary> /// <returns></returns> public static bool ThemThongKe(DiemThi item) { try { var diem = item.Diem.ToString().Replace(',', '.'); Conn.ExcuteQuerySql("insert into DIEMTHI(MaSV,IdNamHoc,HocKy,Diem) values(" + item.MaSV + "," + item.IdNamHoc + ",'" + item.HocKy + "'," + diem + ")"); return(true); } catch (Exception ex) { Log2File.LogExceptionToFile(ex); return(false); } }
private void button1_Click(object sender, EventArgs e) { int adminID = Admin.getAdminIdByUser(a.User1); if (adminID == 0) { MessageBox.Show("Can't not find out " + a.User1); return; } string lanThi = textBoxLanThi.Text; string diem = textBoxDiemThi.Text; if (lanThi.Length == 0 || diem.Length == 0) { MessageBox.Show("You must enter value for Lan thi and Diem"); } else if (checkNumber(lanThi) && checkNumber(diem)) { var result = MessageBox.Show("Do you want to update ?", "Notification", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { int lThi = Convert.ToInt32(lanThi); int diemTh = Convert.ToInt32(diem); //update diem thi if (DiemThi.updateDiem(s, lThi, diemTh)) { MessageBox.Show("Update success"); } else { MessageBox.Show("Update faill"); return; } DateTime d = DateTime.Now; if (HistoryAction.insertHistoryAction(adminID, "Update", d, "Update DiemThi with MaSv " + s.MaSv1 + " Diem Thi Lan Cu: " + s.DiemThi1 + " -> Diem Thi Moi: " + diemTh + " Lan Thi Cu: " + s.LanThi1 + " -> Lan Thi Moi: " + lanThi)) { MessageBox.Show("Add History Success"); } } } else { MessageBox.Show("Please Input Againt"); } }
private void btnThem_Click(object sender, EventArgs e) { if (Check()) { try { DiemThi tg = new DiemThi(); tg.SBD = Int32.Parse(txtSBD.Text); tg.Toan = float.Parse(txtToan.Text); tg.Van = float.Parse(txtVan.Text); tg.Anh = float.Parse(txtAnh.Text); int STT = Int32.Parse(txtSTT.Text); List<DiemThi> temp = new List<DiemThi>(); for (int i = 1; i < STT; i++) temp.Add(DB.DiemThis[i - 1]); temp.Add(tg); for (int i = STT; i <= DB.DiemThis.Count; i++) temp.Add(DB.DiemThis[i - 1]); DB.DiemThis = temp; MessageBox.Show("Thêm điểm thi thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch { } } }