Example #1
0
        public IEnumerable <WebmasterInfoDTO> GetListWebmasterInfoHaveSearchAndPaging(string keyWord, int page, int pageSize)
        {
            db = new JobHuntEntities();

            List <WebmasterInfoDTO> listDTOs = new List <WebmasterInfoDTO>();
            List <WebmasterInfo>    listEFs  = db.WebmasterInfoes.ToList();

            if (!string.IsNullOrEmpty(keyWord))
            {
                listEFs = db.WebmasterInfoes.Where(x => x.WIFullName.Contains(keyWord) || x.WIUserName.Contains(keyWord) && x.WIStatus != (int)Common.Enum.StatusCandidate.Deleted).ToList();
            }

            foreach (var mb in listEFs)
            {
                if (mb.WIPosition == (int)BU.Common.Enum.WIPosition.Admin)
                {
                    continue;
                }
                else
                {
                    listDTOs.Add(convertData.ConvertToDTO(mb));
                }
            }

            db = null;
            return(listDTOs.ToPagedList(page, pageSize));
        }
Example #2
0
        //get list save jobs GetListSaveJobs
        public IEnumerable <RecruitJobDTO> GetListSaveJobs(string userID, int page, int pageSize)
        {
            db = new JobHuntEntities();

            List <RecruitJobDTO> listRecruitJobsDTO = new List <RecruitJobDTO>();
            List <RecruitJob>    ListRecruitJobs    = new List <RecruitJob>();
            List <SaveJob>       ListSaveJobs       = new List <SaveJob>();

            var GetInfoCandidateByIdUser = GetCandidateInfoByIdAspNetUser(userID);

            ListSaveJobs = db.SaveJobs.Where(x => x.SJ_CandidateId == GetInfoCandidateByIdUser.CandidateId).ToList();

            if (ListSaveJobs != null)
            {
                foreach (var sv in ListSaveJobs)
                {
                    ListRecruitJobs.Add(sv.RecruitJob);
                }
            }


            foreach (var mb in ListRecruitJobs)
            {
                listRecruitJobsDTO.Add(new ConvertDataRecruitJob().ConvertToDTO(mb));
            }
            db = null;
            return(listRecruitJobsDTO.ToPagedList(page, pageSize));
        }
Example #3
0
        //count job
        public int Statistical(int typeChoose)
        {
            db = new JobHuntEntities();
            var count = 0;

            //typeChoose = 1: count job posted
            //typeChoose = 2: count job approval
            //typeChoose = 3: count company
            //typeChoose = 5: count member

            switch (typeChoose)
            {
            case 1:
                count = db.RecruitJobs.Where(x => x.RJStatus != (int?)Common.Enum.EnumStatusJob.Inactive).Count();
                break;

            case 2:
                count = db.RecruitJobs.Where(x => x.RJStatus == (int?)Common.Enum.EnumStatusJob.Active).Count();
                break;

            case 3:
                count = db.Recruits.Where(x => x.RIStatus == (int?)Common.Enum.StatusRecruit.Active).Count();
                break;

            case 5:
                count = db.RecruitJobs.Where(x => x.RJPostDate == DateTime.Today).Count();
                break;

            default:
                count = db.Candidates.Where(x => x.CPStatus == (int?)Common.Enum.StatusCandidate.Active).Count();
                break;
            }
            db = null;
            return(count);
        }
Example #4
0
        public AspNetRoleDTO GetRoleById(string idrole)
        {
            db = new JobHuntEntities();
            var ef = db.AspNetRoles.FirstOrDefault(x => x.Id.Equals(idrole));

            db = null;
            return(new ConvertDataAspNetRole().ConvertToDTO(ef));
        }
Example #5
0
        //public List<string>
        public WebmasterInfoDTO GetInfoWebmasterByIdUser(string idUser)
        {
            db = new JobHuntEntities();
            var ef = db.WebmasterInfoes.FirstOrDefault(x => x.WI_AspNetUserId.Equals(idUser));

            db = null;
            return(convertData.ConvertToDTO(ef));
        }
Example #6
0
        public WebmasterInfoDTO GetInfoWebmasterById(int id)
        {
            db = new JobHuntEntities();
            var dto = convertData.ConvertToDTO(db.WebmasterInfoes.Find(id));

            db = null;
            return(dto);
        }
Example #7
0
        public IEnumerable <CandidateDTO> GetListCandidateHaveSearchAndPaging(string keyWord, int?idCity, int?idProfesstion, int?idProfesstionRecruit, int page, int pageSize)
        {
            db = new JobHuntEntities();

            List <CandidateDTO> listCandidateDTO = new List <CandidateDTO>();
            List <Candidate>    SearchList       = new List <Candidate>();

            var checkIdRecruit = false;

            if (SearchList.Count == 0)
            {
                SearchList = db.Candidates.ToList();
            }


            if (!string.IsNullOrEmpty(keyWord))
            {
                SearchList = SearchList.Where(x => x.CddUserName.Contains(keyWord) ||
                                              x.Profession.PFName.Contains(keyWord)).ToList();
                checkIdRecruit = true;
            }


            if (idProfesstion != null)
            {
                SearchList     = SearchList.Where(x => x.CP_ProfessionId == idProfesstion).ToList();
                checkIdRecruit = true;
            }

            if (idCity != null)
            {
                SearchList     = SearchList.Where(x => x.City.CityId == idCity).ToList();
                checkIdRecruit = true;
            }
            if (idProfesstionRecruit != null && checkIdRecruit == false)
            {
                var getList    = SearchList.Where(x => x.CP_ProfessionId == idProfesstionRecruit);
                var indexCount = getList.Count();
                var count      = 0;
                foreach (var item in getList.ToList())
                {
                    var get  = SearchList.FindIndex(x => x.CandidateId == item.CandidateId);
                    var temp = SearchList[get];
                    SearchList[get]   = SearchList[count];
                    SearchList[count] = item;
                    count++;
                }
            }

            SearchList = SearchList.Where(x => x.CPStatus != (int)Common.Enum.StatusCandidate.Deleted).ToList();
            foreach (var mb in SearchList)
            {
                listCandidateDTO.Add(convertData.ConvertToDTO(mb));
            }

            db = null;
            return(listCandidateDTO.ToPagedList(page, pageSize));
        }
        public CandidatePostResumeDTO GetDetail(int id)
        {
            var dto = new CandidatePostResumeDTO();

            using (db = new JobHuntEntities())
            {
                dto = convertData.ConvertToDTO(db.CandidatePostResumes.Find(id));
            }
            return(dto);
        }
Example #9
0
        public AdvertisementDTO GetAdvertisementByID(int id)
        {
            var dto = new AdvertisementDTO();

            using (var db = new JobHuntEntities())
            {
                dto = convertData.ConvertToDTO(db.Advertisements.Find(id));
                //listEFs = db.Advertisements.Where()
            }
            return(dto);
        }
Example #10
0
        public bool CheckExistAd(AdvertisementDTO addto)
        {
            var result = false;

            using (var db = new JobHuntEntities())
            {
                result = db.Advertisements.Any(a => a.AdEndDate >= addto.AdStartDate && a.AdPosition == addto.AdPosition && a.AdvertisementId != addto.AdvertisementId);
                //listEFs = db.Advertisements.Where()
            }
            return(result);
        }
Example #11
0
        //get list recruit job by id recruit paging
        public IEnumerable <RecruitJobDTO> GetListRecruitJobsUserIdPaging(int IdRecruit, int pageNumber, int pageSize)
        {
            db = new JobHuntEntities();
            var getEF   = db.RecruitJobs.OrderByDescending(x => x.RJPostDate).Where(x => x.RJ_RecruitId == IdRecruit && x.RJType != (int?)BU.Common.Enum.EnumStatusJob.Inactive).ToList();
            var listDTO = new List <RecruitJobDTO>();

            foreach (var cdd in getEF)
            {
                listDTO.Add(convertData.ConvertToDTO(cdd));
            }
            return(listDTO.ToPagedList(pageNumber, pageSize));
        }
Example #12
0
        //get list recruit job by time
        public IEnumerable <RecruitJobDTO> GetListRecruitJobsByTime()
        {
            db = new JobHuntEntities();
            var getEF   = db.RecruitJobs.OrderByDescending(x => x.RJPostDate).Where(x => x.RJType != (int?)BU.Common.Enum.EnumStatusJob.Inactive && x.RJExpirationDate >= DateTime.Now).ToList();
            var listDTO = new List <RecruitJobDTO>();

            foreach (var cdd in getEF)
            {
                listDTO.Add(convertData.ConvertToDTO(cdd));
            }
            return(listDTO);
        }
Example #13
0
        public List <AspNetRoleDTO> GetListRoles()
        {
            db = new JobHuntEntities();
            var listDTOs = new List <AspNetRoleDTO>();
            var listEFs  = db.AspNetRoles.ToList();

            foreach (var ef in listEFs)
            {
                listDTOs.Add(new ConvertDataAspNetRole().ConvertToDTO(ef));
            }
            db = null;
            return(listDTOs);
        }
Example #14
0
        //
        public List <RecruitDTO> GetListRecruits()
        {
            db = new JobHuntEntities();

            List <RecruitDTO> listRecruitsDTO = new List <RecruitDTO>();
            var getLists = db.Recruits.Where(x => x.RIStatus != (int)Common.Enum.StatusRecruit.Deleted).OrderByDescending(x => x.RIRegisterDate).ToList();

            foreach (var cdd in getLists)
            {
                listRecruitsDTO.Add(convertData.ConvertToDTO(cdd));
            }
            return(listRecruitsDTO);
        }
Example #15
0
        //get top find job
        public List <RecruitJobDTO> GetListFindJob()
        {
            db = new JobHuntEntities();
            List <RecruitJobDTO> listRecruitJobDTO = new List <RecruitJobDTO>();
            var getLists = db.RecruitJobs.Where(x => x.RJStatus != (int)Common.Enum.EnumStatusJob.Deleted).OrderByDescending(x => x.RJCount).ToList();

            foreach (var job in getLists)
            {
                listRecruitJobDTO.Add(convertData.ConvertToDTO(job));
            }

            return(listRecruitJobDTO);
        }
Example #16
0
        public List <RecruitDTO> GetAllRecruits()
        {
            db = new JobHuntEntities();
            List <RecruitDTO> listRecruitDTO = new List <RecruitDTO>();
            var getListRecruits = db.Recruits.Where(x => x.RIStatus != (int)Common.Enum.StatusRecruit.Deleted).ToList();

            foreach (var rc in getListRecruits)
            {
                listRecruitDTO.Add(convertData.ConvertToDTO(rc));
            }
            db = null;
            return(listRecruitDTO);
        }
Example #17
0
        public IEnumerable <WebmasterInfoDTO> GetListWebmasterInfos()
        {
            db = new JobHuntEntities();

            List <WebmasterInfoDTO> listDTOs = new List <WebmasterInfoDTO>();
            List <WebmasterInfo>    listEFs  = db.WebmasterInfoes.Where(x => x.WIStatus != (int)BU.Common.Enum.StatusAccount.Deleted).ToList();

            foreach (var mb in listEFs)
            {
                listDTOs.Add(convertData.ConvertToDTO(mb));
            }

            db = null;
            return(listDTOs);
        }
Example #18
0
        public List <RecruitJobDTO> GetListRecentJobs(int WorkTypeId, int SalaryId, int?DistrictId)
        {
            var listDTO = new List <RecruitJobDTO>();

            db = new JobHuntEntities();
            var getListEF = db.RecruitJobs.Where(x => x.RJ_WorkTypeId == WorkTypeId && x.RJ_SalaryId == SalaryId && x.RJDistrictId == DistrictId && x.RJStatus != (int)Common.Enum.EnumStatusJob.Inactive && x.RJExpirationDate >= DateTime.Now).OrderByDescending(x => x.RJPostDate).ToList();

            foreach (var rj in getListEF)
            {
                listDTO.Add(convertData.ConvertToDTO(rj));
            }

            db = null;
            return(listDTO);
        }
Example #19
0
        //Tên kết nối khi mọi người tạo.
        //JobHuntEntities db = null;

        public List <CareerDTO> GetAllCareers()
        {
            db = new JobHuntEntities();
            var getEF   = repo.SelectAll();
            var listDTO = new List <CareerDTO>();

            foreach (var ct in getEF)
            {
                var crdto = convertData.ConvertToDTO(ct);
                crdto.CountJob = db.RecruitJobs.Where(x => x.Profession.PFCareerId == ct.CareerId && x.RJExpirationDate >= DateTime.Now && x.RJStatus != (int?)Common.Enum.EnumStatusJob.Inactive).Count();
                listDTO.Add(crdto);
            }
            db = null;
            return(listDTO);
        }
Example #20
0
        public List <AdvertisementDTO> GetAll()
        {
            var listDTOs = new List <AdvertisementDTO>();
            var listEFs  = new List <Advertisement>();

            using (var db = new JobHuntEntities())
            {
                listEFs = db.Advertisements.Where(x => x.AdStatus != (int)BU.Common.Enum.StatusAdvertisement.Deleted).ToList();
                foreach (var ad in listEFs)
                {
                    listDTOs.Add(convertData.ConvertToDTO(ad));
                }
                //listEFs = db.Advertisements.Where()
            }
            return(listDTOs);
        }
Example #21
0
        public IEnumerable <RecruitJobDTO> GetListRecruitJobHaveSearchAndPaging(string keyWord, int?idCity, int?idProfesstion, int page, int pageSize)
        {
            db = new JobHuntEntities();

            List <RecruitJobDTO> listRecruitJobDTO = new List <RecruitJobDTO>();
            List <RecruitJob>    SearchList        = new List <RecruitJob>();


            if (SearchList.Count == 0)
            {
                SearchList = db.RecruitJobs.ToList();
            }

            if (!string.IsNullOrEmpty(keyWord))
            {
                SearchList = SearchList.Where(x => x.RJTitle.Contains(keyWord) ||
                                              x.Profession.PFName.Contains(keyWord)).ToList();
            }

            if (idProfesstion != null)
            {
                SearchList = SearchList.Where(x => x.RJ_ProfessionId == idProfesstion).ToList();
            }

            if (idCity != null)
            {
                SearchList = SearchList.Where(x => x.RJCityId == idCity).ToList();
            }

            SearchList = SearchList.Where(x => x.RJExpirationDate >= DateTime.Now && x.RJType != (int?)BU.Common.Enum.EnumStatusJob.Inactive).ToList();

            //find gần đúng profession ~ thuộc nghề
            //if(SearchList == null && idProfesstion != null)
            //{
            //    var findProfesstion = new ProfessionManage().GetDetailProfession((int)idProfesstion);
            //    SearchList = SearchList.Where(x => x.Profession.Career.CareerId == findProfesstion.CareerDTO.CareerId && x.RJExpirationDate >= DateTime.Now && x.RJType != (int?)BU.Common.Enum.EnumStatusJob.Inactive).ToList();
            //}


            foreach (var mb in SearchList)
            {
                listRecruitJobDTO.Add(convertData.ConvertToDTO(mb));
            }

            db = null;
            return(listRecruitJobDTO.ToPagedList(page, pageSize));
        }
Example #22
0
        public RecruitDTO GetRecruitInfoByIdAspNetUser(string idAspNetUser)
        {
            if (string.IsNullOrEmpty(idAspNetUser))
            {
                return(null);
            }
            db = new JobHuntEntities();
            var RecruitEF = db.Recruits.FirstOrDefault(x => x.RI_AspNetUserId.Equals(idAspNetUser));

            if (RecruitEF == null)
            {
                return(null);
            }
            var getRecruitInfo = convertData.ConvertToDTO(RecruitEF);

            return(getRecruitInfo);
        }
Example #23
0
        //get list job
        public List <CandidateDTO> GetListCandidates(int?status)
        {
            db = new JobHuntEntities();

            List <CandidateDTO> listCandidateDTO = new List <CandidateDTO>();
            var getLists = db.Candidates.Where(x => x.CPStatus != (int)Common.Enum.StatusCandidate.Deleted).OrderByDescending(x => x.CddRegisterDate).ToList();

            if (status != null)
            {
                getLists = getLists.Where(x => x.CPStatus == status).ToList();
            }
            foreach (var cdd in getLists)
            {
                listCandidateDTO.Add(convertData.ConvertToDTO(cdd));
            }
            return(listCandidateDTO);
        }
Example #24
0
        public CandidateDTO GetCandidateInfoByIdAspNetUser(string idAspNetUser)
        {
            if (string.IsNullOrEmpty(idAspNetUser))
            {
                return(null);
            }
            db = new JobHuntEntities();
            var candidateEF = db.Candidates.FirstOrDefault(x => x.Cdd_AspNetUserId.Equals(idAspNetUser));

            if (candidateEF == null)
            {
                return(null);
            }
            var getCandidateInfo = convertData.ConvertToDTO(candidateEF);

            return(getCandidateInfo);
        }
Example #25
0
        //get list recruit job by status
        public IEnumerable <RecruitJobDTO> GetListRecruitJobsByType(int?type)
        {
            db = new JobHuntEntities();
            var getEF = db.RecruitJobs.Where(x => x.RJType == type && x.RJExpirationDate >= DateTime.Now && x.RJStatus != (int?)Common.Enum.EnumStatusJob.Inactive).ToList();

            if (getEF.Count == 0)
            {
                getEF = db.RecruitJobs.Where(x => x.RJExpirationDate >= DateTime.Now && x.RJStatus != (int?)Common.Enum.EnumStatusJob.Inactive).ToList();
            }
            var listDTO = new List <RecruitJobDTO>();

            foreach (var cdd in getEF)
            {
                listDTO.Add(convertData.ConvertToDTO(cdd));
            }
            return(listDTO);
        }
Example #26
0
        //lấy danh sách quảng cáo trước 3 ngày hết hạn
        public List <AdvertisementDTO> GetListAdvertisementDashboard()
        {
            var datenow     = DateTime.Now;
            var dateexpired = datenow.AddDays(3);
            var listDTOs    = new List <AdvertisementDTO>();
            var listEFs     = new List <Advertisement>();

            using (var db = new JobHuntEntities())
            {
                listEFs = db.Advertisements.Where(x => x.AdStatus != (int)BU.Common.Enum.StatusAdvertisement.Deleted && x.AdEndDate <= dateexpired && x.AdEndDate >= datenow).ToList();
                foreach (var ad in listEFs)
                {
                    listDTOs.Add(convertData.ConvertToDTO(ad));
                }
                //listEFs = db.Advertisements.Where()
            }
            return(listDTOs);
        }
        //Get list post resume by id candidate
        public IEnumerable <CandidatePostResumeDTO> GetListCandidatePostResumeHaveSearchAndPaging(int?idCandidate, int page, int pageSize)
        {
            db = new JobHuntEntities();

            List <CandidatePostResumeDTO> listCandidatePostResumeDTO = new List <CandidatePostResumeDTO>();
            List <CandidatePostResume>    GetLists = new List <CandidatePostResume>();

            GetLists = db.CandidatePostResumes.Where(x => x.CPR_CandidateId == idCandidate && x.CPRStatus == true).ToList();

            foreach (var mb in GetLists)
            {
                listCandidatePostResumeDTO.Add(convertData.ConvertToDTO(mb));
            }

            db = null;

            return(listCandidatePostResumeDTO.ToPagedList(page, pageSize));
        }
Example #28
0
        public ActionResult Decentralization(string keyWord, int page = 1, int pageSize = 10)
        {
            var model = _webMasterManage.GetListWebmasterInfoHaveSearchAndPaging(keyWord, page, pageSize);

            ViewBag.keyWord = keyWord;
            ViewBag.stt     = (page - 1) * pageSize;

            var GetListRoles    = new JobHuntEntities().AspNetRoles.ToList();
            var listRolesDTO    = new List <AspNetRoleDTO>();
            var convertdatarole = new ConvertDataAspNetRole();

            foreach (var role in GetListRoles)
            {
                listRolesDTO.Add(convertdatarole.ConvertToDTO(role));
            }
            ViewBag.roles = listRolesDTO;
            return(View(model));
        }
        //check posted resume
        public bool CheckPostedResume(int?idCandidate, int?idJob)
        {
            db = new JobHuntEntities();
            var getListPostedResume = db.CandidatePostResumes.ToList();
            var check = false;

            foreach (var cddprs in getListPostedResume)
            {
                if (cddprs.CPR_CandidateId == idCandidate && cddprs.CPR_RecruitJobId == idJob)
                {
                    check = true;
                    break;
                }
            }

            db = null;
            return(check);
        }
Example #30
0
        public IEnumerable <RecruitDTO> GetListRecruitHaveSearchAndPaging(string keyWord, int?idCity, int?idProfesstion, string chooseDate, List <int?> chooseWorkType, List <int?> chooseSalary, List <int?> chooseExperience, List <int?> chooseGender, List <int?> chooseLevel, int page, int pageSize)
        {
            db = new JobHuntEntities();

            List <RecruitDTO> listRecruitDTO = new List <RecruitDTO>();
            List <Recruit>    SearchList     = new List <Recruit>();


            if (SearchList.Count == 0)
            {
                SearchList = db.Recruits.ToList();
            }

            if (!string.IsNullOrEmpty(keyWord))
            {
                SearchList = SearchList.Where(x => x.RIFullName.Contains(keyWord)).ToList();
            }

            if (!string.IsNullOrEmpty(chooseDate))
            {
                var currentTime = DateTime.Now;
                var getTimeHour = int.Parse(chooseDate.Remove(chooseDate.Length - 1));
                if (getTimeHour != 0)
                {
                    TimeSpan aInterval = new TimeSpan(0, getTimeHour, 0, 0);
                    var      getTime   = currentTime - aInterval;
                    SearchList = SearchList.Where(x => x.RIRegisterDate >= getTime).ToList();
                }
            }


            //if (idProfesstion != null)
            //    SearchList = SearchList.Where(x => x.CP_ProfessionId == idProfesstion).ToList();


            SearchList = SearchList.Where(x => x.RIStatus != (int)Common.Enum.StatusRecruit.Deleted).ToList();
            foreach (var mb in SearchList)
            {
                listRecruitDTO.Add(convertData.ConvertToDTO(mb));
            }

            db = null;
            return(listRecruitDTO.ToPagedList(page, pageSize));
        }