public JsonResult GetData(int pageIndex, string sortQuery, int pageSize) { AssignUserInfo(); bool canReceiveRegistration = currentUser.ListThaoTac .Where(x => x.MA_THAOTAC == CONFIRM_CAR_REGISTRATION).FirstOrDefault() != null; qlDangKyXeBusiness = Get <QL_DANGKY_XEBusiness>(); DangKyXeSearchBO searchModel = (DangKyXeSearchBO)SessionManager.GetValue("SearchDangKyXeBenhVien"); if (searchModel == null) { searchModel = new DangKyXeSearchBO(); } if (canReceiveRegistration) { searchModel.TRANGTHAI = TRANGTHAI_DANGKY_XE_CONSTANT.MOITAO_ID; searchModel.USER_ID = currentUser.ID; searchModel.HAS_ROLE_CONFIRM = true; } searchModel.sortQuery = sortQuery; searchModel.CCTC_THANHPHAN_ID = currentUser.DeptParentID.GetValueOrDefault(); PageListResultBO <DangKyXeBO> data = qlDangKyXeBusiness.GetDataByPage(searchModel); return(Json(data)); }
public PageListResultBO <QL_PHONG_BO> GetDaTaByPage(int?depid, QLPHONGHOP_SEARCHBO searchModel, int pageSize = 20, int pageIndex = 1) { var query = from tblPhong in this.context.QL_PHONGHOP where tblPhong.DEPID == depid select new QL_PHONG_BO { ID = tblPhong.ID, TENPHONG = tblPhong.TENPHONG, MOTA = tblPhong.MOTA, MAPHONG = tblPhong.MAPHONG, DEPID = tblPhong.DEPID, SOCHONGOI = tblPhong.SOCHONGOI, }; if (searchModel != null) { if (!string.IsNullOrEmpty(searchModel.TenPhong)) { query = query.Where(a => a.TENPHONG.Contains(searchModel.TenPhong)); } if (!string.IsNullOrEmpty(searchModel.MaPhong)) { query = query.Where(a => a.MAPHONG.Contains(searchModel.MaPhong)); } //Lọc tìm kiếm if (!string.IsNullOrEmpty(searchModel.sortQuery)) { query = query.OrderBy(searchModel.sortQuery); } else { query = query.OrderByDescending(a => a.ID); } } else { query = query.OrderByDescending(a => a.ID); } //Gán nội dung trả về var resultmodel = new PageListResultBO <QL_PHONG_BO>(); if (pageSize == -1) { var dataPageList = query.ToList(); resultmodel.Count = dataPageList.Count; resultmodel.TotalPage = 1; resultmodel.ListItem = dataPageList; } else { var dataPageList = query.ToPagedList(pageIndex, pageSize); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); } return(resultmodel); }
public PageListResultBO <RecruitmentSkillDTO> GetDataByPage(RecruitmentSkillSearchDTO searchParams, int pageIndex = 1, int pageSize = 20) { var queryResult = (from skill in recruitmentSkillRepository.GetAllAsQueryable() select new RecruitmentSkillDTO() { Id = skill.Id, Title = skill.Title, Skills = skill.Skills }); if (searchParams != null) { if (!string.IsNullOrEmpty(searchParams.QueryTitle)) { searchParams.QueryTitle = searchParams.QueryTitle.Trim().ToLower(); queryResult = queryResult.Where(x => x.Title.Trim().ToLower().Contains(searchParams.QueryTitle)); } if (!string.IsNullOrEmpty(searchParams.sortQuery)) { queryResult = queryResult.OrderBy(searchParams.sortQuery); } else { queryResult = queryResult.OrderByDescending(x => x.Id); } } var result = new PageListResultBO <RecruitmentSkillDTO>(); if (pageSize == -1) { var pagedList = queryResult.ToList(); result.Count = pagedList.Count; result.TotalPage = 1; result.ListItem = pagedList; } else { var dataPageList = queryResult.ToPagedList(pageIndex, pageSize); result.Count = dataPageList.TotalItemCount; result.TotalPage = dataPageList.PageCount; result.ListItem = dataPageList.ToList(); } if (result.ListItem.Any()) { var groupSkillsDetail = recruitmentSkillDetailRepository.GetAll(); result.ListItem.ForEach(x => { x.NumberOfSkills = x.Skills.Split(',').Count(); var skillIds = x.Skills.ToListNumber <long>(); x.GroupSkillDetails = groupSkillsDetail.Where(y => skillIds.Contains(y.Id)) .Select(y => mapper.Map <RecruitmentSkillDetail, RecruitmentSkillDetailDTO>(y)).ToList(); }); } return(result); }
public PageListResultBO <RoleDTO> GetDataByPage(RoleSearchDTO searchParams, int pageIndex = 1, int pageSize = 20) { var queryResult = (from module in this._roleRepository.GetAllAsQueryable() select new RoleDTO() { Id = module.Id, Name = module.Name, Code = module.Code }); if (searchParams != null) { if (!string.IsNullOrEmpty(searchParams.QueryName)) { searchParams.QueryName = searchParams.QueryName.Trim().ToLower(); queryResult = queryResult.Where(x => x.Name.Trim().ToLower().Contains(searchParams.QueryName)); } if (!string.IsNullOrEmpty(searchParams.QueryCode)) { searchParams.QueryCode = searchParams.QueryCode.Trim().ToLower(); queryResult = queryResult.Where(x => x.Code.Trim().ToLower().Contains(searchParams.QueryCode)); } if (!string.IsNullOrEmpty(searchParams.sortQuery)) { queryResult = queryResult.OrderBy(searchParams.sortQuery); } else { queryResult = queryResult.OrderByDescending(x => x.Id); } } else { queryResult = queryResult.OrderByDescending(x => x.Id); } var result = new PageListResultBO <RoleDTO>(); if (pageSize == -1) { var pagedList = queryResult.ToList(); result.Count = pagedList.Count; result.TotalPage = 1; result.ListItem = pagedList; } else { var dataPageList = queryResult.ToPagedList(pageIndex, pageSize); result.Count = dataPageList.TotalItemCount; result.TotalPage = dataPageList.PageCount; result.ListItem = dataPageList.ToList(); } return(result); }
public PageListResultBO <DM_DulieuDanhmucDTO> GetDataByPage(long danhMucId, DM_DulieuDanhmucSearchDTO searchParams, int pageIndex = 1, int pageSize = 20) { var query = (from dulieuDanhmuc in this._dM_DulieuDanhmucRepository.GetAllAsQueryable() where dulieuDanhmuc.GroupId == danhMucId select new DM_DulieuDanhmucDTO() { Id = dulieuDanhmuc.Id, Code = dulieuDanhmuc.Code, Name = dulieuDanhmuc.Name, Note = dulieuDanhmuc.Note, Priority = dulieuDanhmuc.Priority }); if (searchParams != null) { if (!string.IsNullOrEmpty(searchParams.sortQuery)) { query = query.OrderBy(searchParams.sortQuery); } else { query = query.OrderByDescending(x => x.Id); } if (!String.IsNullOrEmpty(searchParams.QueryCode)) { query = query.Where(x => x.Code.Contains(searchParams.QueryCode)); } if (!String.IsNullOrEmpty(searchParams.QueryName)) { query = query.Where(x => x.Name.Contains(searchParams.QueryName)); } } else { query = query.OrderByDescending(x => x.Id); } var result = new PageListResultBO <DM_DulieuDanhmucDTO>(); if (pageSize == -1) { var pagedList = query.ToList(); result.Count = pagedList.Count; result.TotalPage = 1; result.ListItem = pagedList; } else { var dataPageList = query.ToPagedList(pageIndex, pageSize); result.Count = dataPageList.TotalItemCount; result.TotalPage = dataPageList.PageCount; result.ListItem = dataPageList.ToList(); } return(result); }
public PageListResultBO <AppUser> GetDaTaByPage(AppUserSearchDto searchModel, int pageIndex = 1, int pageSize = 20) { var query = _appUserRepository.GetAllAsQueryable(); if (searchModel != null) { if (!string.IsNullOrEmpty(searchModel.UserNameFilter)) { query = query.Where(x => x.UserName.Contains(searchModel.UserNameFilter)); } if (!string.IsNullOrEmpty(searchModel.FullNameFilter)) { query = query.Where(x => x.FullName.Contains(searchModel.FullNameFilter)); } if (!string.IsNullOrEmpty(searchModel.EmailFilter)) { query = query.Where(x => x.Email.Contains(searchModel.EmailFilter)); } if (!string.IsNullOrEmpty(searchModel.AddressFilter)) { query = query.Where(x => x.Address.Contains(searchModel.AddressFilter)); } if (!string.IsNullOrEmpty(searchModel.sortQuery)) { query = query.OrderBy(searchModel.sortQuery); } else { query = query.OrderByDescending(x => x.Id); } } else { query = query.OrderByDescending(x => x.Id); } var resultmodel = new PageListResultBO <AppUser>(); if (pageSize == -1) { var dataPageList = query.ToList(); resultmodel.Count = dataPageList.Count; resultmodel.TotalPage = 1; resultmodel.ListItem = dataPageList; } else { var dataPageList = query.ToPagedList(pageIndex, pageSize); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); } return(resultmodel); }
public PageListResultBO <DM_NHOMDANHMUC_BO> GetDaTaByPage(DM_NHOMDANHMUC_SEARCHBO searchModel, int pageIndex = 1, int pageSize = 20) { var query = from tbl in this.context.DM_NHOMDANHMUC select new DM_NHOMDANHMUC_BO { ID = tbl.ID, GROUP_CODE = tbl.GROUP_CODE, GROUP_NAME = tbl.GROUP_NAME, TYPE = tbl.TYPE, }; if (searchModel != null) { if (!string.IsNullOrEmpty(searchModel.QR_CODE)) { query = query.Where(x => x.GROUP_CODE.Contains(searchModel.QR_CODE)); } if (!string.IsNullOrEmpty(searchModel.QR_NAME)) { query = query.Where(x => x.GROUP_NAME.Contains(searchModel.QR_NAME)); } if (!string.IsNullOrEmpty(searchModel.sortQuery)) { query = query.OrderBy(searchModel.sortQuery); } else { query = query.OrderByDescending(x => x.ID); } } else { query = query.OrderByDescending(x => x.ID); } var resultmodel = new PageListResultBO <DM_NHOMDANHMUC_BO>(); if (pageSize == -1) { var dataPageList = query.ToList(); resultmodel.Count = dataPageList.Count; resultmodel.TotalPage = 1; resultmodel.ListItem = dataPageList; } else { var dataPageList = query.ToPagedList(pageIndex, pageSize); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); } return(resultmodel); }
public PageListResultBO <CommonConfigurationDTO> GetDataByPage(CommonConfigurationSearchDTO searchParams, int pageIndex = 1, int pageSize = 20) { var query = (from tbl in this._commonConfigurationRepository.GetAllAsQueryable() select new CommonConfigurationDTO() { Id = tbl.Id, ConfigCode = tbl.ConfigCode, ConfigName = tbl.ConfigName, ConfigData = tbl.ConfigData }); if (searchParams != null) { if (!String.IsNullOrEmpty(searchParams.QueryCode)) { query = query.Where(x => x.ConfigCode.Contains(searchParams.QueryCode)); } if (!String.IsNullOrEmpty(searchParams.QueryName)) { query = query.Where(x => x.ConfigName.Contains(searchParams.QueryName)); } if (!string.IsNullOrEmpty(searchParams.sortQuery)) { query = query.OrderBy(searchParams.sortQuery); } else { query = query.OrderByDescending(x => x.Id); } } else { query = query.OrderByDescending(x => x.Id); } var result = new PageListResultBO <CommonConfigurationDTO>(); if (pageSize == -1) { var pagedList = query.ToList(); result.Count = pagedList.Count; result.TotalPage = 1; result.ListItem = pagedList; } else { var dataPageList = query.ToPagedList(pageIndex, pageSize); result.Count = dataPageList.TotalItemCount; result.TotalPage = dataPageList.PageCount; result.ListItem = dataPageList.ToList(); } return(result); }
/// <summary> /// id là id nhóm danh mục /// </summary> /// <param name="id"></param> /// <param name="searchModel"></param> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public PageListResultBO <DM_DANHMUC_DATA_BO> GetDaTaByPage(int idDanhMuc, DM_DANHMUC_DATA_SEARCHBO searchModel, int pageIndex = 1, int pageSize = 20) { var query = from tbl in this.context.DM_DANHMUC_DATA join dept in this.context.CCTC_THANHPHAN on tbl.DEPTID equals dept.ID into g1 from group1 in g1.DefaultIfEmpty() where tbl.DM_NHOM_ID == idDanhMuc select new DM_DANHMUC_DATA_BO { ID = tbl.ID, DM_NHOM_ID = tbl.DM_NHOM_ID, TEXT = tbl.TEXT, CODE = tbl.CODE, GHICHU = tbl.GHICHU, DATA = tbl.DATA, TENCAP = group1.NAME }; if (searchModel != null) { if (!string.IsNullOrEmpty(searchModel.sortQuery)) { query = query.OrderBy(searchModel.sortQuery); } else { query = query.OrderByDescending(x => x.ID); } } else { query = query.OrderByDescending(x => x.ID); } var resultmodel = new PageListResultBO <DM_DANHMUC_DATA_BO>(); if (pageSize == -1) { var dataPageList = query.ToList(); resultmodel.Count = dataPageList.Count; resultmodel.TotalPage = 1; resultmodel.ListItem = dataPageList; } else { var dataPageList = query.ToPagedList(pageIndex, pageSize); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); } return(resultmodel); }
public PageListResultBO <WF_MODULE_BO> GetDaTaByPage(WF_MODULE_SEARCHBO searchModel, int pageIndex = 1, int pageSize = 20) { var query = from tbl in this.context.WF_MODULE //join tblLuong in this.context.WF_STREAM on tbl.WF_STREAM_ID equals tblLuong.ID into jLuong //from luongxuly in jLuong.DefaultIfEmpty() select new WF_MODULE_BO { ID = tbl.ID, MODULE_CODE = tbl.MODULE_CODE, MODULE_TITLE = tbl.MODULE_TITLE, WF_STREAM_ID = tbl.WF_STREAM_ID, create_at = tbl.create_at, create_by = tbl.create_by, edit_at = tbl.edit_at, edit_by = tbl.edit_by, //TenLuong = luongxuly != null ? luongxuly.WF_NAME : "Chưa thiết lập", }; if (searchModel != null) { if (!string.IsNullOrEmpty(searchModel.sortQuery)) { query = query.OrderBy(searchModel.sortQuery); } else { query = query.OrderByDescending(x => x.ID); } } else { query = query.OrderByDescending(x => x.ID); } var resultmodel = new PageListResultBO <WF_MODULE_BO>(); if (pageSize == -1) { var dataPageList = query.ToList(); resultmodel.Count = dataPageList.Count; resultmodel.TotalPage = 1; resultmodel.ListItem = dataPageList; } else { var dataPageList = query.ToPagedList(pageIndex, pageSize); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); } return(resultmodel); }
public PageListResultBO <LOAITAILIEU_THUOCTINH_BO> GetDaTaByPage(TAILIEU_THUOCTINH_SEARCH searchModel, int pageIndex = 1, int pageSize = 20) { var query = from thuoctinh in this.context.LOAITAILIEU_THUOCTINH join danhmuc in this.context.DM_DANHMUC_DATA on thuoctinh.DANHMUC_ID equals danhmuc.ID into group1 from g1 in group1.DefaultIfEmpty() select new LOAITAILIEU_THUOCTINH_BO { ID = thuoctinh.ID, DANHMUC_ID = thuoctinh.DANHMUC_ID, MOTA = thuoctinh.MOTA, TEN_DANHMUC = g1.TEXT, TEN_THUOCTINH = thuoctinh.TEN_THUOCTINH, TRANGTHAI = thuoctinh.TRANGTHAI }; if (searchModel != null) { if (!string.IsNullOrEmpty(searchModel.sortQuery)) { query = query.OrderBy(searchModel.sortQuery); } else { query = query.OrderByDescending(x => x.TEN_DANHMUC); } } else { query = query.OrderByDescending(x => x.TEN_DANHMUC); } var resultmodel = new PageListResultBO <LOAITAILIEU_THUOCTINH_BO>(); if (pageSize == -1) { var dataPageList = query.ToList(); resultmodel.Count = dataPageList.Count; resultmodel.TotalPage = 1; resultmodel.ListItem = dataPageList; } else { var dataPageList = query.ToPagedList(pageIndex, pageSize); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); } return(resultmodel); }
public PageListResultBO <VAITRO_THAOTAC_BO> GetDaTaByPage(VAITRO_THAOTAC_SEARCHBO searchModel, int pageIndex = 1, int pageSize = 20) { var query = from tbl in this.context.VAITRO_THAOTAC select new VAITRO_THAOTAC_BO { VAITRO_THAOTAC_ID = tbl.VAITRO_THAOTAC_ID, DM_THAOTAC_ID = tbl.DM_THAOTAC_ID, VAITRO_ID = tbl.VAITRO_ID, TRANGTHAI = tbl.TRANGTHAI, NGAYTAO = tbl.NGAYTAO, NGAYSUA = tbl.NGAYSUA, NGUOITAO = tbl.NGUOITAO, NGUOISUA = tbl.NGUOISUA, }; if (searchModel != null) { if (!string.IsNullOrEmpty(searchModel.sortQuery)) { query = query.OrderBy(searchModel.sortQuery); } else { query = query.OrderByDescending(x => x.VAITRO_THAOTAC_ID); } } else { query = query.OrderByDescending(x => x.VAITRO_THAOTAC_ID); } var resultmodel = new PageListResultBO <VAITRO_THAOTAC_BO>(); if (pageSize == -1) { var dataPageList = query.ToList(); resultmodel.Count = dataPageList.Count; resultmodel.TotalPage = 1; resultmodel.ListItem = dataPageList; } else { var dataPageList = query.ToPagedList(pageIndex, pageSize); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); } return(resultmodel); }
public JsonResult GetData(int pageIndex, string sortQuery, int pageSize) { AssignUserInfo(); qlLaiXeBusiness = Get <QL_LAIXEBusiness>(); LaiXeSearchBO searchModel = (LaiXeSearchBO)SessionManager.GetValue("SearchLaiXeBenhVien"); if (searchModel == null) { searchModel = new LaiXeSearchBO(); } searchModel.sortQuery = sortQuery; searchModel.CCTC_THANHPHAN_ID = currentUser.DeptParentID.GetValueOrDefault(); PageListResultBO <LaiXeBO> data = qlLaiXeBusiness.GetDataByPage(searchModel); return(Json(data)); }
public PageListResultBO <SYS_TINNHAN> GetDaTaByPage(long userId, bool?ISREAD, int pageSize = 20, int pageIndex = 1) { var query = from mes in this.context.SYS_TINNHAN where userId == mes.TO_USER_ID && (ISREAD.HasValue ? ISREAD.Value != mes.IS_READ : true) select mes; query = query.OrderByDescending(x => x.NGAYTAO); var resultmodel = new PageListResultBO <SYS_TINNHAN>(); var dataPageList = query.ToPagedList(pageIndex, pageSize); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); return(resultmodel); }
/// <summary> /// @author: duynn /// </summary> /// <returns></returns> public JsonResult SearchData(FormCollection collection) { AssignUserInfo(); RecipientBusiness = Get <QL_NGUOINHAN_VANBANBusiness>(); PageListResultBO <QL_NGUOINHAN_VANBAN_BO> result = new PageListResultBO <QL_NGUOINHAN_VANBAN_BO>(); QL_NGUOINHAN_VANBAN_SEARCH_BO searchModel = (QL_NGUOINHAN_VANBAN_SEARCH_BO)SessionManager.GetValue("QLNguoiNhanVanBanSearch"); if (searchModel == null) { searchModel = new QL_NGUOINHAN_VANBAN_SEARCH_BO(); } //searchModel.QueryDeptId = currentUser.DM_PHONGBAN_ID.GetValueOrDefault(); searchModel.QueryName = collection["TEN_NHOM"]; result = RecipientBusiness.GetDataByPage(searchModel, currentUser); return(Json(result)); }
public PageListResultBO <QuanLyMauTestDTO> GetDaTaByPage(QuanLyMauTestSearchDTO searchModel, int pageIndex = 1, int pageSize = 20) { var query = _quanLyMauTestRepository.GetAllAsQueryable(); if (searchModel != null) { if (!string.IsNullOrEmpty(searchModel.QueryName)) { query = query.Where(x => x.FileName.Contains(searchModel.QueryName)); } if (searchModel.QueryCategoryList.Count > 0) { query = query.Where(x => searchModel.QueryCategoryList.Contains(x.Category)); } if (!string.IsNullOrEmpty(searchModel.sortQuery)) { query = query.OrderBy(searchModel.sortQuery); } else { query = query.OrderByDescending(x => x.Id); } } else { query = query.OrderByDescending(x => x.Id); } var resultmodel = new PageListResultBO <TD_QuanLyMauTest>(); if (pageSize == -1) { var dataPageList = query.ToList(); resultmodel.Count = dataPageList.Count; resultmodel.TotalPage = 1; resultmodel.ListItem = dataPageList; } else { var dataPageList = query.ToPagedList(pageIndex, pageSize); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); } return(_imapper.Map <PageListResultBO <QuanLyMauTestDTO> >(resultmodel)); }
public PageListResultBO <NGUOIDUNG_VAITRO_BO> GetDaTaByPage(NGUOIDUNG_VAITRO_SEARCHBO searchModel, int pageIndex = 1, int pageSize = 20) { var query = from tbl in this.context.NGUOIDUNG_VAITRO select new NGUOIDUNG_VAITRO_BO { ID = tbl.ID, VAITRO_ID = tbl.VAITRO_ID, NGUOIDUNG_ID = tbl.NGUOIDUNG_ID, NGAYTAO = tbl.NGAYTAO, ROLE_DEFAULT = tbl.ROLE_DEFAULT, }; if (searchModel != null) { if (!string.IsNullOrEmpty(searchModel.sortQuery)) { query = query.OrderBy(searchModel.sortQuery); } else { query = query.OrderByDescending(x => x.ID); } } else { query = query.OrderByDescending(x => x.ID); } var resultmodel = new PageListResultBO <NGUOIDUNG_VAITRO_BO>(); if (pageSize == -1) { var dataPageList = query.ToList(); resultmodel.Count = dataPageList.Count; resultmodel.TotalPage = 1; resultmodel.ListItem = dataPageList; } else { var dataPageList = query.ToPagedList(pageIndex, pageSize); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); } return(resultmodel); }
/// <summary> /// @author: duynn /// </summary> /// <returns></returns> public JsonResult GetDataPerPage(int pageSize, int pageIndex, string sortQuery) { AssignUserInfo(); RecipientBusiness = Get <QL_NGUOINHAN_VANBANBusiness>(); PageListResultBO <QL_NGUOINHAN_VANBAN_BO> result = new PageListResultBO <QL_NGUOINHAN_VANBAN_BO>(); QL_NGUOINHAN_VANBAN_SEARCH_BO searchModel = (QL_NGUOINHAN_VANBAN_SEARCH_BO)SessionManager.GetValue("QLNguoiNhanVanBanSearch"); if (searchModel == null) { searchModel = new QL_NGUOINHAN_VANBAN_SEARCH_BO(); } //searchModel.QueryDeptId = currentUser.DM_PHONGBAN_ID.GetValueOrDefault(); searchModel.pageIndex = pageIndex; searchModel.pageSize = pageSize; searchModel.sortQuery = sortQuery; result = RecipientBusiness.GetDataByPage(searchModel, currentUser); return(Json(result)); }
public PageListResultBO <ACTION_AUDIT> GetLog(ActionAuditSearchVM searchmodel = null, int pageSize = 20, int pageIndex = 1) { var query = from audit in this.context.ACTION_AUDIT select audit; if (searchmodel != null) { if (!string.IsNullOrEmpty(searchmodel.TENDANGNHAP)) { query = query.Where(x => x.USER_NAME == searchmodel.TENDANGNHAP); } } query = query.OrderByDescending(x => x.ACTION_AUDIT_ID); var resultmodel = new PageListResultBO <ACTION_AUDIT>(); var dataPageList = query.ToPagedList(pageIndex, pageSize); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); return(resultmodel); }
public PageListResultBO <HOSOCANBOCUSTOMBO> GetDataByPage(HoSoCanBoSearch searchModel, int pageIndex = 1, int pageSize = 20) { var query = from hoso in this.context.HOSO_CANBO_THONGTINCHUNG join datadanhmuc in this.context.DM_DANHMUC_DATA on hoso.GIOITINH equals datadanhmuc.ID into group1 from gioitinh in group1.DefaultIfEmpty() join ndung in this.context.DM_NGUOIDUNG on hoso.USER_ID equals ndung.ID into group2 from nguoidung in group2.DefaultIfEmpty() join datadanhmuc in this.context.DM_DANHMUC_DATA on hoso.NGACHCONGCHUCVIENCHUC equals datadanhmuc.ID into group3 from ngachcc in group3.DefaultIfEmpty() join datadanhmuc in this.context.DM_DANHMUC_DATA on hoso.CHUCVUHIENTAI equals datadanhmuc.ID into group4 from chucvu in group4.DefaultIfEmpty() join cocau in this.context.CCTC_THANHPHAN on hoso.DONVI_ID equals cocau.ID into group5 from cocautochuc in group5.DefaultIfEmpty() select new HOSOCANBOCUSTOMBO { ID = hoso.ID, HOTEN = hoso.HOTEN, TENGOIKHAC = hoso.TENGOIKHAC, NGAYSINH = hoso.NGAYSINH, GIOITINH = hoso.GIOITINH, NOISINH_XA = hoso.NOISINH_XA, NOISINH_HUYEN = hoso.NOISINH_HUYEN, NOISINH_TINH = hoso.NOISINH_TINH, QUEQUAN_XA = hoso.QUEQUAN_XA, QUEQUAN_HUYEN = hoso.QUEQUAN_HUYEN, QUEQUAN_TINH = hoso.QUEQUAN_TINH, DANTOC = hoso.DANTOC, TONGIAO = hoso.TONGIAO, NOIDANGKYHOKHAUTHUONGTRU = hoso.NOIDANGKYHOKHAUTHUONGTRU, NOIOHIENNAY = hoso.NOIOHIENNAY, NGHENGHIEPKHIDUOCTUYENDUNG = hoso.NGHENGHIEPKHIDUOCTUYENDUNG, NGAYTRUNGTUYEN = hoso.NGAYTRUNGTUYEN, COQUANTUYENDUNG = hoso.COQUANTUYENDUNG, CHUCVUHIENTAI = hoso.CHUCVUHIENTAI, NGACHCONGCHUCVIENCHUC = hoso.NGACHCONGCHUCVIENCHUC, MANGACH = hoso.MANGACH, BACLUONG = hoso.BACLUONG, HESO = hoso.HESO, TRINHDOGIAODUC = hoso.TRINHDOGIAODUC, TRINHDOCHUYENMONCAONHAT = hoso.TRINHDOCHUYENMONCAONHAT, STRGIOITINH = gioitinh.TEXT, TENDANGNHAP = nguoidung.TENDANGNHAP, STRNGACH = ngachcc.TEXT, STRCHUCVU = chucvu.TEXT, STRDONVI = cocautochuc.NAME }; if (searchModel != null) { if (!string.IsNullOrEmpty(searchModel.HOTEN)) { query = query.Where(x => x.HOTEN.Contains(searchModel.HOTEN)); } if (!string.IsNullOrEmpty(searchModel.MANGACH_BAC)) { query = query.Where(x => x.MANGACH.Contains(searchModel.MANGACH_BAC)); } if (!string.IsNullOrEmpty(searchModel.STRCHUCVU)) { query = query.Where(x => x.STRCHUCVU.Contains(searchModel.STRCHUCVU)); } if (!string.IsNullOrEmpty(searchModel.TENDANGNHAP)) { query = query.Where(x => x.TENDANGNHAP.Contains(searchModel.TENDANGNHAP)); } if (!string.IsNullOrEmpty(searchModel.sortQuery)) { query = query.OrderBy(searchModel.sortQuery); } else { query = query.OrderByDescending(x => x.ID); } } else { query = query.OrderByDescending(x => x.ID); } var resultmodel = new PageListResultBO <HOSOCANBOCUSTOMBO>(); if (pageSize == -1) { var dataPageList = query.ToList(); resultmodel.Count = dataPageList.Count; resultmodel.TotalPage = 1; resultmodel.ListItem = dataPageList; } else { var dataPageList = query.ToPagedList(pageIndex, pageSize); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); } return(resultmodel); }
/// <summary> /// @author: duynn /// @description: lấy danh sách đăng ký xe /// </summary> /// <param name="searchModel"></param> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public PageListResultBO <DangKyXeBO> GetDataByPage(DangKyXeSearchBO searchModel, int pageIndex = 1, int pageSize = 20) { IQueryable <DangKyXeBO> queryResult = (from register in this.context.QL_DANGKY_XE.Where(x => x.IS_DELETE != true) join user in this.context.DM_NGUOIDUNG on register.NGUOITAO equals user.ID into group1 from g1 in group1.DefaultIfEmpty() select new DangKyXeBO() { ID = register.ID, SONGUOI = register.SONGUOI, MUCDICH = register.MUCDICH, NGAY_XUATPHAT = register.NGAY_XUATPHAT, GIO_XUATPHAT = register.GIO_XUATPHAT, PHUT_XUATPHAT = register.PHUT_XUATPHAT, NGAYSUA = register.NGAYSUA, TRANGTHAI = register.TRANGTHAI ?? 0, NGUOITAO = register.NGUOITAO, NGUOIDANGKY = g1.HOTEN, CCTC_THANHPHAN_ID = register.CCTC_THANHPHAN_ID }); if (searchModel != null) { if (!string.IsNullOrEmpty(searchModel.MUCDICH)) { searchModel.MUCDICH = searchModel.MUCDICH.Trim().ToLower(); queryResult = queryResult.Where(x => !string.IsNullOrEmpty(x.MUCDICH) && x.MUCDICH.Trim().ToLower().Contains(searchModel.MUCDICH)); } if (searchModel.queryThoiGianXuatPhatStart != null) { queryResult = queryResult.Where(x => x.NGAY_XUATPHAT >= searchModel.queryThoiGianXuatPhatStart); } if (searchModel.queryThoiGianXuatPhatEnd != null) { queryResult = queryResult.Where(x => x.NGAY_XUATPHAT <= searchModel.queryThoiGianXuatPhatEnd); } if (searchModel.querySoNguoiStart != null) { queryResult = queryResult.Where(x => x.SONGUOI >= searchModel.querySoNguoiStart); } if (searchModel.querySoNguoiEnd != null) { queryResult = queryResult.Where(x => x.SONGUOI <= searchModel.querySoNguoiEnd); } if (searchModel.CCTC_THANHPHAN_ID != null) { queryResult = queryResult.Where(x => x.CCTC_THANHPHAN_ID == searchModel.CCTC_THANHPHAN_ID.Value); } if (searchModel.HAS_ROLE_CONFIRM) { if (searchModel.TRANGTHAI != null && searchModel.USER_ID != null) { queryResult = queryResult.Where(x => x.TRANGTHAI != searchModel.TRANGTHAI || x.NGUOITAO == searchModel.USER_ID); } } if (!string.IsNullOrEmpty(searchModel.sortQuery)) { queryResult = queryResult.OrderBy(searchModel.sortQuery); } else { queryResult = queryResult.OrderByDescending(x => x.ID).ThenByDescending(x => x.NGAYSUA); } } PageListResultBO <DangKyXeBO> result = new PageListResultBO <DangKyXeBO>(); IPagedList <DangKyXeBO> pagedList = queryResult.ToPagedList(pageIndex, pageSize); result.Count = pagedList.TotalItemCount; result.TotalPage = pagedList.PageCount; result.ListItem = pagedList.ToList(); result.ListItem.ForEach(x => { if (x.NGAY_XUATPHAT != null) { x.THOIGIAN_XUATPHAT = string.Format("{0:dd/MM/yyyy}", x.NGAY_XUATPHAT); if (x.GIO_XUATPHAT != null) { x.THOIGIAN_XUATPHAT += " " + x.GIO_XUATPHAT.Value.ToString("D2") + "h"; if (x.PHUT_XUATPHAT != null) { x.THOIGIAN_XUATPHAT += x.PHUT_XUATPHAT.Value.ToString("D2"); } } } switch (x.TRANGTHAI.Value) { case TRANGTHAI_DANGKY_XE_CONSTANT.MOITAO_ID: x.TEN_TRANGTHAI = TRANGTHAI_DANGKY_XE_CONSTANT.MOITAO_TEXT; x.MAU_TRANGTHAI = TRANGTHAI_DANGKY_XE_CONSTANT.MOITAO_COLOR; break; case TRANGTHAI_DANGKY_XE_CONSTANT.DAGUI_ID: x.TEN_TRANGTHAI = TRANGTHAI_DANGKY_XE_CONSTANT.DAGUI_TEXT; x.MAU_TRANGTHAI = TRANGTHAI_DANGKY_XE_CONSTANT.DAGUI_COLOR; break; case TRANGTHAI_DANGKY_XE_CONSTANT.DA_HUY_ID: x.TEN_TRANGTHAI = TRANGTHAI_DANGKY_XE_CONSTANT.DA_HUY_TEXT; x.MAU_TRANGTHAI = TRANGTHAI_DANGKY_XE_CONSTANT.DA_HUY_COLOR; break; case TRANGTHAI_DANGKY_XE_CONSTANT.DANG_THUCHIEN_ID: x.TEN_TRANGTHAI = TRANGTHAI_DANGKY_XE_CONSTANT.DANG_THUCHIEN_TEXT; x.MAU_TRANGTHAI = TRANGTHAI_DANGKY_XE_CONSTANT.DANG_THUCHIEN_COLOR; break; case TRANGTHAI_DANGKY_XE_CONSTANT.DA_TIEPNHAN_ID: x.TEN_TRANGTHAI = TRANGTHAI_DANGKY_XE_CONSTANT.DA_TIEPNHAN_TEXT; x.MAU_TRANGTHAI = TRANGTHAI_DANGKY_XE_CONSTANT.DA_TIEPNHAN_COLOR; break; case TRANGTHAI_DANGKY_XE_CONSTANT.DA_HOANTHANH_ID: x.TEN_TRANGTHAI = TRANGTHAI_DANGKY_XE_CONSTANT.DA_HOANTHANH_TEXT; x.MAU_TRANGTHAI = TRANGTHAI_DANGKY_XE_CONSTANT.DA_HOANTHANH_COLOR; break; default: break; } }); return(result); }
public PageListResultBO <ModuleDTO> GetDataByPage(ModuleSearchDTO searchParams, int pageIndex = 1, int pageSize = 20) { var queryResult = (from module in this._moduleRepository.GetAllAsQueryable() join operation in this._operationRepository.GetAllAsQueryable() on module.Id equals operation.ModuleId into groupOperation select new ModuleDTO() { Id = module.Id, Code = module.Code, Name = module.Name, IsShow = module.IsShow, Order = module.Order, Icon = module.Icon, ClassCss = module.ClassCss, StyleCss = module.StyleCss, OperationQuantity = groupOperation.Count() }); if (searchParams != null) { if (!string.IsNullOrEmpty(searchParams.QueryCode)) { searchParams.QueryCode = searchParams.QueryCode.Trim().ToLower(); queryResult = queryResult.Where(x => x.Code.Trim().ToLower().Contains(searchParams.QueryCode)); } if (!string.IsNullOrEmpty(searchParams.QueryName)) { searchParams.QueryName = searchParams.QueryName.Trim().ToLower(); queryResult = queryResult.Where(x => x.Name.Trim().ToLower().Contains(searchParams.QueryName)); } if (searchParams.QueryIsShow != null) { queryResult = queryResult.Where(x => x.IsShow == searchParams.QueryIsShow.Value); } if (!string.IsNullOrEmpty(searchParams.QueryIcon)) { searchParams.QueryIcon = searchParams.QueryIcon.Trim().ToLower(); queryResult = queryResult.Where(x => x.Icon.Trim().ToLower().Contains(searchParams.QueryIcon)); } if (!string.IsNullOrEmpty(searchParams.QueryClassCss)) { searchParams.QueryClassCss = searchParams.QueryClassCss.Trim().ToLower(); queryResult = queryResult.Where(x => x.ClassCss.Trim().ToLower().Contains(searchParams.QueryClassCss)); } if (!string.IsNullOrEmpty(searchParams.QueryStyleCss)) { searchParams.QueryStyleCss = searchParams.QueryStyleCss.Trim().ToLower(); queryResult = queryResult.Where(x => x.StyleCss.Trim().ToLower().Contains(searchParams.QueryStyleCss)); } if (!string.IsNullOrEmpty(searchParams.sortQuery)) { queryResult = queryResult.OrderBy(searchParams.sortQuery); } else { queryResult = queryResult.OrderBy(x => x.Order) .ThenBy(x => x.Name); } } else { queryResult = queryResult.OrderBy(x => x.Order) .ThenBy(x => x.Name); } var result = new PageListResultBO <ModuleDTO>(); if (pageSize == -1) { var pagedList = queryResult.ToList(); result.Count = pagedList.Count; result.TotalPage = 1; result.ListItem = pagedList; } else { var dataPageList = queryResult.ToPagedList(pageIndex, pageSize); result.Count = dataPageList.TotalItemCount; result.TotalPage = dataPageList.PageCount; result.ListItem = dataPageList.ToList(); } return(result); }
public ActionResult ExportExcel(int type = VANBANDEN_CONSTANT.CHUA_XULY) { Dictionary <string, string> properties = new Dictionary <string, string>(); properties.Add("STT", "STT"); properties.Add("SOHIEU", "Số ký hiệu"); properties.Add("TRICHYEU", "Trích yếu"); properties.Add("SOBAN", "Số bản"); properties.Add("NGAY_VANBAN", "Ngày VB"); properties.Add("TEN_DONVI", "Tác giả"); properties.Add("NGAYTAO", "Ngày đăng ký"); properties.Add("CHUTRI", "Chủ trì + phối hợp"); properties.Add("SOTRANG", "Số trang"); properties.Add("LUU_HOSO", "Lưu hồ sơ"); properties.Add("GHICHU", "Ghi chú"); hscvVanBanDenBusiness = Get <HSCV_VANBANDENBusiness>(); string actionName = "ChuaXuLy"; string fileName = "BÁO CÁO THỐNG KÊ VĂN BẢN ĐẾN CHƯA XỬ LÝ"; List <HSCV_VANBANDEN_BO> dataExport = new List <HSCV_VANBANDEN_BO>(); string sessionName; switch (type) { case VANBANDEN_CONSTANT.CHUA_XULY: actionName = "ChuaXuLy"; sessionName = "VanBanDenChuaXuLySearchModel"; fileName = "Báo cáo thống kê văn bản đến chưa xử lý"; break; case VANBANDEN_CONSTANT.DA_XULY: actionName = "DaXuLy"; sessionName = "VanBanDenDaXuLySearchModel"; fileName = "Văn bản đến đã xử lý"; break; case VANBANDEN_CONSTANT.THAMGIA_XULY: actionName = "ThamGiaXuLy"; sessionName = "VanBanDenThamGiaXuLySearchModel"; fileName = "Văn bản đến tham gia xử lý"; break; case VANBANDEN_CONSTANT.NOIBO_CHUAXULY: actionName = "NoiBoChuaXuLy"; sessionName = "VanBanDenNoiBoChuaXuLySearchModel"; fileName = "Văn bản đến nội bộ chưa xử lý"; break; case VANBANDEN_CONSTANT.NOIBO_DAXULY: actionName = "NoiBoDaXuLy"; sessionName = "VanBanDenNoiBoDaXuLySearchModel"; fileName = "Văn bản đến nội bộ đã xử lý"; break; default: sessionName = string.Empty; break; } var searchModel = SessionManager.GetValue(sessionName) as HSCV_VANBANDEN_SEARCH; PageListResultBO <HSCV_VANBANDEN_BO> data = new PageListResultBO <HSCV_VANBANDEN_BO>(); switch (type) { case VANBANDEN_CONSTANT.CHUA_XULY: case VANBANDEN_CONSTANT.NOIBO_CHUAXULY: data = hscvVanBanDenBusiness.GetListInProcess(searchModel, defaultPageSize, -1); break; case VANBANDEN_CONSTANT.DA_XULY: case VANBANDEN_CONSTANT.NOIBO_DAXULY: data = hscvVanBanDenBusiness.GetListProcessed(searchModel, defaultPageSize, -1); break; case VANBANDEN_CONSTANT.THAMGIA_XULY: data = hscvVanBanDenBusiness.GetListJoinProcess(searchModel, defaultPageSize, -1); break; default: break; } EPPlusSupplier <HSCV_VANBANDEN_BO> supplier = new EPPlusSupplier <HSCV_VANBANDEN_BO>(); supplier.properties = properties; supplier.startColumn = 1; supplier.startRow = 5; supplier.fileName = fileName; var stream = supplier.CreateExcelFile(data.ListItem, FormatWorkSheet); var buffer = stream as MemoryStream; Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("Content-Disposition", string.Format("attachment; filename=\"{0}\"", fileName + ".xlsx")); Response.BinaryWrite(buffer.ToArray()); Response.Flush(); Response.End(); return(RedirectToAction(actionName)); }
public PageListResultBO <CongViecBO> GetDataByUserId(long userId, int pageSize, int pageIndex) { var query = from job in this.context.HSCV_CONGVIEC join domat in this.context.DM_DANHMUC_DATA on job.DOKHAN equals domat.ID into group1 from g1 in group1.DefaultIfEmpty() join douutien in this.context.DM_DANHMUC_DATA on job.DOUU_TIEN equals douutien.ID into group2 from g2 in group2.DefaultIfEmpty() join xlchinh in this.context.DM_NGUOIDUNG on job.NGUOIXULYCHINH_ID equals xlchinh.ID into group3 from g3 in group3.DefaultIfEmpty() join giaoviec in this.context.DM_NGUOIDUNG on job.NGUOIGIAOVIEC_ID equals giaoviec.ID into group4 from g4 in group4.DefaultIfEmpty() where userId == job.NGUOIXULYCHINH_ID && 100 != job.PHANTRAMHOANTHANH orderby job.NGAYTAO descending select new CongViecBO { CACBUOC_THUCHIEN = job.CACBUOC_THUCHIEN, DAGIAOVIEC = job.DAGIAOVIEC, CONGVIECGOC_ID = job.CONGVIECGOC_ID, DATUDANHGIA = job.DATUDANHGIA, DayDiff = 0, DOKHAN = job.DOKHAN, DOUU_TIEN = job.DOUU_TIEN, HAS_FILE = job.HAS_FILE, HAS_NHACVIECDENHAN = job.HAS_NHACVIECDENHAN, ICON_DOKHAN = g1.ICON, ICON_DOUUTIEN = "", XEPLOAICONGVIEC = job.XEPLOAICONGVIEC, ID = job.ID, IS_ASSIGNED = job.IS_ASSIGNED, IS_BATDAU = job.IS_BATDAU, IS_EMAIL = job.IS_EMAIL, IS_EXTEND_TASK = job.IS_EXTEND_TASK, IS_HASPLAN = job.IS_HASPLAN, IS_MESG = job.IS_MESG, IS_MYJOB = job.IS_MYJOB, IS_POPUP = job.IS_POPUP, IS_SMS = job.IS_SMS, IS_SUBTASK = job.IS_SUBTASK, ITEMTYPE = job.ITEMTYPE, ITEM_ID = job.ITEM_ID, MUCTIEU_CONGVIEC = job.MUCTIEU_CONGVIEC, NGAYBATDAU_KEHOACH = job.NGAYBATDAU_KEHOACH, NGAYBATDAU_THUCTE = job.NGAYBATDAU_THUCTE, NGAYDUYET = job.NGAYDUYET, NGAYHOANTHANH_THEOMONGMUON = job.NGAYHOANTHANH_THEOMONGMUON, NGAYKETTHUC_KEHOACH = job.NGAYKETTHUC_KEHOACH, NGAYKETTHUC_THUCTE = job.NGAYKETTHUC_THUCTE, NGAYSUA = job.NGAYSUA, NGAYTAO = job.NGAYTAO, NGAY_NHANVIEC = job.NGAY_NHANVIEC, NGUOIGIAOVIECDANHGIA = job.NGUOIGIAOVIECDANHGIA, NGUOIGIAOVIECDAPHANHOI = job.NGUOIGIAOVIECDAPHANHOI, NGUOIGIAOVIEC_ID = job.NGUOIGIAOVIEC_ID, NGUOIGIAOVIEC_PHANHOI = job.NGUOIGIAOVIEC_PHANHOI, NGUOITAO = job.NGUOITAO, NGUOIXULYCHINH_ID = job.NGUOIXULYCHINH_ID, NOIDUNGCONGVIEC = job.NOIDUNGCONGVIEC, PHANTRAMHOANTHANH = job.PHANTRAMHOANTHANH, PHANTRAMHOANTHANH_OLD = job.PHANTRAMHOANTHANH_OLD, SONGAYNHACTRUOCHAN = job.SONGAYNHACTRUOCHAN, SUBTASK_ID = job.SUBTASK_ID, TENCONGVIEC = job.TENCONGVIEC, TEN_DOKHAN = g1.TEXT, TEN_DOUUTIEN = g2.TEXT, TEN_NGUOIGIAOVIEC = g4.HOTEN, TEN_NGUOIXULYCHINH = g3.HOTEN, TRANGTHAI_ID = job.TRANGTHAI_ID, COLOR = g1.COLOR, }; var resultmodel = new PageListResultBO <CongViecBO>(); var dataPageList = query.ToPagedList(pageIndex, pageSize); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); return(resultmodel); }
public PageListResultBO <CongViecBO> GetDaTaByPage(HSCV_CONGVIEC_SEARCH searchModel, int pageSize = 20, int pageIndex = 1) { var query = from congviec in this.context.HSCV_CONGVIEC join dokhan in this.context.DM_DANHMUC_DATA on congviec.DOKHAN equals dokhan.ID into group1 from g1 in group1.DefaultIfEmpty() join douutien in this.context.DM_DANHMUC_DATA on congviec.DOUU_TIEN equals douutien.ID into group2 from g2 in group2.DefaultIfEmpty() join xlchinh in this.context.DM_NGUOIDUNG on congviec.NGUOIXULYCHINH_ID equals xlchinh.ID into group3 from g3 in group3.DefaultIfEmpty() join giaoviec in this.context.DM_NGUOIDUNG on congviec.NGUOIGIAOVIEC_ID equals giaoviec.ID into group4 from g4 in group4.DefaultIfEmpty() join subtask in this.context.HSCV_CONGVIEC on congviec.ID equals subtask.CONGVIECGOC_ID into group5 from g5 in group5.DefaultIfEmpty() select new CongViecBO { CONGVIECGOC_ID = congviec.CONGVIECGOC_ID, DATUDANHGIA = congviec.DATUDANHGIA, DayDiff = 0, DOKHAN = congviec.DOKHAN, DOUU_TIEN = congviec.DOUU_TIEN, HAS_FILE = congviec.HAS_FILE, HAS_NHACVIECDENHAN = congviec.HAS_NHACVIECDENHAN, ID = congviec.ID, IS_EMAIL = congviec.IS_EMAIL, IS_HASPLAN = congviec.IS_HASPLAN, IS_MESG = congviec.IS_MESG, IS_MYJOB = congviec.IS_MYJOB, IS_POPUP = congviec.IS_POPUP, IS_SMS = congviec.IS_SMS, IS_SUBTASK = congviec.IS_SUBTASK, ITEMTYPE = congviec.ITEMTYPE, ITEM_ID = congviec.ITEM_ID, NGAY_NHANVIEC = congviec.NGAY_NHANVIEC, NGAYHOANTHANH_THEOMONGMUON = congviec.NGAYHOANTHANH_THEOMONGMUON, NGAYSUA = congviec.NGAYSUA, NGAYTAO = congviec.NGAYTAO, NGUOIGIAOVIECDANHGIA = congviec.NGUOIGIAOVIECDANHGIA, NGUOIGIAOVIECDAPHANHOI = congviec.NGUOIGIAOVIECDAPHANHOI, NGUOIGIAOVIEC_ID = congviec.NGUOIGIAOVIEC_ID, NGUOITAO = congviec.NGUOITAO, NGUOIXULYCHINH_ID = congviec.NGUOIXULYCHINH_ID, NOIDUNGCONGVIEC = congviec.NOIDUNGCONGVIEC, PHANTRAMHOANTHANH = congviec.PHANTRAMHOANTHANH, PHANTRAMHOANTHANH_OLD = congviec.PHANTRAMHOANTHANH_OLD, SONGAYNHACTRUOCHAN = congviec.SONGAYNHACTRUOCHAN, SUBTASK_ID = congviec.SUBTASK_ID, TENCONGVIEC = congviec.TENCONGVIEC, TRANGTHAI_ID = congviec.TRANGTHAI_ID, TEN_DOKHAN = g1.TEXT, TEN_DOUUTIEN = g2.TEXT, ICON_DOKHAN = g1.ICON, ICON_DOUUTIEN = g2.ICON, TEN_NGUOIGIAOVIEC = g4.HOTEN, TEN_NGUOIXULYCHINH = g3.HOTEN, IS_BATDAU = (true == congviec.IS_BATDAU), HasChild = (g5 != null), SONGAYCONLAI = (true == congviec.IS_HASPLAN && congviec.NGAYKETTHUC_KEHOACH.HasValue) ? EntityFunctions.DiffDays(DateTime.Now, congviec.NGAYKETTHUC_KEHOACH) : EntityFunctions.DiffDays(DateTime.Now, congviec.NGAYHOANTHANH_THEOMONGMUON) }; if (searchModel != null) { #region Tim kiem switch (searchModel.LOAI_CONGVIEC) { //Đối với công việc cá nhân case LOAI_CONGVIEC.CANHAN: //query = query.Where(x => searchModel.USER_ID == x.NGUOITAO || searchModel.USER_ID == x.NGUOIGIAOVIEC_ID); query = query.Where(x => searchModel.USER_ID == x.NGUOIGIAOVIEC_ID); break; //Đối với công việc được giao case LOAI_CONGVIEC.DUOCGIAO: //query = query.Where(x => searchModel.USER_ID == x.NGUOIXULYCHINH_ID && true != x.IS_MYJOB); query = query.Where(x => searchModel.USER_ID == x.NGUOIXULYCHINH_ID); break; //Đối với công việc được phối hợp xử lý case LOAI_CONGVIEC.PHOIHOP_XULY: var Ids = (from phoihop in this.context.HSCV_CONGVIEC_NGUOITHAMGIAXULY where searchModel.USER_ID == phoihop.USER_ID select phoihop.CONGVIEC_ID).ToList(); query = query.Where(x => Ids.Contains(x.ID)); break; } if (searchModel.DOKHAN.HasValue) { query = query.Where(x => searchModel.DOKHAN.Value == x.DOKHAN); } if (searchModel.DO_UUTIEN.HasValue) { query = query.Where(x => searchModel.DO_UUTIEN.Value == x.DOUU_TIEN); } if (searchModel.IS_HASPLAN.HasValue) { query = query.Where(x => searchModel.IS_HASPLAN.Value == x.IS_HASPLAN); } if (searchModel.NGAYBATDAU_FROM.HasValue) { query = query.Where(x => searchModel.NGAYBATDAU_FROM.Value <= x.NGAY_NHANVIEC); } if (searchModel.NGAYBATDAU_TO.HasValue) { query = query.Where(x => searchModel.NGAYBATDAU_TO.Value >= x.NGAY_NHANVIEC); } if (searchModel.NGAYKETTHUC_FROM.HasValue) { query = query.Where(x => searchModel.NGAYKETTHUC_FROM.Value <= x.NGAYHOANTHANH_THEOMONGMUON); } if (searchModel.NGAYKETTHUC_TO.HasValue) { query = query.Where(x => searchModel.NGAYKETTHUC_TO.Value >= x.NGAYHOANTHANH_THEOMONGMUON); } if (searchModel.NOTIF_TYPE.HasValue) { } if (!string.IsNullOrEmpty(searchModel.TENCONGVIEC)) { query = query.Where(x => x.TENCONGVIEC.ToLower().Contains(searchModel.TENCONGVIEC.ToLower())); } #endregion query = query.GroupBy(x => x.ID).Select(y => y.FirstOrDefault()); if (!string.IsNullOrEmpty(searchModel.sortQuery)) { query = query.OrderBy(searchModel.sortQuery); } else { query = query.OrderByDescending(x => x.NGAYTAO); } } else { query = query.GroupBy(x => x.ID).Select(y => y.FirstOrDefault()); query = query.OrderByDescending(x => x.NGAYTAO); } var resultmodel = new PageListResultBO <CongViecBO>(); var dataPageList = query.ToPagedList(pageIndex, pageSize); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); return(resultmodel); }
public PageListResultBO <CongViecBO> GetListProcessedJob(HSCV_CONGVIEC_SEARCH searchModel, int pageSize = 20, int pageIndex = 1) { var query = from congviec in this.context.HSCV_CONGVIEC join dokhan in this.context.DM_DANHMUC_DATA on congviec.DOKHAN equals dokhan.ID into group1 from g1 in group1.DefaultIfEmpty() join douutien in this.context.DM_DANHMUC_DATA on congviec.DOUU_TIEN equals douutien.ID into group2 from g2 in group2.DefaultIfEmpty() join xlchinh in this.context.DM_NGUOIDUNG on congviec.NGUOIXULYCHINH_ID equals xlchinh.ID into group3 from g3 in group3.DefaultIfEmpty() join giaoviec in this.context.DM_NGUOIDUNG on congviec.NGUOIGIAOVIEC_ID equals giaoviec.ID into group4 from g4 in group4.DefaultIfEmpty() select new CongViecBO { CONGVIECGOC_ID = congviec.CONGVIECGOC_ID, DATUDANHGIA = congviec.DATUDANHGIA, DayDiff = 0, DOKHAN = congviec.DOKHAN, DOUU_TIEN = congviec.DOUU_TIEN, HAS_FILE = congviec.HAS_FILE, HAS_NHACVIECDENHAN = congviec.HAS_NHACVIECDENHAN, ID = congviec.ID, IS_EMAIL = congviec.IS_EMAIL, IS_HASPLAN = congviec.IS_HASPLAN, IS_MESG = congviec.IS_MESG, IS_MYJOB = congviec.IS_MYJOB, IS_POPUP = congviec.IS_POPUP, IS_SMS = congviec.IS_SMS, IS_SUBTASK = congviec.IS_SUBTASK, ITEMTYPE = congviec.ITEMTYPE, ITEM_ID = congviec.ITEM_ID, NGAY_NHANVIEC = congviec.NGAY_NHANVIEC, NGAYHOANTHANH_THEOMONGMUON = congviec.NGAYHOANTHANH_THEOMONGMUON, NGAYSUA = congviec.NGAYSUA, NGAYTAO = congviec.NGAYTAO, NGUOIGIAOVIECDANHGIA = congviec.NGUOIGIAOVIECDANHGIA, NGUOIGIAOVIECDAPHANHOI = congviec.NGUOIGIAOVIECDAPHANHOI, NGUOIGIAOVIEC_ID = congviec.NGUOIGIAOVIEC_ID, NGUOITAO = congviec.NGUOITAO, NGUOIXULYCHINH_ID = congviec.NGUOIXULYCHINH_ID, NOIDUNGCONGVIEC = congviec.NOIDUNGCONGVIEC, PHANTRAMHOANTHANH = congviec.PHANTRAMHOANTHANH, PHANTRAMHOANTHANH_OLD = congviec.PHANTRAMHOANTHANH_OLD, SONGAYNHACTRUOCHAN = congviec.SONGAYNHACTRUOCHAN, SUBTASK_ID = congviec.SUBTASK_ID, TENCONGVIEC = congviec.TENCONGVIEC, TRANGTHAI_ID = congviec.TRANGTHAI_ID, TEN_DOKHAN = g1.TEXT, TEN_DOUUTIEN = g2.TEXT, ICON_DOKHAN = g1.ICON, ICON_DOUUTIEN = g2.ICON, TEN_NGUOIGIAOVIEC = g4.HOTEN, TEN_NGUOIXULYCHINH = g3.HOTEN }; if (searchModel != null) { query = query.Where(x => searchModel.USER_ID == x.NGUOIGIAOVIEC_ID && x.TRANGTHAI_ID == 1); if (searchModel.DOKHAN.HasValue) { query = query.Where(x => searchModel.DOKHAN.Value == x.DOKHAN); } if (searchModel.DO_UUTIEN.HasValue) { query = query.Where(x => searchModel.DO_UUTIEN.Value == x.DOUU_TIEN); } if (searchModel.IS_HASPLAN.HasValue) { query = query.Where(x => searchModel.IS_HASPLAN.Value == x.IS_HASPLAN); } if (searchModel.NGAYBATDAU_FROM.HasValue) { query = query.Where(x => searchModel.NGAYBATDAU_FROM.Value >= x.NGAY_NHANVIEC); } if (searchModel.NGAYBATDAU_TO.HasValue) { query = query.Where(x => searchModel.NGAYBATDAU_TO.Value <= x.NGAY_NHANVIEC); } if (searchModel.NGAYKETTHUC_FROM.HasValue) { query = query.Where(x => searchModel.NGAYKETTHUC_FROM.Value >= x.NGAYHOANTHANH_THEOMONGMUON); } if (searchModel.NGAYKETTHUC_TO.HasValue) { query = query.Where(x => searchModel.NGAYKETTHUC_TO.Value <= x.NGAYHOANTHANH_THEOMONGMUON); } if (searchModel.NOTIF_TYPE.HasValue) { } if (!string.IsNullOrEmpty(searchModel.TENCONGVIEC)) { query = query.Where(x => x.TENCONGVIEC.ToLower().Contains(searchModel.TENCONGVIEC.ToLower())); } if (!string.IsNullOrEmpty(searchModel.sortQuery)) { query = query.OrderBy(searchModel.sortQuery); } else { query = query.OrderBy(x => x.TRANGTHAI_ID); } } else { query = query.OrderBy(x => x.TRANGTHAI_ID); } var resultmodel = new PageListResultBO <CongViecBO>(); var dataPageList = query.ToPagedList(pageIndex, pageSize); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); return(resultmodel); }
public PageListResultBO <THUMUC_LUUTRU_BO> GetDataByPage(THUMUC_LUUTRU_SEARCHBO searchModel, int page, int limit) { var result = from thumuc in this.context.THUMUC_LUUTRU join donvi in context.CCTC_THANHPHAN on thumuc.DONVI_ID equals donvi.ID into group1 from g1 in group1.DefaultIfEmpty() join C1 in context.DM_NGUOIDUNG on thumuc.USER_ID equals C1.ID into group2 from g2 in group2.DefaultIfEmpty() join A2 in context.THUMUC_LUUTRU on thumuc.PARENT_ID equals A2.ID into group3 from g3 in group3.DefaultIfEmpty() where //(searchModel.FOLDER_ID.HasValue ? (thumuc.PARENT_ID.HasValue && thumuc.PARENT_ID.Value == searchModel.FOLDER_ID) : //((thumuc.PARENT_ID.HasValue && thumuc.PARENT_ID.Value == 0) || (!thumuc.PARENT_ID.HasValue))) ((thumuc.IS_DELETE.HasValue && !thumuc.IS_DELETE.Value) || (!thumuc.IS_DELETE.HasValue)) select new THUMUC_LUUTRU_BO { ID = thumuc.ID, PARENT_ID = thumuc.PARENT_ID, TEN_NGUOITAO = g2.HOTEN, TENTHUMUC = thumuc.TENTHUMUC, USER_ID = thumuc.USER_ID, THUMUCCHA = g3.TENTHUMUC, NGAYTAO = thumuc.NGAYTAO, IS_DELETE = thumuc.IS_DELETE.Value, NAM = thumuc.NAM, DONVI_ID = thumuc.DONVI_ID, IS_THUMUC = true, TEN_DONVI = g1.NAME, CLASS = thumuc.CLASS, PRIOVITY = thumuc.PRIOVITY, ACCESS_MODIFIER = thumuc.ACCESS_MODIFIER, IS_FIXED = thumuc.IS_FIXED, NGAYXOA = thumuc.NGAYXOA, PERMISSION = thumuc.PERMISSION, SLTHUMUC = 0, THUMUC_AO = thumuc.THUMUC_AO }; if (searchModel != null) { if (searchModel.USER_ID > 0) { result = result.Where(x => x.USER_ID == searchModel.USER_ID); } if (searchModel.FOLDER_ID.HasValue && searchModel.FOLDER_ID.Value > 0) { result = result.Where(x => (x.PARENT_ID.HasValue && x.PARENT_ID.Value == searchModel.FOLDER_ID)); } else { result = result.Where(x => (x.PARENT_ID.HasValue && x.PARENT_ID.Value == 0) || (!x.PARENT_ID.HasValue)); result = result.OrderBy(x => x.PRIOVITY); } result = result.OrderBy(x => x.TENTHUMUC); if (!string.IsNullOrEmpty(searchModel.TEN_THUMUC)) { result = result.Where(x => x.TENTHUMUC.ToLower().Contains(searchModel.TEN_THUMUC.ToLower())); } if (searchModel.FOLDER_PERMISSION.HasValue) { result = result.Where(x => x.PERMISSION.HasValue && x.PERMISSION.Value == searchModel.FOLDER_PERMISSION); } if (searchModel.ACCESS_MODIFIER.HasValue) { result = result.Where(x => x.ACCESS_MODIFIER.HasValue && x.ACCESS_MODIFIER.Value == searchModel.ACCESS_MODIFIER); } } else { result = result.Where(x => (x.PARENT_ID.HasValue && x.PARENT_ID.Value == 0) || (!x.PARENT_ID.HasValue)); result = result.OrderBy(x => x.PRIOVITY); } var resultmodel = new PageListResultBO <THUMUC_LUUTRU_BO>(); if (limit == -1) { var dataPageList = result.ToList(); resultmodel.Count = dataPageList.Count; resultmodel.TotalPage = 1; resultmodel.ListItem = dataPageList; } else { var dataPageList = result.ToPagedList(page, limit); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); } return(resultmodel); }
public PageListResultBO <THUMUC_LUUTRU_BO> GetFileByPage(THUMUC_LUUTRU_SEARCHBO searchModel, int page, int limit, string TENDONVI, THUMUC_LUUTRU ThuMuc) { var result = from tailieu in this.context.TAILIEUDINHKEM //join donvi in context.CCTC_THANHPHAN // on tailieu.DONVI_ID equals donvi.ID into group1 //from g1 in group1.DefaultIfEmpty() join C1 in context.DM_NGUOIDUNG on tailieu.USER_ID equals C1.ID into group2 from g2 in group2.DefaultIfEmpty() where ((tailieu.IS_DELETE.HasValue && !tailieu.IS_DELETE.Value) || (!tailieu.IS_DELETE.HasValue)) select new THUMUC_LUUTRU_BO { TENTHUMUC = tailieu.TENTAILIEU, SLTHUMUC = 0, ID = (long)tailieu.TAILIEU_ID, NGAYTAO = tailieu.NGAYTAO, IS_THUMUC = false, THUMUCCHA = tailieu.DINHDANG_FILE, TEN_NGUOITAO = g2.HOTEN, TEN_DONVI = TENDONVI, DONVI_ID = tailieu.IS_PHEDUYET, USER_ID = tailieu.USER_ID, ACCESS_MODIFIER = ThuMuc.ACCESS_MODIFIER, PERMISSION = ThuMuc.PERMISSION, PARENT_ID = tailieu.FOLDER_ID }; if (searchModel != null) { if (searchModel.USER_ID > 0) { result = result.Where(x => x.USER_ID == searchModel.USER_ID); } if (searchModel.FOLDER_ID.HasValue && searchModel.FOLDER_ID.Value > 0) { result = result.Where(x => (x.PARENT_ID.HasValue && x.PARENT_ID.Value == searchModel.FOLDER_ID)); } else { result = result.Where(x => (x.PARENT_ID.HasValue && x.PARENT_ID.Value == 0) || (!x.PARENT_ID.HasValue)); } result = result.OrderBy(x => x.TENTHUMUC); if (!string.IsNullOrEmpty(searchModel.TEN_THUMUC)) { result = result.Where(x => x.TENTHUMUC.ToLower().Contains(searchModel.TEN_THUMUC.ToLower())); } if (searchModel.FOLDER_PERMISSION.HasValue) { result = result.Where(x => x.PERMISSION.HasValue && x.PERMISSION.Value == searchModel.FOLDER_PERMISSION); } if (searchModel.ACCESS_MODIFIER.HasValue) { result = result.Where(x => x.ACCESS_MODIFIER.HasValue && x.ACCESS_MODIFIER.Value == searchModel.ACCESS_MODIFIER); } } else { result = result.Where(x => (x.PARENT_ID.HasValue && x.PARENT_ID.Value == 0) || (!x.PARENT_ID.HasValue)); result = result.OrderBy(x => x.PRIOVITY); } var resultmodel = new PageListResultBO <THUMUC_LUUTRU_BO>(); if (limit == -1) { var dataPageList = result.ToList(); resultmodel.Count = dataPageList.Count; resultmodel.TotalPage = 1; resultmodel.ListItem = dataPageList; } else { var dataPageList = result.ToPagedList(page, limit); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); } return(resultmodel); }
/// <summary> /// @author: duynn /// @description: lấy danh sách xe /// </summary> /// <returns></returns> public PageListResultBO <XeBO> GetDataByPage(XeSearchBO searchModel, int pageIndex = 1, int pageSize = 20) { IQueryable <XeBO> queryResult = (from car in this.context.QL_XE.Where(x => x.IS_DELETE != true) join trip in this.context.QL_DANGKYXE_LAIXE on car.ID equals trip.XE_ID into group1 select new XeBO() { ID = car.ID, IMAGE_PATH = car.IMAGE_PATH, TENXE = car.TENXE, BIENSO = car.BIENSO, SOCHO = car.SOCHO, NGAYSUA = car.NGAYSUA, CCTC_THANHPHAN_ID = car.CCTC_THANHPHAN_ID, TRANGTHAI = group1.OrderByDescending(x => x.ID).Select(x => x.TRANGTHAI).FirstOrDefault() ?? TRANGTHAI_CHUYEN_CONSTANT.DA_HOANTHANH_ID, }); if (searchModel != null) { if (!string.IsNullOrEmpty(searchModel.TENXE)) { searchModel.TENXE = searchModel.TENXE.Trim().ToLower(); queryResult = queryResult.Where(x => !string.IsNullOrEmpty(x.TENXE) && x.TENXE.Trim().ToLower().Contains(searchModel.TENXE)); } if (!string.IsNullOrEmpty(searchModel.BIENSO)) { searchModel.BIENSO = searchModel.BIENSO.Trim().ToLower(); queryResult = queryResult.Where(x => !string.IsNullOrEmpty(x.BIENSO) && x.BIENSO.Trim().ToLower().Contains(searchModel.BIENSO)); } if (searchModel.querySoChoStart != null) { queryResult = queryResult.Where(x => x.SOCHO >= searchModel.querySoChoStart); } if (searchModel.querySoChoEnd != null) { queryResult = queryResult.Where(x => x.SOCHO <= searchModel.querySoChoEnd); } if (searchModel.CCTC_THANHPHAN_ID != null) { queryResult = queryResult.Where(x => x.CCTC_THANHPHAN_ID == searchModel.CCTC_THANHPHAN_ID.Value); } if (!string.IsNullOrEmpty(searchModel.sortQuery)) { queryResult = queryResult.OrderBy(searchModel.sortQuery); } else { queryResult = queryResult.OrderByDescending(x => x.ID).ThenByDescending(x => x.NGAYSUA); } } PageListResultBO <XeBO> result = new PageListResultBO <XeBO>(); IPagedList <XeBO> pagedList = queryResult.ToPagedList(pageIndex, pageSize); result.Count = pagedList.TotalItemCount; result.TotalPage = pagedList.PageCount; result.ListItem = pagedList.ToList(); return(result); }
public PageListResultBO <DM_CHUCNANG_BO> GetDaTaByPage(DM_CHUCNANG_SEARCHBO searchModel, int pageIndex = 1, int pageSize = 20) { var query = from tbl in this.context.DM_CHUCNANG select new DM_CHUCNANG_BO { DM_CHUCNANG_ID = tbl.DM_CHUCNANG_ID, MA_CHUCNANG = tbl.MA_CHUCNANG, TEN_CHUCNANG = tbl.TEN_CHUCNANG, TRANGTHAI = tbl.TRANGTHAI, NGAYTAO = tbl.NGAYTAO, NGAYSUA = tbl.NGAYSUA, URL = tbl.URL, TT_HIENTHI = tbl.TT_HIENTHI, NGUOITAO = tbl.NGUOITAO, NGUOISUA = tbl.NGUOISUA, IS_HIENTHI = tbl.IS_HIENTHI, ICONPATH = tbl.ICONPATH, CSSCLASS = tbl.CSSCLASS, }; if (searchModel != null) { if (!string.IsNullOrEmpty(searchModel.QR_MA)) { query = query.Where(x => x.MA_CHUCNANG.Contains(searchModel.QR_MA)); } if (!string.IsNullOrEmpty(searchModel.QR_CHUCNANG)) { query = query.Where(x => x.TEN_CHUCNANG.Contains(searchModel.QR_CHUCNANG)); } if (!string.IsNullOrEmpty(searchModel.sortQuery)) { query = query.OrderBy(searchModel.sortQuery); } else { query = query.OrderByDescending(x => x.DM_CHUCNANG_ID); } } else { query = query.OrderByDescending(x => x.DM_CHUCNANG_ID); } var resultmodel = new PageListResultBO <DM_CHUCNANG_BO>(); if (pageSize == -1) { var dataPageList = query.ToList(); resultmodel.Count = dataPageList.Count; resultmodel.TotalPage = 1; resultmodel.ListItem = dataPageList; } else { var dataPageList = query.ToPagedList(pageIndex, pageSize); resultmodel.Count = dataPageList.TotalItemCount; resultmodel.TotalPage = dataPageList.PageCount; resultmodel.ListItem = dataPageList.ToList(); } return(resultmodel); }