private void LoadDanhSachGiangVien() { try { GiangVienFilter _filter = new GiangVienFilter(); _filter.CoSoId = GlobalSettings.CoSoId; _filter.NgayBatDauLamViec_Tu = date_TuNgay.DateTime; _filter.NgayBatDauLamViec_Den = date_DenNgay.DateTime; List <GiangVien_PlusDTO> _lstGiangVien = GiangVienLogic.Select(_filter); if (_lstGiangVien != null && _lstGiangVien.Count > 0) { for (int i = 0; i < _lstGiangVien.Count; i++) { _lstGiangVien[i].Stt = i + 1; } gridControlDSGiangVien.DataSource = _lstGiangVien; lblTongCong.Text = string.Format("Tổng cộng: {0} giảng viên)", _lstGiangVien.Count); } else { gridControlDSGiangVien.DataSource = null; lblTongCong.Text = string.Format("Tổng cộng: {0} giảng viên)", 0); } } catch (Exception ex) { O2S_Common.Logging.LogSystem.Warn(ex); } }
public static List <GiangVien_PlusDTO> Select(GiangVienFilter _filter) { //GlobalSettings.NewDatacontexDatabase(); try { var query = (from obj in GlobalSettings.Database.GIANGVIENs select new GiangVien_PlusDTO { GiangVienId = obj.GiangVienId, MaGiangVien = obj.MaGiangVien, TenGiangVien = obj.TenGiangVien, CoSoId = obj.CoSoId, TenCoSoTrungTam = obj.COSOTRUNGTAM.TenCoSo, GioiTinh = obj.GioiTinh, Sdt = obj.Sdt, Email = obj.Email, NgayBatDauLamViec = obj.NgayBatDauLamViec, TaiKhoanId = obj.TaiKhoanId, TenDangNhap = obj.TAIKHOAN.TenDangNhap, NgaySinh = obj.NgaySinh, DiaChi = obj.DiaChi, GhiChu = obj.GhiChu, IsRemove = obj.IsRemove, CreatedDate = obj.CreatedDate, CreatedBy = obj.CreatedBy, CreatedLog = obj.CreatedLog, ModifiedDate = obj.ModifiedDate, ModifiedBy = obj.ModifiedBy, ModifiedLog = obj.ModifiedLog, }).ToList(); if (_filter.GiangVienId != null && _filter.GiangVienId != 0) { query = query.Where(o => o.GiangVienId == _filter.GiangVienId).ToList(); } if (_filter.CoSoId != null && _filter.CoSoId != 0) { query = query.Where(o => o.CoSoId == _filter.CoSoId).ToList(); } if (_filter.NgayBatDauLamViec_Tu != null && _filter.NgayBatDauLamViec_Den != null) { query = query.Where(o => o.NgayBatDauLamViec >= _filter.NgayBatDauLamViec_Tu && o.NgayBatDauLamViec <= _filter.NgayBatDauLamViec_Den).ToList(); } return(query.ToList()); } catch (System.Exception ex) { return(null); O2S_Common.Logging.LogSystem.Error(ex); } }
private void LoadGiangVien() { try { GiangVienFilter _filter = new GiangVienFilter(); _filter.CoSoId = GlobalSettings.CoSoId; //_filter.IsRemove = 0; cboGiangVien.DataSource = GiangVienLogic.Select(_filter); cboGiangVien.DisplayMember = "TenGiangVien"; cboGiangVien.ValueMember = "GiangVienId"; } catch (Exception ex) { O2S_Common.Logging.LogSystem.Warn(ex); } }
private void LoadGiangVien() { try { List <XepLich_GiaoVienChinhDTO> _dataGiaoVienChinh = new List <XepLich_GiaoVienChinhDTO>(); List <XepLich_GiaoVienTroGiangDTO> _dataGiaoVienTroGiang = new List <XepLich_GiaoVienTroGiangDTO>(); GiangVienFilter _filter = new GiangVienFilter(); _filter.CoSoId = GlobalSettings.CoSoId; List <GiangVien_PlusDTO> _dataGiangVien = GiangVienLogic.Select(_filter); if (_dataGiangVien != null && _dataGiangVien.Count > 0) { foreach (var item in _dataGiangVien) { XepLich_GiaoVienChinhDTO _gvChinh = new XepLich_GiaoVienChinhDTO() { GiaoVien_ChinhId = item.GiangVienId, TenGiaoVien_Chinh = item.TenGiangVien, }; _dataGiaoVienChinh.Add(_gvChinh); // XepLich_GiaoVienTroGiangDTO _gvTroGiang = new XepLich_GiaoVienTroGiangDTO() { GiaoVien_TroGiangId = item.GiangVienId, TenGiaoVien_TroGiang = item.TenGiangVien, }; _dataGiaoVienTroGiang.Add(_gvTroGiang); } } repositoryItemGrid_GVChinh.DataSource = _dataGiaoVienChinh; repositoryItemGrid_GVChinh.DisplayMember = "TenGiaoVien_Chinh"; repositoryItemGrid_GVChinh.ValueMember = "GiaoVien_ChinhId"; repositoryItemGrid_TroGiang.DataSource = _dataGiaoVienTroGiang; repositoryItemGrid_TroGiang.DisplayMember = "TenGiaoVien_TroGiang"; repositoryItemGrid_TroGiang.ValueMember = "GiaoVien_TroGiangId"; } catch (Exception ex) { O2S_Common.Logging.LogSystem.Warn(ex); } }