public static List <XepLichHoc_PlusDTO> Select(XepLichHocFilter _filter) { try { //List<LichHoc_PlusDTO> _result = null; var query = (from p in GlobalSettings.Database.XEPLICHHOCs select new XepLichHoc_PlusDTO { XepLichHocId = p.XepLichHocId, CoSoId = p.CoSoId, KhoaHocId = p.KhoaHocId, LopHocId = p.LopHocId, TenLopHoc = p.TenLopHoc, ThoiGianHoc = p.ThoiGianHoc, CaHocId = p.CaHocId, TenCaHocFull = p.TenCaHocFull, PhongHocId = p.PhongHocId, TenPhongHoc = p.TenPhongHoc, GiaoVien_ChinhId = p.GiaoVien_ChinhId, TenGiaoVien_Chinh = p.TenGiaoVien_Chinh, TienGiaoVien_Chinh = p.TienGiaoVien_Chinh, GiaoVien_TroGiangId = p.GiaoVien_TroGiangId, TenGiaoVien_TroGiang = p.TenGiaoVien_TroGiang, TienGiaoVien_TroGiang = p.TienGiaoVien_TroGiang, GhiChu = p.GhiChu, IsLock = p.IsLock, IsRemove = p.IsRemove, CreatedDate = p.CreatedDate, CreatedBy = p.CreatedBy, CreatedLog = p.CreatedLog, ModifiedDate = p.ModifiedDate, ModifiedBy = p.ModifiedBy, ModifiedLog = p.ModifiedLog, }).ToList(); if (_filter.CoSoId != null && _filter.CoSoId != 0) { query = query.Where(o => o.CoSoId == _filter.CoSoId).ToList(); } if (_filter.LopHocId != null && _filter.LopHocId != 0) { query = query.Where(o => o.LopHocId == _filter.LopHocId).ToList(); } if (_filter.IsRemove != null && _filter.IsRemove != 0) { query = query.Where(o => o.IsRemove == _filter.IsRemove).ToList(); } return(query.ToList()); } catch (System.Exception ex) { return(null); O2S_Common.Logging.LogSystem.Error(ex); } }
public static bool Delete(int _GiangVienId) { try { using (TransactionScope ts = new TransactionScope()) { //kiem tra neu giang vien: co GIANGDAY + XEPLICHHOC thi khong cho xoa List <GIANGDAY> _lstGiangDay = GiangDayLogic.SelectTheoGiangVien(_GiangVienId); if (_lstGiangDay != null && _lstGiangDay.Count > 0) { Database.GIANGDAYs.DeleteAllOnSubmit(_lstGiangDay); Database.SubmitChanges(); } XepLichHocFilter _filter_xlh = new XepLichHocFilter(); _filter_xlh.GiaoVien_ChinhId = _GiangVienId; _filter_xlh.GiaoVien_TroGiangId = _GiangVienId; List <XEPLICHHOC> _lstXepLichHoc = XepLichHocLogic.SelectTheoGiangVien(_filter_xlh); if (_lstXepLichHoc != null && _lstXepLichHoc.Count > 0) { Database.XEPLICHHOCs.DeleteAllOnSubmit(_lstXepLichHoc); Database.SubmitChanges(); } //xoa GIANGVIEN var temp = SelectSigleTheoKhoaKhoa(_GiangVienId); Database.GIANGVIENs.DeleteOnSubmit(temp); Database.SubmitChanges(); //Xoa PHANQUYENTAIKHOAN List <PHANQUYENTAIKHOAN> _lstpqtk = PhanQuyenTaiKhoanLogic.SelectTheoTaiKhoan(temp.TaiKhoanId ?? 0); if (_lstpqtk != null && _lstpqtk.Count > 0) { Database.PHANQUYENTAIKHOANs.DeleteAllOnSubmit(_lstpqtk); Database.SubmitChanges(); } TAIKHOAN _taikhoan = TaiKhoanLogic.SelectSingle(temp.TaiKhoanId ?? 0); if (_taikhoan != null) { Database.TAIKHOANs.DeleteOnSubmit(_taikhoan); Database.SubmitChanges(); } Database.SubmitChanges(); ts.Complete(); return(true); } } catch (Exception ex) { return(false); O2S_Common.Logging.LogSystem.Error(ex); } }
public static List <XEPLICHHOC> SelectTheoGiangVien(XepLichHocFilter _filter) { try { return((from p in GlobalSettings.Database.XEPLICHHOCs where p.GiaoVien_ChinhId == _filter.GiaoVien_ChinhId || p.GiaoVien_TroGiangId == _filter.GiaoVien_TroGiangId select p).ToList()); } catch (System.Exception ex) { return(null); O2S_Common.Logging.LogSystem.Error(ex); } }
public static List <XepLichHoc_PlusDTO> SelectGroupTheoNgayHoc(XepLichHocFilter _filter) { try { var query = (from obj in GlobalSettings.Database.XEPLICHHOCs where (obj.LopHocId == _filter.LopHocId && obj.IsLock == true) select new XepLichHoc_PlusDTO { ThoiGianHoc = obj.ThoiGianHoc, ThoiGianHoc_Full = obj.ThoiGianHoc_Full, //ThoiGianHoc_Long = obj.ThoiGianHoc.ToString("yyyy-MM-dd"), }).ToList().GroupBy(o => o.ThoiGianHoc).Select(n => n.First()).ToList(); return(query); } catch (System.Exception ex) { return(null); O2S_Common.Logging.LogSystem.Error(ex); } }
private void btnTimKiem_Click(object sender, EventArgs e) { SplashScreenManager.ShowForm(typeof(O2S_Common.Utilities.ThongBao.WaitForm_Wait)); try { DataGridView_ResetLaiCot(); int _KhoaHocId = O2S_Common.TypeConvert.Parse.ToInt32(cboKhoaHoc.SelectedValue.ToString()); int _LopHocId = O2S_Common.TypeConvert.Parse.ToInt32(cboLopHoc.SelectedValue.ToString()); if (_KhoaHocId != 0 && _LopHocId != 0) { XepLichHocFilter _filter = new XepLichHocFilter(); _filter.LopHocId = _LopHocId; List <XepLichHoc_PlusDTO> _lstNgayHoc = XepLichHocLogic.SelectGroupTheoNgayHoc(_filter); if (_lstNgayHoc != null && _lstNgayHoc.Count > 0) { foreach (var item in _lstNgayHoc) { item.ThoiGianHoc_Long = item.ThoiGianHoc.ToString("yyyyMMdd"); } TaoCot_DataGridView(_lstNgayHoc); LayDuLieuLenGridView(_lstNgayHoc, _LopHocId, _KhoaHocId); } } else { O2S_Common.Utilities.ThongBao.frmThongBao frmthongbao = new O2S_Common.Utilities.ThongBao.frmThongBao(Base.ThongBaoLable.VUI_LONG_NHAP_DAY_DU_THONG_TIN); frmthongbao.Show(); } } catch (Exception ex) { O2S_Common.Logging.LogSystem.Error(ex); } SplashScreenManager.CloseForm(); }
// private void LoadLichHocCuaLopHoc(int _lophocId) { try { //Kiem tra xem co lich hoc chua //-Neu co hien thi len //--neu chua insert 1 dong new XepLichHocFilter _filter = new XepLichHocFilter(); _filter.LopHocId = _lophocId; this.lstLichHoc = XepLichHocLogic.Select(_filter); if (this.lstLichHoc != null && this.lstLichHoc.Count > 0) { for (int i = 0; i < this.lstLichHoc.Count; i++) { this.lstLichHoc[i].Stt = i + 1; } } else { XepLichHoc_PlusDTO _lichhoc = new XepLichHoc_PlusDTO() { Stt = 1, CoSoId = GlobalSettings.CoSoId, LopHocId = _lophocId, TenLopHoc = cboLopHoc.Text, }; this.lstLichHoc = new List <XepLichHoc_PlusDTO>(); this.lstLichHoc.Add(_lichhoc); } gridControlLichHoc.DataSource = this.lstLichHoc; } catch (Exception ex) { O2S_Common.Logging.LogSystem.Error(ex); } }