public override void LoadFromStore(VMStore modelStore) { try { Profile = JsonConvert.DeserializeObject <ClientProfileDTO>(modelStore.Store); Downloaded = Profile.Downloaded; ClientId = Profile.ClientId; SelectedMaritalStatus = MaritalStatus.FirstOrDefault(x => x.Id == Profile.MaritalStatus); SelectedKeyPop = KeyPops.FirstOrDefault(x => x.Id == Profile.KeyPop); OtherKeyPop = Profile.OtherKeyPop; SelectedEducation = Educations.FirstOrDefault(x => x.ItemId == Profile.Education); SelectedCompletion = Completions.FirstOrDefault(x => x.ItemId == Profile.Completion); SelectedOccupation = Occupations.FirstOrDefault(x => x.ItemId == Profile.Occupation); if (null != Profile.RelTypeId && !string.IsNullOrWhiteSpace(Profile.RelTypeId)) { SelectedRelationshipType = RelationshipTypes.FirstOrDefault(x => x.Description.ToLower() == Profile.RelTypeId.ToLower()); } } catch (Exception e) { Mvx.Error(e.Message); } }
// Returns a path to the image associated with term is term is a valid word, // otherwise returns empty string ("") public string FetchImagePath(string term) { string basePath = "../../../word_images/"; if (Animals.Contains(term)) { return(basePath + "animals/" + term + ".jpg"); } else if (Body_parts.Contains(term)) { return(basePath + "body_parts/" + term + ".jpg"); } else if (Fruit_vegetables.Contains(term)) { return(basePath + "fruit_vegetables/" + term + ".jpg"); } else if (Artificial.Contains(term)) { return(basePath + "artificial/" + term + ".jpg"); } else if (Natural_world.Contains(term)) { return(basePath + "nature/" + term + ".jpg"); } else if (Occupations.Contains(term)) { return(basePath + "occupations/" + term + ".jpg"); } return(""); }
public void Create(OccupationCreateRequest request) { Occupations occupations = new Occupations(request.DailyAmount, request.Date, request.ClientId, request.RoomId); occupations.Situation = "N"; _occupationRepository.Create(occupations); }
public void LoadOccupations() { Occupation occupation = new Occupation() { Id = 1, Name = "Cleaner", RateId = 3 }; Occupations.Add(occupation); occupation = new Occupation() { Id = 2, Name = "Doctor", RateId = 1 }; Occupations.Add(occupation); occupation = new Occupation() { Id = 3, Name = "Author", RateId = 2 }; Occupations.Add(occupation); occupation = new Occupation() { Id = 4, Name = "Farmer", RateId = 4 }; Occupations.Add(occupation); occupation = new Occupation() { Id = 5, Name = "Mechanic", RateId = 4 }; Occupations.Add(occupation); occupation = new Occupation() { Id = 6, Name = "Florist", RateId = 3 }; Occupations.Add(occupation); }
public void ShouldCreateRoom() { var occupationExpected = new Occupations(_faker.Random.Int(0, 600), DateTime.Now, _faker.Random.Int(0, 600), _faker.Random.Int(0, 600)); var occupation = new Occupations(occupationExpected.DailyAmount, occupationExpected.Date, occupationExpected.ClientId, occupationExpected.RoomId); occupationExpected.ToExpectedObject().ShouldMatch(occupation); }
public Occupations Build() { var occupations = new Occupations(DailyAmount, Date, ClientId, RoomId); var propertyInfo = occupations.GetType().GetProperty("Id"); propertyInfo.SetValue(occupations, Convert.ChangeType(Id, propertyInfo.PropertyType), null); return(occupations); }
public void LoadOccupations() { // Get occupations from database var query = Conn.Table <OccupationModel> (); // Copy into table collection Occupations.Clear(); foreach (OccupationModel occupation in query) { Occupations.Add(occupation); } }
public void AddNewOccupation() { Occupation newOccupation = new Occupation { Name = _jobTitle }; _employeeRepository.AddNewOccupation(newOccupation); // when a new occupation is added, need to update the combobox var occupations = _employeeRepository.getAllOccupations(); Occupations.Clear(); Occupations.AddRange(occupations); }
public VOccupations Add(VOccupations occupation) { using (_context) { var newoccupation = new Occupations() { Occupation = occupation.Occupation, Active = true }; _context.Occupations.Add(newoccupation); _context.SaveChanges(); occupation.ID = newoccupation.ID; return(occupation); } }
public override void ViewAppeared() { IndexClientName = string.Empty; IsRelation = false; base.ViewAppeared(); var indexJson = _settings.GetValue(nameof(IndexClientDTO), ""); if (!string.IsNullOrWhiteSpace(indexJson)) { IsRelation = true; IndexClientDTO = JsonConvert.DeserializeObject <IndexClientDTO>(indexJson); if (null != IndexClientDTO) { MoveNextLabel = "SAVE"; IndexClientName = $"Relation To Index [{IndexClientDTO}]"; Title = $"Profile [{IndexClientDTO.RelType}]"; RelationshipTypes = RelationshipTypes .Where(x => x.Description.ToLower() == IndexClientDTO.RelType.ToLower()).ToList(); } } var preventEnroll = _settings.GetValue("PreventEnroll", ""); if (!string.IsNullOrWhiteSpace(preventEnroll)) { MoveNextLabel = Convert.ToBoolean(preventEnroll) ? "SAVE" : "NEXT"; } var educationsJson = _settings.GetValue("lookup.Education", ""); var completionsJson = _settings.GetValue("lookup.Completion", ""); var occupationsJson = _settings.GetValue("lookup.Occupation", ""); if (!string.IsNullOrWhiteSpace(educationsJson) && !Educations.Any()) { Educations = JsonConvert.DeserializeObject <List <CategoryItem> >(educationsJson); } if (!string.IsNullOrWhiteSpace(completionsJson) && !Completions.Any()) { Completions = JsonConvert.DeserializeObject <List <CategoryItem> >(completionsJson); } if (!string.IsNullOrWhiteSpace(occupationsJson) && !Occupations.Any()) { Occupations = JsonConvert.DeserializeObject <List <CategoryItem> >(occupationsJson); } }
public static ValidationResult ValidateOccupation(Occupations occupation, ValidationContext validationContext) { Employee employee = validationContext.ObjectInstance as Employee; if (employee.Occupation == Occupations.QAEngineer && employee.Department == Departments.Chicago) { return new ValidationResult("No QA engineers are employed in the Chicago office.", new string[] { validationContext.MemberName }); } else if (employee.Occupation == Occupations.SupportSpecialist && employee.Department == Departments.London) { return new ValidationResult("No support specialists are employed in the London office.", new string[] { validationContext.MemberName }); } else { return ValidationResult.Success; } }
public override void Start() { base.Start(); MaritalStatus = _lookupService.GetMaritalStatuses(true).ToList(); KeyPops = _lookupService.GetKeyPops(true).ToList(); Educations = _lookupService.GetCategoryItems("Education", true, "[Select Education]").ToList(); Completions = _lookupService.GetCategoryItems("Completion", true, "[Select Completion]").ToList(); Occupations = _lookupService.GetCategoryItems("Occupation", true, "[Select Occupation]").ToList(); try { SelectedMaritalStatus = MaritalStatus.FirstOrDefault(x => x.Id == ""); SelectedKeyPop = KeyPops.FirstOrDefault(x => x.Id == ""); SelectedEducation = Educations.FirstOrDefault(x => x.Id == Guid.Empty); SelectedCompletion = Completions.FirstOrDefault(x => x.Id == Guid.Empty); SelectedOccupation = Occupations.FirstOrDefault(x => x.Id == Guid.Empty); } catch {} }
public JsonResult GetPeopleFromAffiliation(Occupations occupation) { return(Json( PeopleStore.Store.Where(people => people.occupation.ToString() == occupation.ToString()) )); }
public void Create(Occupations occupations) { _hotelContext.Occupation.Add(occupations); _hotelContext.SaveChanges(); }
public KnowledgeChance(Occupations _occupation, int _chance) { occupation = _occupation; chance = _chance; }
public static IEnumerable <string> RetrieveExampleList(string word) { word = word.ToLower(); if (!word.StartsWith("something")) { if (word.StartsWith("the title") || word.StartsWith("a title")) { word = word.Replace("the title ", string.Empty).Replace("a title ", string.Empty); } else { Regex firstWordRegex = new Regex(@"^\w+ "); word = firstWordRegex.Replace(word, ""); word = word.Replace("type of ", string.Empty); word = word.Replace("kind of ", string.Empty); } } switch (word) { case "noun": return(Nouns.Take(3)); case "adjective": return(Adjectives.Take(3)); case "plural noun": case "noun (plural)": return(PluralNouns.Take(3)); case "verb": return(Verbs.Take(3)); case "number": Random rand = new Random(); return(new List <string>() { rand.Next(1, 999).ToString(), rand.Next(1, 999).ToString(), rand.Next(1, 999).ToString() }); case @"verb ending in ""ing""": return(GerundVerbs.Take(3)); case "adverb": return(Adverbs.Take(3)); case "part of the body": case "body part": return(PartsOfBody.Take(3)); case "liquid": return(Liquids.Take(3)); case "place": return(Places.Take(3)); case "animal": return(Animals.Take(3)); case "food": return(Foods.Take(3)); case "color": return(Colors.Take(3)); case "verb (past tense)": return(PastTenseVerbs.Take(3)); case "celebrity": return(Celebrities.Take(3)); case "exclamation": return(Exclamations.Take(3)); case "part of the body (plural)": case "body part (plural)": return(PluralBodyParts.Take(3)); case "silly word": return(SillyWords.Take(3)); case "animal (plural)": return(PluralAnimals.Take(3)); case "city": return(Cities.Take(3)); case "nonsense word": return(NonsenseWords.Take(3)); case "famous person": return(FamousPeople.Take(3)); case "article of clothing": return(Clothing.Take(3)); case "vehicle": return(Vehicles.Take(3)); case "something alive (plural)": return(PluralAliveSomethings.Take(3)); case "geographical location": return(GeographicalLocations.Take(3)); case "town": return(Towns.Take(3)); case "country": return(Countries.Take(3)); case "container": return(Containers.Take(3)); case "last name": return(LastNames.Take(3)); case "name": return(Names.Take(3)); case @"verb ending in ""s""": return(VerbsEndingInS.Take(3)); case "occupation": case "occupation or job": case "profession": return(Occupations.Take(3)); case "silly noise": return(SillyNoises.Take(3)); case "male celebrity": case "celebrity (male)": return(MaleCelebrities.Take(3)); case "article of clothing (plural)": return(PluralClothing.Take(3)); case "name of a school": case "school": return(Schools.Take(3)); case "building": return(Buildings.Take(3)); case "bird": return(Birds.Take(3)); case @"adjective ending in ""est""": case "adjective (superlative)": return(Superlatives.Take(3)); case "letter": return(Letters.Take(3)); case "game": return(Games.Take(3)); case "holiday": return(Holidays.Take(3)); case "silly word (plural)": return(PluralSillyWords.Take(3)); case "something round": return(RoundSomethings.Take(3)); case "piece of furniture": return(Furniture.Take(3)); case "vegetable": return(Vegetables.Take(3)); case "spanish word": return(SpanishWords.Take(3)); case "tv actor": return(TVActors.Take(3)); case "boy's name": return(BoyNames.Take(3)); case "something alive": return(AliveSomethings.Take(3)); case "female celebrity": case "celebrity (female)": return(FemaleCelebrities.Take(3)); case "italian word": return(ItalianWords.Take(3)); case "occupation (plural)": return(PluralOccupations.Take(3)); case "first name": return(FirstNames.Take(3)); case "room in a house": return(HouseRooms.Take(3)); case "relative": return(Relatives.Take(3)); case "movie star": return(MovieStars.Take(3)); case "disease": return(Diseases.Take(3)); case "sport": return(Sports.Take(3)); case "something icky": return(IckySomethings.Take(3)); case "actor": return(Actors.Take(3)); case "concept or ideal": return(Concepts.Take(3)); default: return(new string[3] { string.Empty, string.Empty, string.Empty }); } }
public MainWindowViewModel(IOccupationParser occupationParser) { this._occupationParser = occupationParser; var occupationTypesSourceList = new SourceList <OccupationType>(); var occupationsSourceList = new SourceList <Occupation>(); var occupationTypes = occupationTypesSourceList.Connect().Transform(x => new CheckedItemViewModel(x.GetDescription(), true)).Publish(); var occupations = occupationsSourceList.Connect().Transform(x => new OccupationViewModel(x)).Publish(); IObservable <Func <OccupationViewModel, bool> > filter = occupationTypes.AutoRefresh(x => x.IsChecked).Filter(x => x.IsChecked).Transform(x => x.Name) .ToCollection() .Throttle(TimeSpan.FromMilliseconds(250)) .Select(items => { var types = items.Select(t => t.GetValueFromDescription <OccupationType>()); OccupationType?type = null; foreach (var item in types) { if (type == null) { type = item; } else { type |= item; } } bool Predicate(OccupationViewModel vm) => type.HasValue && type.Value.HasFlag(vm.OccupationType); return((Func <OccupationViewModel, bool>)Predicate); }); occupationTypes.AutoRefresh(x => x.IsChecked).Filter(x => x.IsChecked).Throttle(TimeSpan.FromMilliseconds(350)).ObserveOn(RxApp.MainThreadScheduler).Subscribe(x => { for (int i = 0; i < Occupations.Count; i++) { Occupations[i].SerialNumber = i + 1; } }); occupationTypes.ObserveOn(RxApp.MainThreadScheduler).Bind(out this._occupationTypes).Subscribe(); occupations.Filter(filter).ObserveOn(RxApp.MainThreadScheduler).Bind(out this._occupations).Subscribe(); occupationTypes.Connect(); occupations.Connect(); Initialize = ReactiveCommand.CreateFromTask(async() => { var result = await this._occupationParser.ParseDataAsync("Occupations.txt"); occupationsSourceList.AddRange(result); occupationTypesSourceList.AddRange(Enum.GetValues(typeof(OccupationType)).Cast <OccupationType>()); }); GetItemWithSerialNumber = ReactiveCommand.Create <int>(number => { SelectedItem = Occupations.SingleOrDefault(x => x.SerialNumber == number); }); Random = ReactiveCommand.CreateFromTask(async() => { var random = new Random(); var number = random.Next(1, Occupations.Count); await GetItemWithSerialNumber.Execute(number); }); }
private Occupations GetOccupations(int constituentId) { var OccupationsData = HttpHelper.Get<OccupationsData>(string.Format(serviceBaseUri + "/Occupations?ConstituentId={0}", constituentId)); mapper = new AutoDataContractMapper(); var Occupations = new Occupations(); mapper.MapList(OccupationsData, Occupations, typeof(Occupation)); return Occupations; }
public void CancelEdit() { this.Department = backup.department; this.FirstName = backup.firstName; this.LastName = backup.lastName; this.Occupation = backup.occupation; this.HireDate = backup.hireDate; }