Exemplo n.º 1
0
        public IHttpActionResult ListSeaBased(long id)
        {
            try
            {
                List<SeaBasedViewModel> model = repo.GetListSeaBasedInfo(id);

                SelectRepository selectRepo = new SelectRepository();

                List<JobSpecialization> lstSpecs = selectRepo.Specializations();
                List<VesselType> lstVessels = selectRepo.VesselTypes();
                List<TradeArea> lstTradeAreas = selectRepo.TradeAreas();
                List<EngineType> lstEngines = selectRepo.EngineTypes();
                List<Currency> lstCurrencies = selectRepo.Currencies();

                foreach (var e in model)
                {
                    e.lstSpecializations = new System.Web.Mvc.SelectList(lstSpecs, "id", "description", e.specialization);
                    e.lstCurrencies = new System.Web.Mvc.SelectList(lstCurrencies, "id", "description", e.salary_currency);
                    e.lstVesselTypes = new System.Web.Mvc.SelectList(lstVessels, "id", "description", e.vessel_type);
                    e.lstTradeAreas = new System.Web.Mvc.SelectList(lstTradeAreas, "id", "description", e.trade_area);
                    e.lstEngineTypes = new System.Web.Mvc.SelectList(lstEngines, "id", "description", e.engine_type);
                }

                var seaEmpty = new SeaBasedViewModel();
                seaEmpty.lstSpecializations = new System.Web.Mvc.SelectList(lstSpecs, "id", "description");
                seaEmpty.lstCurrencies = new System.Web.Mvc.SelectList(lstCurrencies, "id", "description");
                seaEmpty.lstVesselTypes = new System.Web.Mvc.SelectList(lstVessels, "id", "description");
                seaEmpty.lstVesselTypes = new System.Web.Mvc.SelectList(lstVessels, "id", "description");
                seaEmpty.lstTradeAreas = new System.Web.Mvc.SelectList(lstTradeAreas, "id", "description");
                seaEmpty.lstEngineTypes = new System.Web.Mvc.SelectList(lstEngines, "id", "description");

                seaEmpty.job_description.Add(new JobDescription());
                model.Add(seaEmpty);
                return Ok(model);
            }
            catch (Exception ex)
            {
                return BadRequest(ex.Message);
            }
        }
Exemplo n.º 2
0
        public IHttpActionResult UserSummary(string search, string sort, int? specialization, bool? complete)
        {
            try
            {
                UserRepository repo = new UserRepository();
                UserSummaryCollectionsViewModel model = new UserSummaryCollectionsViewModel();

                model.users = repo.GetListSummary(search, specialization, sort, complete);

                SelectRepository selectRepo = new SelectRepository();
                model.specialization = selectRepo.Specializations();

                return Ok(model);
            }
            catch (Exception ex)
            {
                return BadRequest(ex.Message);
            }
        }
        public IHttpActionResult SingleWithSpecialization(long id)
        {
            try
            {
                PromotionViewModel promo = repo.GetSingle(id);

                if (promo.id == 0)
                {
                    throw new Exception(Error.CONTENT_NOT_FOUND);
                }

                SelectRepository selectRepo = new SelectRepository();
                promo.specializations = selectRepo.Specializations(true);

                return Ok(promo);
            }
            catch (Exception ex)
            {
                return BadRequest(ex.Message);
            }
        }
Exemplo n.º 4
0
        public IHttpActionResult ListLandBased(long id)
        {
            try
            {
                List<LandBasedViewModel> model = repo.GetListLandBasedInfo(id);

                SelectRepository selectRepo = new SelectRepository();

                List<JobSpecialization> lstSpecs = selectRepo.Specializations();
                List<Country> lstCountries = selectRepo.Countries();
                List<Currency> lstCurrency = selectRepo.Currencies();

                foreach (var e in model)
                {
                    e.lstSpecializations = new System.Web.Mvc.SelectList(lstSpecs, "id", "description", e.specialization);
                    e.lstCountries = new System.Web.Mvc.SelectList(lstCountries, "id", "name", e.country);
                    e.lstCurrencies = new System.Web.Mvc.SelectList(lstCurrency, "id", "description", e.salary_currency);
                }

                var landEmpty = new LandBasedViewModel();
                landEmpty.lstSpecializations = new System.Web.Mvc.SelectList(lstSpecs, "id", "description");
                landEmpty.lstCountries = new System.Web.Mvc.SelectList(lstCountries, "id", "name");
                landEmpty.lstCurrencies = new System.Web.Mvc.SelectList(lstCurrency, "id", "description");
                landEmpty.job_description.Add(new JobDescription());

                model.Add(landEmpty);

                return Ok(model);
            }
            catch (Exception ex)
            {
                return BadRequest(ex.Message);
            }
        }
 public IHttpActionResult Specializations(bool all)
 {
     try
     {
         SelectRepository selectRepo = new SelectRepository();
         return Ok(selectRepo.Specializations(all));
     }
     catch (Exception ex)
     {
         return BadRequest(ex.Message);
     }
 }
        public IHttpActionResult UserProfile(long id, string data)
        {
            try
            {
                UserRepository userRepo = new UserRepository();
                Applicant app = userRepo.GetApplicant(id);
                JobRepository jobRepo = new JobRepository();

                UserCollectionsViewModel model = new UserCollectionsViewModel();

                switch (data)
                {
                    case "educ":
                        model.educ = userRepo.GetListEducationalInfo(id);
                        break;

                    case "basic":
                        model.basicInfo = userRepo.GetBasicInfo(id);
                        break;

                    case "saved":
                        model.savedJobs = jobRepo.GetSavedJobs(id);
                        break;

                    case "exp":
                        model.exp = userRepo.GetExperience(userRepo.GetApplicant(id).resume_id);
                        break;

                    default:
                        model.initialInfo = userRepo.GetInitialInfo(id);
                        break;
                }

                SelectRepository selectRepo = new SelectRepository();

                model.jobSearch = new JobFilterCollectionViewModel();
                model.jobSearch.workbases = selectRepo.Workbases();
                model.jobSearch.specializations = selectRepo.Specializations();

                ContentRepository contentRepo = new ContentRepository();

                model.news = contentRepo.GetLatest("news", 2);
                model.partners = contentRepo.GetLatest("partners", 6);

                SettingsRepository settingsRepo = new SettingsRepository();
                model.fb = JsonConvert.DeserializeObject<FacebookViewModel>(settingsRepo.GetSetting("fb").value);

                model.hotJobs = jobRepo.GetHotJobs();
                model.recommendedJobs = jobRepo.GetRecommendedJobs(app);
                model.savedJobsCount = jobRepo.GetSavedJobs(app.id).Count;

                JobGroupRepository groupRepo = new JobGroupRepository();
                List<JobGroupViewModel> groups = groupRepo.GetList(string.Empty, "sequence_asc", true);

                foreach (var g in groups)
                {
                    g.jobs = jobRepo.GetByGroup(g.id);
                    model.jobGroups.Add(g);
                }

                model.promotions = userRepo.GetPromotions(app.resume_id);
                model.initialInfo = userRepo.GetInitialInfo(id);
                model.photo = app.photo;

                model.interview = userRepo.GetInterviewStatus(app.role_id);

                return Ok(model);
            }
            catch (Exception ex)
            {
                return BadRequest(ex.Message);
            }
        }
        public IHttpActionResult SeaBasedSelect()
        {
            try
            {
                SelectRepository repo = new SelectRepository();
                SelectCollectionsViewModel model = new SelectCollectionsViewModel();

                model.Specializations = repo.Specializations();
                model.Vessels = repo.VesselTypes();
                model.TradeAreas = repo.TradeAreas();
                model.EngineTypes = repo.EngineTypes();
                model.Currencies = repo.Currencies();

                return Ok(model);
            }
            catch (Exception ex)
            {
                return BadRequest(ex.Message);
            }
        }
        public IHttpActionResult PromotionsWithSpecialization(string search, string sort, DateTime? date, long? specialization)
        {
            try
            {
                SelectRepository selectRepo = new SelectRepository();
                PromotionRepository promoRepo = new PromotionRepository();

                PromotionsSpecializationCollectionViewModel model = new PromotionsSpecializationCollectionViewModel();

                model.promotions = promoRepo.GetList(search, sort, date, specialization);
                model.specialization = selectRepo.Specializations(true);

                return Ok(model);
            }
            catch (Exception ex)
            {
                return BadRequest(ex.Message);
            }
        }
        public IHttpActionResult LandBasedSelect()
        {
            try
            {
                SelectRepository repo = new SelectRepository();
                SelectCollectionsViewModel model = new SelectCollectionsViewModel();
                model.Specializations = repo.Specializations();
                model.Countries = repo.Countries();
                model.Currencies = repo.Currencies();

                return Ok(model);
            }
            catch (Exception ex)
            {
                return BadRequest(ex.Message);
            }
        }
        public IHttpActionResult JobSearch(string sort, string title, string group, long? specialization, string workbase, bool? entryLevel, bool? hot)
        {
            try
            {
                JobRepository jobRepo = new JobRepository();
                JobGroupRepository groupRepo = new JobGroupRepository();
                SelectRepository selectRepo = new SelectRepository();

                JobFilterCollectionViewModel model = new JobFilterCollectionViewModel();

                model.specializations = selectRepo.Specializations();
                model.workbases = selectRepo.Workbases();
                model.groups = groupRepo.GetList("", "", null);
                model.jobs = jobRepo.GetList(sort, title, string.Empty, group, specialization, workbase, entryLevel, hot);

                return Ok(model);
            }
            catch (Exception ex)
            {
                return BadRequest(ex.Message);
            }
        }
        public IHttpActionResult Home()
        {
            try
            {
                SelectRepository selectRepo = new SelectRepository();
                SlideRepository slideRepo = new SlideRepository();
                JobGroupRepository groupRepo = new JobGroupRepository();
                JobRepository jobRepo = new JobRepository();

                HomeCollectionViewModel model = new HomeCollectionViewModel();

                model.specializations = selectRepo.Specializations();
                model.suffixes = selectRepo.Suffixes();
                model.workbases = selectRepo.Workbases();

                model.slides = slideRepo.GetList();

                List<JobGroupViewModel> groups = groupRepo.GetList(string.Empty, "sequence_asc", true);

                foreach (var g in groups)
                {
                    g.jobs = jobRepo.GetByGroup(g.id);
                    model.jobGroups.Add(g);
                }

                return Ok(model);
            }
            catch (Exception ex)
            {
                return BadRequest(ex.Message);
            }
        }