Example #1
0
        public List <InfoEnterprise> ShowFullInfo(Guid id)
        {
            var listEnterprise = new EnterpriseDao().ReturnList();
            var listArea       = new EnterpriseAreaDao().ListEnterpriseArea();
            var result         = (from enpr in listEnterprise
                                  join listA in listArea on enpr.EnterpriseID equals listA.EnterpriseId
                                  where enpr.EnterpriseID == id
                                  select new
            {
                EnterpriseID = enpr.EnterpriseID,
                EnterpriseName = enpr.EnterpriseName,
                ImageLogo = enpr.ImageLogo,
                AmountSize = db.EnterpriseSizes.Find(enpr.EnterpriseSize).AmountSize,
                NameOfEnterprise = db.TypeOfEnterprises.Find(enpr.TypeOfEnterprise).NameOfEnterprise,
                EstablishYear = enpr.EstablishYear,
                Description = enpr.Description,
                Email = enpr.Email,
                Mobile = enpr.Mobile,
            }).AsEnumerable().Select(x => new InfoEnterprise()
            {
                EnterpriseID     = x.EnterpriseID,
                EnterpriseName   = x.EnterpriseName,
                ImageLogo        = x.ImageLogo,
                AmountSize       = x.AmountSize,
                NameOfEnterprise = x.NameOfEnterprise,
                EstablishYear    = x.EstablishYear,
                Description      = x.Description,
                Email            = x.Email,
                Mobile           = x.Mobile,
            });
            var finalResult = result.ToList();
            int n           = finalResult.Count;

            if (n == 0 || n == 1)
            {
                return(finalResult);
            }

            var finalResult2 = new List <InfoEnterprise>();

            for (int i = 0; i < n; i++)
            {
                bool check = true;
                for (int j = 0; j < finalResult2.Count; j++)
                {
                    if (finalResult[i].EnterpriseID == finalResult2[j].EnterpriseID)
                    {
                        check = false;
                        break;
                    }
                }
                if (check == true)
                {
                    finalResult2.Add(finalResult[i]);
                }
            }
            return(finalResult2);
        }
        public List <ShowFullJob> ShowDetail(Guid OfferID)
        {
            var listOfferJob   = new OfferJobDao().ListOfferJob();
            var listEnterprise = new EnterpriseDao().ReturnList();
            var result         = (from job in listOfferJob
                                  join enpr in listEnterprise on job.EnterpriseID equals enpr.EnterpriseID
                                  where job.OfferID == OfferID
                                  select new
            {
                EnterpriseID = job.EnterpriseID,
                OfferName = job.OfferName,
                OfferDescription = job.OfferDescription,
                JobAddress = job.JobAddress,
                Amount = db.Salaries.Find(job.OfferSalary).Amount,
                Bonus = job.Bonus,
                AmountNum = job.Amount,
                Sex = job.Sex,
                NameArea = db.Areas.Find(job.Area).NameArea,
                OfferLimitDate = job.OfferLimitDate,
                Applications = job.Applications,
                Time = db.Experiences.Find(job.ExperienceRequest).Time,
                NameLevel = db.LevelLearnings.Find(job.LearningLevelRequest).NameLevel,
                NamePosition = db.PositionEmployees.Find(job.OfferPosition).NamePosition,
                EnterpriseName = enpr.EnterpriseName,
                AmountSize = db.EnterpriseSizes.Find(enpr.EnterpriseSize).AmountSize,
                ImageLogo = enpr.ImageLogo,
                NameOfEnterprise = db.TypeOfEnterprises.Find(enpr.TypeOfEnterprise).NameOfEnterprise,
                listJobId = db.EnterpriseJobs.Where(x => x.EnterpriseID == enpr.EnterpriseID && x.JobIdParent == null).Select(x => x.JobId).ToList(),
            }).AsEnumerable().Select(x => new ShowFullJob()
            {
                EnterpriseID     = x.EnterpriseID,
                OfferName        = x.OfferName,
                OfferDescription = x.OfferDescription,
                JobAddress       = x.JobAddress,
                Amount           = x.Amount,
                Bonus            = x.Bonus,
                AmountNum        = x.AmountNum,
                Sex              = x.Sex,
                NameArea         = x.NameArea,
                OfferLimitDate   = x.OfferLimitDate,
                Applications     = x.Applications,
                Time             = x.Time,
                NameLevel        = x.NameLevel,
                NamePosition     = x.NamePosition,
                EnterpriseName   = x.EnterpriseName,
                AmountSize       = x.AmountSize,
                ImageLogo        = x.ImageLogo,
                NameOfEnterprise = x.NameOfEnterprise,
                listJobId        = x.listJobId,
            });
            var finalResult = result.ToList();

            return(finalResult);
        }
        public List <OfferJob> ReturnFilterList(string offerName = "0", int Area              = 0,
                                                int OfferMajor   = 0, int offerSalary         = 0, int positionJobId        = 0,
                                                string sex       = "0", int experienceRequest = 0, int learningLevelRequest = 0)
        {
            try
            {
                var listOfferJob      = new OfferJobDao().ListOfferJob();
                var listOfferJobMajor = new OfferJobSkillDao().ReturnList();
                var listEnterprise    = new EnterpriseDao().ReturnList();
                var result            = (from job in listOfferJob
                                         join jobMajor in listOfferJobMajor on job.OfferID equals jobMajor.OfferID
                                         join enterprise in listEnterprise on job.EnterpriseID equals enterprise.EnterpriseID
                                         where (Area == 0 || job.Area == Area) &&
                                         (OfferMajor == 0 || job.OfferMajor == OfferMajor) &&
                                         (offerSalary == 0 || job.OfferSalary == offerSalary) &&
                                         (positionJobId == 0 || job.OfferPosition == positionJobId) &&
                                         (sex == "0" || job.Sex == sex) &&
                                         (experienceRequest == 0 || job.ExperienceRequest == experienceRequest) &&
                                         (learningLevelRequest == 0 || job.LearningLevelRequest == learningLevelRequest) &&
                                         (offerName == "0" || job.OfferName.Contains(offerName) || enterprise.EnterpriseName.Contains(offerName))


                                         select new
                {
                    OfferID = job.OfferID,
                    OfferName = job.OfferName,
                    EnterpriseID = job.EnterpriseID,
                    EnterpriseName = db.Enterprises.Find(job.EnterpriseID).EnterpriseName,
                    JobAddress = job.JobAddress,
                    OfferSalary = job.OfferSalary,
                    Amount = db.Salaries.Find(job.OfferSalary).Amount,
                    OfferLimitDate = job.OfferLimitDate,
                    Bonus = job.Bonus,
                    OfferImage = job.OfferImage,
                }).AsEnumerable().Select(x => new OfferJob()
                {
                    OfferID        = x.OfferID,
                    OfferName      = x.OfferName,
                    EnterpriseID   = x.EnterpriseID,
                    JobAddress     = x.JobAddress,
                    OfferSalary    = x.OfferSalary,
                    OfferLimitDate = x.OfferLimitDate,
                    Bonus          = x.Bonus,
                    OfferImage     = x.OfferImage
                });

                List <OfferJob> finalResult = result.ToList();
                int             n           = finalResult.Count;
                if (n == 0 || n == 1)
                {
                    return(finalResult);
                }

                List <OfferJob> finalResult2 = new List <OfferJob>();

                for (int i = 0; i < n; i++)
                {
                    bool check = true;
                    for (int j = 0; j < finalResult2.Count; j++)
                    {
                        if (finalResult[i].OfferID == finalResult2[j].OfferID)
                        {
                            check = false;
                            break;
                        }
                    }
                    if (check == true)
                    {
                        finalResult2.Add(finalResult[i]);
                    }
                }
                return(finalResult2);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
        public List <ShowFullEnterprise> ShowEnterprise(Guid EnterpriseID)
        {
            try
            {
                var listEnterprise = new EnterpriseDao().ReturnList();
                var listArea       = new EnterpriseAreaDao().ListEnterpriseArea();
                var result         = (from enpr in listEnterprise
                                      join listA in listArea on enpr.EnterpriseID equals listA.EnterpriseId
                                      where enpr.EnterpriseID == EnterpriseID
                                      select new
                {
                    EnterpriseID = enpr.EnterpriseID,
                    EnterpriseName = enpr.EnterpriseName,
                    ImageLogo = enpr.ImageLogo,
                    AmountSize = db.EnterpriseSizes.Find(enpr.EnterpriseSize).AmountSize,
                    NameOfEnterprise = db.TypeOfEnterprises.Find(enpr.TypeOfEnterprise).NameOfEnterprise,
                    EstablishYear = enpr.EstablishYear,
                    NameArea = db.Areas.Find(listA.AreaID).NameArea,
                    listJobId = db.EnterpriseJobs.Where(x => x.EnterpriseID == enpr.EnterpriseID && x.JobIdParent == null).Select(x => x.JobId).ToList(),
                    Description = enpr.Description,
                }).AsEnumerable().Select(x => new ShowFullEnterprise()
                {
                    EnterpriseID     = x.EnterpriseID,
                    EnterpriseName   = x.EnterpriseName,
                    ImageLogo        = x.ImageLogo,
                    AmountSize       = x.AmountSize,
                    NameArea         = x.NameArea,
                    NameOfEnterprise = x.NameOfEnterprise,
                    EstablishYear    = x.EstablishYear,
                    listJobId        = x.listJobId,
                    Description      = x.Description
                });
                var finalResult = result.ToList();
                int n           = finalResult.Count;
                if (n == 0 || n == 1)
                {
                    return(finalResult);
                }

                var finalResult2 = new List <ShowFullEnterprise>();

                for (int i = 0; i < n; i++)
                {
                    bool check = true;
                    for (int j = 0; j < finalResult2.Count; j++)
                    {
                        if (finalResult[i].EnterpriseID == finalResult2[j].EnterpriseID)
                        {
                            check = false;
                            break;
                        }
                    }
                    if (check == true)
                    {
                        finalResult2.Add(finalResult[i]);
                    }
                }
                return(finalResult2);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
        public List <FormEnterpriseFull> ReturnFilterList(string EName = "0", int EArea = 0, int ECareer = 0, int ESize = 0)
        {
            try
            {
                var listEnterprise = new EnterpriseDao().ReturnList();
                var listArea       = new EnterpriseAreaDao().ListEnterpriseArea();
                var listJob        = new EnterpriseJobDao().ListEnterpriseJob();
                var result         = (from listE in listEnterprise
                                      join listA in listArea on listE.EnterpriseID equals listA.EnterpriseId
                                      join listJ in listJob on listE.EnterpriseID equals listJ.EnterpriseID
                                      where (EArea == 0 || listA.AreaID == EArea) &&
                                      (ECareer == 0 || listJ.JobId == ECareer) &&
                                      (ESize == 0 || listE.EnterpriseSize == ESize) &&
                                      (EName == "0" || listE.EnterpriseName.Contains(EName)) &&
                                      listE.Status == true

                                      select new
                {
                    EnterpriseID = listE.EnterpriseID,
                    EnterpriseName = listE.EnterpriseName,
                    ImageLogo = listE.ImageLogo,
                    NameArea = db.Areas.Find(listA.AreaID).NameArea,
                    listJobId = db.EnterpriseJobs.Where(x => x.EnterpriseID == listE.EnterpriseID && x.JobIdParent == null).Select(x => x.JobId).ToList(),
                }).AsEnumerable().Select(x => new FormEnterpriseFull()
                {
                    EnterpriseID   = x.EnterpriseID,
                    EnterpriseName = x.EnterpriseName,
                    ImageLogo      = x.ImageLogo,
                    NameArea       = x.NameArea,
                    listJobId      = x.listJobId
                });

                var finalResult = result.ToList();
                int n           = finalResult.Count;
                if (n == 0 || n == 1)
                {
                    return(finalResult);
                }

                var finalResult2 = new List <FormEnterpriseFull>();

                for (int i = 0; i < n; i++)
                {
                    bool check = true;
                    for (int j = 0; j < finalResult2.Count; j++)
                    {
                        if (finalResult[i].EnterpriseID == finalResult2[j].EnterpriseID)
                        {
                            check = false;
                            break;
                        }
                    }
                    if (check == true)
                    {
                        finalResult2.Add(finalResult[i]);
                    }
                }
                return(finalResult2);
            }
            catch (Exception e)
            {
                return(null);
            }
        }