public List <DiemMonHoc> GetDiemMonHoc(int maLop, int mamonhoc, int mahocki) { var param = new List <SqlParameter>(); param.Add(new SqlParameter("@malop", maLop)); param.Add(new SqlParameter("@mamonhoc", mamonhoc)); param.Add(new SqlParameter("@hocki", mahocki)); try { var d = ExecProcedrure("dbo.LayDiemMon", System.Data.CommandType.StoredProcedure, param); var list = new List <DiemMonHoc>(); while (d.Read()) { var diemmonhoc = new DiemMonHoc(); diemmonhoc.MaDiemMon = d.GetInt32(0); diemmonhoc.MaMonHoc = d.GetInt32(1); diemmonhoc.MaHS = d.GetInt32(2); diemmonhoc.MaLop = d.GetInt32(3); diemmonhoc.DTB = d.GetFloat(4); diemmonhoc.MaHocKi = d.GetString(5); diemmonhoc.LoaiKiemTra = d.GetInt32(6); diemmonhoc.Diem = d.GetFloat(7); diemmonhoc.MaDiem = d.GetInt32(8); diemmonhoc.TenHS = d.GetString(9); list.Add(diemmonhoc); } DisConnect(); return(list); } catch (Exception) { throw; } }
public DiemMonHoc AddDiemMonHoc(DiemMonHoc diemMonHoc) { db = new GDUDataConnectionsDataContext(); db.DiemMonHocs.InsertOnSubmit(diemMonHoc); db.SubmitChanges(); return(diemMonHoc); }
private void btnSaveDiem_Click(object sender, EventArgs e) { DiemMonHoc diemMonHoc = new DiemMonHoc(); diemMonHoc.Diem30 = Convert.ToDouble(txtDiem30); diemMonHoc.Diem70L1 = Convert.ToDouble(txtDiem70L1); diemMonHoc.Diem70L1 = Convert.ToDouble(txtDiem70L2); diemMonHocService.AddDiemMonHoc(diemMonHoc); LoadDanhSachDiemSinhVienToDatagridview(); }
private void dgrDiem_CellClick(object sender, DataGridViewCellEventArgs e) { int numrow; numrow = e.RowIndex; var madiem = int.Parse(dgrDiem.Rows[numrow].Cells[0].Value.ToString()); d = diem.First(x => x.MaDiem == madiem); if (d != null) { txtD.Text = d.Diem.ToString(); var kt = init.InitLoaiKiemTra(cbLKT); cbLKT.Text = kt.First(x => x.Id == d.LoaiKiemTra).Ten; } }
public void UpdateDiemMonHoc(DiemMonHoc diemMonHoc) { db = new GDUDataConnectionsDataContext(); DiemMonHoc dmh = new DiemMonHoc(); dmh = db.DiemMonHocs.Single(p => p.MaMonHoc == diemMonHoc.MaMonHoc && p.MaSV == diemMonHoc.MaSV); dmh.Diem30 = diemMonHoc.Diem30; dmh.Diem70L1 = diemMonHoc.Diem70L1; dmh.Diem70L2 = diemMonHoc.Diem70L2; dmh.DTB = diemMonHoc.DTB; dmh.Diem4 = diemMonHoc.Diem4; dmh.DiemChu = diemMonHoc.DiemChu; dmh.DiemSo = diemMonHoc.DiemSo; dmh.GhiChu = diemMonHoc.GhiChu; db.SubmitChanges(); }
private void btnSaveMonHoc_Click(object sender, EventArgs e) { if (checkDataMonHoc()) { MonHoc monHoc = new MonHoc(); monHoc.MaMonHoc = lblMaMonHocMH.Text.Trim(); monHoc.TenMonHoc = txtTenMon_MH.Text.Trim(); monHoc.STC = Convert.ToInt32(numericSoTinChi_MH.Value.ToString()); monHoc.MaNganh = cboChonNganh_MH.SelectedValue.ToString(); monHocService.CreateMonHoc(monHoc); LoadDanhSachMonHocToDatagridview(); MessageBox.Show("Đã Thêm [" + lblMaMonHocMH.Text + "]", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); btnSaveMonHoc.Enabled = false; btnDeleteMonHoc.Enabled = true; btnUpdateMonHoc.Enabled = true; //thêm sinh viên vào bảng điểm môn var listSV = sinhVienService.GetSinhVienByMaNganh(cboChonNganh_MH.SelectedValue.ToString().Trim()).ToList(); foreach (var x in listSV) { string maMon = lblMaMonHocMH.Text.Trim(); DiemMonHoc diemMonHoc = new DiemMonHoc(); diemMonHoc.MaSV = x.MaSV; diemMonHoc.MaMonHoc = maMon; diemMonHoc.Diem30 = null; diemMonHoc.Diem70L1 = null; diemMonHoc.Diem70L2 = null; diemMonHoc.DTB = null; diemMonHoc.Diem4 = null; diemMonHoc.DiemSo = null; diemMonHoc.DiemChu = null; diemMonHoc.GhiChu = null; diemMonHocService.AddDiemMonHoc(diemMonHoc); } } else { MessageBox.Show("Lỗi, Thêm Thất Bại...", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public List <DiemMonHoc> GetDiem(int madiemmon) { try { var d = myExecuteReader("SELECT * FROM Diem WHERE MaDiemMon=" + madiemmon.ToString()); var list = new List <DiemMonHoc>(); while (d.Read()) { var diemmonhoc = new DiemMonHoc(); diemmonhoc.MaDiemMon = d.GetInt32(4); diemmonhoc.LoaiKiemTra = d.GetInt32(1); diemmonhoc.Diem = d.GetFloat(2); diemmonhoc.MaDiem = d.GetInt32(0); list.Add(diemmonhoc); } DisConnect(); return(list); } catch (Exception) { throw; } }
public void UpdateDiemMonHoc(DiemMonHoc diemMonHoc) { //code content }
public DiemMonHoc AddDiemMonHoc(DiemMonHoc diemMonHoc) { //code content return(null); }
//xét điểm public void XetDiem() { if (txtDiem70L2.Text.Trim() != "") { double D30 = Convert.ToDouble(txtDiem30.Text.Trim()); //double D70L1 = Convert.ToDouble(txtDiem70L1.Text.Trim()); double D70L2 = Convert.ToDouble(txtDiem70L2.Text.Trim()); double valueTB = (D30 * 30 / 100) + (D70L2 * 70 / 100); DTB = Math.Round(valueTB, 2); double thangDiem4 = DTB * 4 / 10; Diem4 = Convert.ToString(thangDiem4); } else { double D30 = Convert.ToDouble(txtDiem30.Text.Trim()); double D70L1 = Convert.ToDouble(txtDiem70L1.Text.Trim()); //double D70L2 = Convert.ToDouble(txtDiem70L2.Text.Trim()); double valueTB = (D30 * 30 / 100) + (D70L1 * 70 / 100); DTB = Math.Round(valueTB, 2); double thangDiem4 = DTB * 4 / 10; Diem4 = Convert.ToString(thangDiem4); } if (DTB >= 8.5) { DiemChu = "A"; DiemSo = "4.0"; } else if (DTB >= 8) { DiemChu = "B+"; DiemSo = "3.5"; } else if (DTB >= 7) { DiemChu = "B"; DiemSo = "3.0"; } else if (DTB >= 6.5) { DiemChu = "C+"; DiemSo = "2.5"; } else if (DTB >= 5.5) { DiemChu = "C"; DiemSo = "2.0"; } else if (DTB >= 5.0) { DiemChu = "D+"; DiemSo = "1.5"; } else if (DTB >= 4.0) { DiemChu = "D"; DiemSo = "1.0"; } else { DiemChu = "F"; DiemSo = "0"; } DiemMonHoc dmh = new DiemMonHoc(); dmh.MaSV = lblMaSV.Text.Trim(); dmh.MaMonHoc = cboChonMon_QLD.SelectedValue.ToString().Trim(); dmh.Diem30 = txtDiem30.Text.Trim(); dmh.Diem70L1 = txtDiem70L1.Text.Trim(); dmh.Diem70L2 = txtDiem70L2.Text.Trim(); dmh.DTB = Convert.ToString(DTB).Trim(); dmh.Diem4 = Diem4.Trim(); dmh.DiemChu = DiemChu.Trim(); dmh.DiemSo = DiemSo.Trim(); if (DTB >= 4) { dmh.GhiChu = "Pass"; } else { dmh.GhiChu = "Fail"; } if (string.IsNullOrEmpty(txtDiem70L2.Text.Trim())) { dmh.Diem70L2 = null; } diemMonHocService.UpdateDiemMonHoc(dmh); }
//cập nhật điểm môn học public void UpdateDiemMonHoc(DiemMonHoc diemMonHoc) { diemMonHocIDao.UpdateDiemMonHoc(diemMonHoc); }
//thêm mới một điểm môn học public DiemMonHoc AddDiemMonHoc(DiemMonHoc diemMonHoc) { return(diemMonHocIDao.AddDiemMonHoc(diemMonHoc)); }