public IHttpActionResult ListEducation(long id) { try { SelectRepository selectRepo = new SelectRepository(); List<EducationViewModel> model = repo.GetListEducationalInfo(id); List<EducationLevel> lstLevels = selectRepo.EducationalLevels(); List<FieldStudy> lstFields = selectRepo.FieldOfStudies(); foreach (var e in model) { e.lstFields = new System.Web.Mvc.SelectList(lstFields, "id", "description", e.field_study); e.lstLevels = new System.Web.Mvc.SelectList(lstLevels, "id", "description", e.level); } var educEmpty = new EducationViewModel(); educEmpty.field_study = -1; educEmpty.lstFields = new System.Web.Mvc.SelectList(lstFields, "id", "description"); educEmpty.lstLevels = new System.Web.Mvc.SelectList(lstLevels, "id", "description"); model.Add(educEmpty); return Ok(model); } catch (Exception ex) { return BadRequest(ex.Message); } }
public IHttpActionResult CityProvinces(string id) { try { SelectRepository repo = new SelectRepository(); return Ok(repo.CityProvinces(id)); } catch (Exception ex) { return BadRequest(ex.Message); } }
public IHttpActionResult BasicInfoSelectList(string region, string city_province) { try { SelectRepository repo = new SelectRepository(); SelectCollectionsViewModel select = repo.BasicInfoSelectLists(region, city_province); return Ok(select); } catch (Exception ex) { return BadRequest(ex.Message); } }
public IHttpActionResult BasicInfoWithSelectList(long id) { try { UserRepository userRepo = new UserRepository(); BasicViewModel model = userRepo.GetBasicInfo(id); SelectRepository repo = new SelectRepository(); SelectCollectionsViewModel select = repo.BasicInfoSelectLists(model.region, model.city_province); model.selectList = select; return Ok(model); } catch (Exception ex) { return BadRequest(ex.Message); } }
public async Task <List <ListDictionary> > ExecuteQuery(string connectionString, string sqlCommand) { List <ListDictionary> queryResult = new List <ListDictionary>(); while (_keepRunning) { var afterWhere = sqlCommand.ToLower().After("where"); if (afterWhere.ToLower().Contains("select")) { Console.WriteLine("This application is unable to process statements that have a select in their where clause"); } try { if (sqlCommand.ToLower().Contains("select")) { IRepository repo = new SelectRepository(); return(queryResult = await repo.Command(connectionString, sqlCommand)); } else if (sqlCommand.ToLower().Contains("insert")) { IRepository repo = new InsertRepository(); return(queryResult = await repo.Command(connectionString, sqlCommand)); } else if (sqlCommand.ToLower().Contains("delete")) { IRepository repo = new DeleteRepository(); return(queryResult = await repo.Command(connectionString, sqlCommand)); } else if (sqlCommand.ToLower().Contains("update")) { IRepository repo = new UpdateRepository(); return(queryResult = await repo.Command(connectionString, sqlCommand)); } else if (sqlCommand.ToLower().Contains("q")) { Console.WriteLine("Are you sure you want to quit?"); var quitter = Console.ReadLine(); if (quitter.ToLower().Contains("y") || quitter.ToLower().Contains("yes")) { _keepRunning = false; } return(new List <ListDictionary>()); } else { return(new List <ListDictionary>()); } } catch (Exception ex) { Console.WriteLine("There may be an error with your SQL Query." + System.Environment.NewLine + "The error reads: " + ex.Message); if (ex.Message.Contains("No such host is known") || ex.Message.Contains("Couldn't set port (Parameter 'port')")) { _keepRunning = false; var ConnString = UserInteractions.AskUserForAuthenticationInformation(); await ExecuteQuery(ConnString, sqlCommand); } } } return(queryResult); }
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 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); } }
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); } }
public IHttpActionResult Suffixes() { try { SelectRepository repo = new SelectRepository(); SelectCollectionsViewModel model = new SelectCollectionsViewModel(); model.suffixes = repo.Suffixes(); return Ok(model); } 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 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 GroupWorkbase() { try { SelectRepository selectRepo = new SelectRepository(); JobGroupRepository groupRepo = new JobGroupRepository(); GroupWorkbaseViewModel model = new GroupWorkbaseViewModel(); model.workbases = selectRepo.Workbases(); model.groups = groupRepo.GetList(string.Empty, string.Empty, null); return Ok(model); } catch (Exception ex) { return BadRequest(ex.Message); } }
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); } }
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 UserInitialInfoForm(long id) { try { SelectRepository selectRepo = new SelectRepository(); AltPrimaryViewModel model = new AltPrimaryViewModel(repo.GetInitialInfo(id)); model.lstSuffixes = selectRepo.Suffixes(); return Ok(model); } catch (Exception ex) { return BadRequest(ex.Message); } }
public IHttpActionResult SingleJobWithOptions(long id) { try { JobRepository repo = new JobRepository(); JobGroupRepository groupRepo = new JobGroupRepository(); SelectRepository selectRepo = new SelectRepository(); JobViewModel model = repo.GetSingle(id); if (model.id == 0) { throw new Exception(Error.CONTENT_NOT_FOUND); } model.workbases = selectRepo.Workbases(); model.groups = groupRepo.GetList(string.Empty, string.Empty, null); 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 EducationMetadata(long id) { try { EducationMetadata data = new EducationMetadata(); SelectRepository repo = new SelectRepository(); UserRepository userRepo = new UserRepository(); data.count = userRepo.GetListEducationalInfo(id).Count; data.fields = repo.FieldOfStudies(); data.levels = repo.EducationalLevels(); return Ok(data); } catch (Exception ex) { return BadRequest(ex.Message); } }