Beispiel #1
0
        private void LayDanhSachHocVien()
        {
            try
            {
                HocVienFilter _filter = new HocVienFilter();
                _filter.CoSoId           = GlobalSettings.CoSoId;
                _filter.LoaiHocVienId    = KeySetting.LOAIHOCVIEN_CHOLOP;
                _filter.NgayTiepNhan_Tu  = date_TuNgay.DateTime;
                _filter.NgayTiepNhan_Den = date_DenNgay.DateTime;

                this.lstHocVien = HocVienLogic.Select(_filter);

                if (this.lstHocVien != null && this.lstHocVien.Count > 0)
                {
                    for (int i = 0; i < this.lstHocVien.Count; i++)
                    {
                        this.lstHocVien[i].Stt = i + 1;
                    }
                    gridControlDSHocVien.DataSource = this.lstHocVien;
                }
                else
                {
                    gridControlDSHocVien.DataSource = null;
                }
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Warn(ex);
            }
        }
        private void LayDanhSachHocVien()
        {
            try
            {
                HocVienFilter _filter = new HocVienFilter();
                _filter.CoSoId           = GlobalSettings.CoSoId;
                _filter.LoaiHocVienId    = KeySetting.LOAIHOCVIEN_CHINHTHUC;
                _filter.NgayTiepNhan_Tu  = date_TuNgay.DateTime;
                _filter.NgayTiepNhan_Den = date_DenNgay.DateTime;

                this.lstHocVien = HocVienLogic.SelectQuanLyHocVien(_filter);

                if (this.lstHocVien != null && this.lstHocVien.Count > 0)
                {
                    for (int i = 0; i < this.lstHocVien.Count; i++)
                    {
                        this.lstHocVien[i].Stt = i + 1;
                    }
                    gridControlDSHocVien.DataSource = this.lstHocVien;
                }
                else
                {
                    gridControlDSHocVien.DataSource = null;
                }
                lblTongCong.Text = string.Format("Tổng cộng: {0} học viên", gridViewDSHocVien.RowCount);
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Warn(ex);
            }
        }
        private void LoadDanhSachHocVien()
        {
            try
            {
                gridControlDSHocVien.DataSource = null;
                //Thread th = new Thread(() =>
                //{
                HocVienFilter _filter = new HocVienFilter();
                _filter.CoSoId           = GlobalSettings.CoSoId;
                _filter.NgayTiepNhan_Tu  = date_TuNgay.DateTime;
                _filter.NgayTiepNhan_Den = date_DenNgay.DateTime;
                List <HocVien_PlusDTO> _lstHocVien = HocVienLogic.Select(_filter);
                if (_lstHocVien != null && _lstHocVien.Count > 0)
                {
                    //gridControlDSHocVien.Invoke((MethodInvoker)delegate
                    //{
                    gridControlDSHocVien.DataSource = _lstHocVien;
                    lblTongCong.Text = string.Format("Tổng cộng: {0} học viên ({1} học viên chính thức; {2} học viên tiềm năng; {3} học viên chờ lớp)", _lstHocVien.Count, _lstHocVien.Where(o => o.LoaiHocVienId == KeySetting.LOAIHOCVIEN_CHINHTHUC).ToList().Count, _lstHocVien.Where(o => o.LoaiHocVienId == KeySetting.LOAIHOCVIEN_TIEMNANG).ToList().Count, _lstHocVien.Where(o => o.LoaiHocVienId == KeySetting.LOAIHOCVIEN_CHOLOP).ToList().Count);
                    //});
                }
                else
                {
                    gridControlDSHocVien.DataSource = null;
                    lblTongCong.Text = string.Format("Tổng cộng: {0} học viên ({1} học viên chính thức; {2} học viên tiềm năng; {3} học viên chờ lớp)", 0, 0, 0);
                }
                //});

                //th.Start();
            }
            catch (Exception ex)
            {
                O2S_Common.Logging.LogSystem.Warn(ex);
            }
        }
 private void btnTimKiem_Click(object sender, EventArgs e)
 {
     SplashScreenManager.ShowForm(typeof(O2S_Common.Utilities.ThongBao.WaitForm_Wait));
     try
     {
         HocVienFilter _filter = new HocVienFilter();
         _filter.CoSoId           = GlobalSettings.CoSoId;
         _filter.NgayTiepNhan_Tu  = date_TuNgay.DateTime;
         _filter.NgayTiepNhan_Den = date_DenNgay.DateTime;
         this._lstHocVien         = HocVienLogic.Select(_filter);
         if (this._lstHocVien != null && this._lstHocVien.Count > 0)
         {
             gridControlDSHocVien.DataSource = this._lstHocVien;
         }
         else
         {
             gridControlDSHocVien.DataSource = null;
         }
     }
     catch (Exception ex)
     {
         O2S_Common.Logging.LogSystem.Error(ex);
     }
     SplashScreenManager.CloseForm();
 }
        private void LoadDanhSachHocVien()
        {
            thHocVien = new Thread(() =>
            {
                //thPhieuGhiDanh.Join();
                HocVienFilter _filter    = new HocVienFilter();
                _filter.CoSoId           = GlobalSettings.CoSoId;
                _filter.NgayTiepNhan_Tu  = date_TuNgay.DateTime;
                _filter.NgayTiepNhan_Den = date_DenNgay.DateTime;
                object source            = HocVienLogic.Select(_filter);

                gridControlDSHocVien.Invoke((MethodInvoker) delegate
                {
                    gridControlDSHocVien.DataSource = source;
                });
            });
            thHocVien.Start();
        }
        public static List <HocVien_PlusDTO> Select(HocVienFilter _filter)
        {
            try
            {
                //GlobalSettings.NewDatacontexDatabase();
                // List<HocVien_PlusDTO> _result = null;
                var query = (from p in GlobalSettings.Database.HOCVIENs
                             select p).AsEnumerable().Select((obj, index) => new HocVien_PlusDTO
                {
                    Stt             = index + 1,
                    HocVienId       = obj.HocVienId,
                    CoSoId          = obj.CoSoId,
                    TenCoSoTrungTam = obj.COSOTRUNGTAM.TenCoSo,
                    LoaiHocVienId   = obj.LoaiHocVienId,
                    MaLoaiHocVien   = obj.LOAIHOCVIEN.MaLoaiHocVien,
                    TenLoaiHocVien  = obj.LOAIHOCVIEN.TenLoaiHocVien,
                    MaHocVien       = obj.MaHocVien,
                    TenHocVien      = obj.TenHocVien,
                    GioiTinh        = obj.GioiTinh,
                    NgaySinh        = obj.NgaySinh,
                    DiaChi          = obj.DiaChi,
                    Sdt             = obj.Sdt,
                    Email           = obj.Email,
                    NgayTiepNhan    = obj.NgayTiepNhan,
                    SdtBo           = obj.SdtBo,
                    EmailBo         = obj.EmailBo,
                    SdtMe           = obj.SdtMe,
                    EmailMe         = obj.EmailMe,
                    TenNguoiTuVan   = obj.TenNguoiTuVan,
                    GhiChu          = obj.GhiChu,
                    IsRemove        = obj.IsRemove,
                    CreatedDate     = obj.CreatedDate,
                    CreatedBy       = obj.CreatedBy,
                    CreatedLog      = obj.CreatedLog,
                    ModifiedDate    = obj.ModifiedDate,
                    ModifiedBy      = obj.ModifiedBy,
                    ModifiedLog     = obj.ModifiedLog,

                    /*TaiKhoanId = obj.TaiKhoanId,
                     * TenDangNhap=obj.TAIKHOAN.TenDangNhap,*/
                });
                if (_filter.MaHocVien != null)
                {
                    query = query.Where(o => o.MaHocVien.Contains(_filter.MaHocVien)).ToList();
                }
                if (_filter.HocVienId != null && _filter.HocVienId != 0)
                {
                    query = query.Where(o => o.HocVienId == _filter.HocVienId).ToList();
                }
                if (_filter.CoSoId != null && _filter.CoSoId != 0)
                {
                    query = query.Where(o => o.CoSoId == _filter.CoSoId).ToList();
                }
                if (_filter.NgayTiepNhan_Tu != null && _filter.NgayTiepNhan_Den != null)
                {
                    query = query.Where(o => o.NgayTiepNhan >= _filter.NgayTiepNhan_Tu && o.NgayTiepNhan <= _filter.NgayTiepNhan_Den).ToList();
                }
                if (_filter.LoaiHocVienId != null && _filter.LoaiHocVienId != 0)
                {
                    query = query.Where(o => o.LoaiHocVienId == _filter.LoaiHocVienId).ToList();
                }
                if (_filter.GioiTinh != null && _filter.GioiTinh != "")
                {
                    query = query.Where(o => o.GioiTinh == _filter.GioiTinh).ToList();
                }
                return(query.ToList());
            }
            catch (System.Exception ex)
            {
                return(null);

                O2S_Common.Logging.LogSystem.Error(ex);
            }
        }
        public static List <QuanLyHocVienDTO> SelectQuanLyHocVien(HocVienFilter _filter)
        {
            try
            {
                // List<HocVien_PlusDTO> _result = null;
                var query = (from hv in GlobalSettings.Database.HOCVIENs
                             join pgd in Database.PHIEUGHIDANHs on hv.HocVienId equals pgd.HocVienId into phieu
                             from pgd1 in phieu.DefaultIfEmpty()
                             join bd in Database.BANGDIEMs on pgd1.PhieuGhiDanhId equals bd.PhieuGhiDanhId into bangdiem
                             from bd1 in bangdiem.DefaultIfEmpty()
                             where pgd1.IsRemove != 1
                             select new QuanLyHocVienDTO
                {
                    HocVienId = hv.HocVienId,
                    CoSoId = hv.CoSoId,
                    TenCoSoTrungTam = hv.COSOTRUNGTAM.TenCoSo,
                    LoaiHocVienId = hv.LoaiHocVienId,
                    MaLoaiHocVien = hv.LOAIHOCVIEN.MaLoaiHocVien,
                    TenLoaiHocVien = hv.LOAIHOCVIEN.TenLoaiHocVien,
                    MaHocVien = hv.MaHocVien,
                    TenHocVien = hv.TenHocVien,
                    GioiTinh = hv.GioiTinh,
                    NgaySinh = hv.NgaySinh,
                    DiaChi = hv.DiaChi,
                    Sdt = hv.Sdt,
                    Email = hv.Email,
                    NgayTiepNhan = hv.NgayTiepNhan,
                    SdtBo = hv.SdtBo,
                    EmailBo = hv.EmailBo,
                    SdtMe = hv.SdtMe,
                    EmailMe = hv.EmailMe,
                    IsRemove = hv.IsRemove,
                    CreatedDate = hv.CreatedDate,
                    CreatedBy = hv.CreatedBy,
                    CreatedLog = hv.CreatedLog,
                    ModifiedDate = hv.ModifiedDate,
                    ModifiedBy = hv.ModifiedBy,
                    ModifiedLog = hv.ModifiedLog,
                    TenDangNhap = hv.TAIKHOAN.TenDangNhap,
                    PhieuGhiDanhId = pgd1 == null ? 0 : pgd1.PhieuGhiDanhId,
                    MaPhieuGhiDanh = pgd1 == null ? "" : pgd1.MaPhieuGhiDanh,
                    NgayGhiDanh = pgd1 == null ? null : pgd1.NgayGhiDanh,
                    TongTien = pgd1 == null ? 0 : pgd1.TongTien,
                    DaDong = pgd1 == null ? 0 : pgd1.DaDong,
                    ConNo = pgd1 == null ? 0 : pgd1.ConNo,
                    MienGiam_PhanTram = pgd1 == null ? 0 : pgd1.MienGiam_PhanTram,
                    MienGiam_Tien = pgd1 == null ? 0 : pgd1.MienGiam_Tien,
                    KhoaHocId = pgd1 == null ? 0 : pgd1.KhoaHocId,
                    TenKhoaHoc = pgd1 == null ? "" : pgd1.KHOAHOC.TenKhoaHoc,
                    LopHocId = bd1 == null ? 0 : bd1.LopHocId,
                    TenLopHoc = bd1 == null ? "" : bd1.LOPHOC.TenLopHoc,
                    BangDiemId = bd1 == null ? 0 : bd1.BangDiemId,
                    DiemTrungBinh = bd1 == null ? 0 : bd1.DiemTrungBinh,
                    TenTrangThai = bd1 == null ? "" : (bd1.TrangThai == 0 ? "Xếp lớp" : bd1.TrangThai == 1 ? "Đang học" : bd1.TrangThai == 3 ? "Có điểm" : bd1.TrangThai == 99 ? "Kết thúc" : ""),
                }).ToList();
                //if (_filter.MaHocVien != null)
                //{
                //    query = query.Where(o => o.MaHocVien == _filter.MaHocVien).ToList();
                //}
                //if (_filter.HocVienId != null && _filter.HocVienId != 0)
                //{
                //    query = query.Where(o => o.HocVienId == _filter.HocVienId).ToList();
                //}
                if (_filter.CoSoId != null && _filter.CoSoId != 0)
                {
                    query = query.Where(o => o.CoSoId == _filter.CoSoId).ToList();
                }
                if (_filter.NgayTiepNhan_Tu != null && _filter.NgayTiepNhan_Den != null)
                {
                    query = query.Where(o => o.NgayTiepNhan >= _filter.NgayTiepNhan_Tu && o.NgayTiepNhan <= _filter.NgayTiepNhan_Den).ToList();
                }
                if (_filter.LoaiHocVienId != null && _filter.LoaiHocVienId != 0)
                {
                    query = query.Where(o => o.LoaiHocVienId == _filter.LoaiHocVienId).ToList();
                }
                //if (_filter.GioiTinh != null && _filter.GioiTinh != "")
                //{
                //    query = query.Where(o => o.GioiTinh == _filter.GioiTinh).ToList();
                //}
                return(query.ToList());
            }
            catch (System.Exception ex)
            {
                return(null);

                O2S_Common.Logging.LogSystem.Error(ex);
            }
        }