private void btnLuuLop_Click(object sender, EventArgs e) { try { //insert + Xoa tai BANGDIEM int _LopHocId = O2S_Common.TypeConvert.Parse.ToInt32(cboLopHoc.SelectedValue.ToString()); foreach (var item in this.dsXepLopHocVien) { //kiem tra ton tai hay khong List <BANGDIEM> _kiemtratontai = BangDiemLogic.SelectTheoPhieuGhiDanh(item.PhieuGhiDanhId ?? 0); if (_kiemtratontai == null || _kiemtratontai.Count == 0) { BANGDIEM _bangdiem = new BANGDIEM(); _bangdiem.HocVienId = item.HocVienId ?? 0; _bangdiem.LopHocId = _LopHocId; _bangdiem.PhieuGhiDanhId = item.PhieuGhiDanhId ?? 0; _bangdiem.KhoaHocId = item.KhoaHocId ?? 0; _bangdiem.TrangThai = 0;//=0: xep lop; =1: dang hoc; =3: co diem; =99:ket thuc BangDiemLogic.Insert(_bangdiem); } } List <BANGDIEM> _lstBangDiem_LopHoc = BangDiemLogic.SelectTheoLopHoc(_LopHocId); if (_lstBangDiem_LopHoc != null && _lstBangDiem_LopHoc.Count > 0) { List <BANGDIEM> _bangdiem_Xoa = (from p in _lstBangDiem_LopHoc where !(from q in this.dsXepLopHocVien select q.PhieuGhiDanhId).Contains(p.PhieuGhiDanhId) select p).ToList(); if (_bangdiem_Xoa != null && _bangdiem_Xoa.Count > 0) { BangDiemLogic.DeleteList(_bangdiem_Xoa); } } //Update SiSo cua LOPHOC LOPHOC _lophoc = LopHocLogic.SelectSingle(_LopHocId); LopHocLogic.Update(new LOPHOC() { LopHocId = _lophoc.LopHocId, TenLopHoc = _lophoc.TenLopHoc, NgayBatDau = _lophoc.NgayBatDau, NgayKetThuc = _lophoc.NgayKetThuc, SiSoToiDa = _lophoc.SiSoToiDa, SiSo = this.dsXepLopHocVien.Count, KhoaHocId = _lophoc.KhoaHocId, IsLock = _lophoc.IsLock }); O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CAP_NHAT_THANH_CONG); frmthongbao.Show(); } catch (Exception ex) { O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CAP_NHAT_THAT_BAI); frmthongbao.Show(); O2S_Common.Logging.LogSystem.Error(ex); } }
private void btnLuuThongTin_Click(object sender, EventArgs e) { try { if (isInsert) { int _khoaHocId = 0; if (LopHocLogic.Insert(LoadLopHoc(), ref _khoaHocId)) { O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.THEM_MOI_THANH_CONG); frmthongbao.Show(); } else { O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.THEM_MOI_THAT_BAI); frmthongbao.Show(); } } else { if (LopHocLogic.Update(LoadLopHoc())) { O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CAP_NHAT_THANH_CONG); frmthongbao.Show(); } else { O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.CAP_NHAT_THAT_BAI); frmthongbao.Show(); } } LoadGridLopHoc(); } catch (Exception ex) { O2S_Common.Logging.LogSystem.Error(ex); } }