public void RemoveFamily(int HouseNumber, string StreetName) { Family toRemove = Families.First(a => a.HouseNumber == HouseNumber && a.StreetName.Equals(StreetName)); Families.Remove(toRemove); SaveChanges(); }
public ActionResult Create(FormCollection collection) { var Fams = Session["familyList"] as List <Families>; try { Families family = new Families() { id = Fams.Count(), familyname = collection["familyname"], address1 = collection["address1"], city = collection["city"], state = collection["state"], zip = collection["zip"], homephone = collection["homephone"] }; //Add new Family Fams = (List <Families>)Session["familyList"]; Fams.Add(family); //save family Session["familyList"] = Fams; return(RedirectToAction("Index")); } catch { return(View()); } }
public async Task AddPetAsync(Pet pet) { Family.Pets.Add(pet); await UpdateFamily(Family); Family = Families.First(f => f.HouseNumber == Family.HouseNumber && f.StreetName.Equals(Family.StreetName)); }
private int CompareWithFamilies(object valueNo1, object valueNo2) { Families family = this.GetFamily(valueNo1.GetType()); Families families2 = this.GetFamily(valueNo2.GetType()); if (family < families2) { return(-1); } if (family > families2) { return(1); } switch (family) { case Families.DATETIME: valueNo1 = Convert.ToDateTime(valueNo1, base.FormatProvider); valueNo2 = Convert.ToDateTime(valueNo1, base.FormatProvider); break; case Families.NUMBER: valueNo1 = Convert.ToDouble(valueNo1, base.FormatProvider); valueNo2 = Convert.ToDouble(valueNo2, base.FormatProvider); break; case Families.BOOLEAN: valueNo1 = Convert.ToBoolean(valueNo1, base.FormatProvider); valueNo2 = Convert.ToBoolean(valueNo2, base.FormatProvider); break; case Families.ARRAY: { Array array = (Array)valueNo1; Array array2 = (Array)valueNo2; if (array.Length <= array2.Length) { if (array.Length < array2.Length) { return(-1); } for (int i = 0; i < array.Length; i++) { int num2 = this.CompareTo(array.GetValue(i), array2.GetValue(i)); if (num2 != 0) { return(num2); } } return(0); } return(1); } default: valueNo1 = valueNo1.ToString(); valueNo2 = valueNo2.ToString(); break; } return(((IComparable)valueNo1).CompareTo(valueNo2)); }
public ActionResult Edit(int id, FormCollection collection) { try { var Fams = (List <Families>)Session["familyList"]; var f = Fams[id]; Families newFam = new Families() { id = f.id, familyname = collection["familyname"], address1 = collection["address1"], city = collection["city"], state = collection["state"], zip = collection["zip"], homephone = collection["homephone"] }; Fams.Where(x => x.id == id).First().familyname = collection["familyname"]; Fams.Where(x => x.id == id).First().address1 = collection["address1"]; Fams.Where(x => x.id == id).First().city = collection["city"]; Fams.Where(x => x.id == id).First().state = collection["state"]; Fams.Where(x => x.id == id).First().zip = collection["zip"]; Fams.Where(x => x.id == id).First().homephone = collection["homephone"]; return(RedirectToAction("Index")); } catch { return(View("Something Bad Happend")); } }
public void Bound(string name, Func <dynamic, HelperResult> predicate) { Families.Add(new ContextFamily() { Name = name, Predicate = predicate }); }
public async Task AddChildAsync(Child child) { Family.Children.Add(child); await UpdateFamily(Family); Family = Families.First(f => f.HouseNumber == Family.HouseNumber && f.StreetName.Equals(Family.StreetName)); }
public void AddNewFamily(Family family) { int max = Families.Max(family => family.Id); family.Id = (++max); Families.Add(family); SaveChanges(); }
public async void Get() { var jData = await DataService.Get($"Family/{Preferences.Get("TeamId", "")}"); if (jData == "ConnectionError") { StandardMessagesDisplay.NoConnectionToast(); } else if (jData == "null") { StandardMessagesDisplay.NoDataDisplayMessage(); } else if (jData == "Error") { StandardMessagesDisplay.Error(); } else if (jData == "ErrorTracked") { StandardMessagesDisplay.ErrorTracked(); } else { try { var data = JsonConvert.DeserializeObject <Dictionary <string, FamilyModel> >(jData); if (data != null) { foreach (KeyValuePair <string, FamilyModel> item in data) { StaticDataStore.FamilyNumbers.Add(item.Value.HouseNo); Families?.Add( new FamilyModel { FId = item.Key.ToString(), Id = item.Value.Id, ParentName = item.Value.ParentName, PhoneNumber = item.Value.PhoneNumber, HouseNo = item.Value.HouseNo } ); } } if (Families != null) { StaticDataStore.Families = Families; StaticDataStore.TeamStats.TotalHouseholds = Families.Count; } } catch (Exception ex) { Crashes.TrackError(ex); StandardMessagesDisplay.InputToast(ex.Message); } } }
/// <summary> /// Method to invoke when the RemoveFamily command is executed. /// </summary> private async Task OnRemoveFamilyExecuteAsync() { if (await _messageService.ShowAsync(string.Format("Are you sure you want to delete the family '{0}'?", SelectedFamily), "Are you sure?", MessageButton.YesNo, MessageImage.Question) == MessageResult.Yes) { Families.Remove(SelectedFamily); SelectedFamily = null; } }
private void LoadPartGen() { Logger.Instance.WriteVerbose("Loading Xilinx Part Library..."); foreach (string family in XilinxPartGen.LoadFamilyList()) { Logger.Instance.WriteDebug("Loading Xilinx Part for the '{0}' family", family); Families.Add(XilinxPartGen.LoadFamily(this, family)); } }
public void SaveToXML(string path) { XmlSerializer xs = new XmlSerializer(typeof(Family[])); using (StreamWriter wr = new StreamWriter(path)) { xs.Serialize(wr, Families.ToArray <Family>()); } }
public void AddAdult(Adult adult) { IList <Adult> adults = Families.SelectMany(item => item.Adults).ToList(); int max = adults.Max(adult => adult.Id); adult.Id = (++max); Family.Adults.Add(adult); SaveChanges(); }
public void Add(Family family) { Families.Add(family); foreach (var member in family.Members) { member.Setup(); Settlers.Add(member); } }
/// <summary> /// Gets or create the <see cref="Modules.Families"/> module. /// </summary> /// <param name="world">The world.</param> /// <returns>The module.</returns> public static Families Families(this World world) { if (world.TryGet <Families>(out var module)) { return(module); } world.Set(module = new Families(world.Messages(), world.Entities())); return(module); }
public void Add(Settler settler) { settler.Setup(); Settlers.Add(settler); if (!Families.Contains(settler.Family)) { Families.Add(settler.Family); } }
public void AddChild(Child child) { IList <Child> children = Families.SelectMany(item => item.Children).ToList(); int max = children.Max(child => child.Id); child.Id = (++max); Family.Children.Add(child); SaveChanges(); }
public async Task AddChildAsync(Child child) { IList <Child> children = Families.SelectMany(item => item.Children).ToList(); int max = children.Max(child => child.Id); child.Id = (++max); Family.Children.Add(child); await UpdateFamily(Family); }
public override Dictionary <string, Action <string> > ArgumentsRecipes() { return(new Dictionary <string, Action <string> > { { nameof(Brands), arg => Brands = Brands.Parse(arg) }, { nameof(Families), arg => Families = Families.Parse(arg) }, { nameof(Versions), arg => Versions = Versions.Parse(arg) }, { nameof(Styles), arg => Styles = Styles.Parse(arg) }, { nameof(Diff), arg => Diff = Diff.Parse(arg) }, }); }
public void RemoveAdult(int FamilyId, int AdultId) { Family familyFromToRemove = Families.First(f => f.Id == FamilyId); Adult adultToRemove = familyFromToRemove.Adults.First(a => a.Id == AdultId); int familyIndex = Families.IndexOf(familyFromToRemove); Families[familyIndex].Adults.Remove(adultToRemove); SaveChanges(); }
public async Task <ActionResult <Family> > PostFamilies(Models.Family family) { Entities.Families fentity = new Families(); EntityExpression.FamilyModelToEntity(fentity, family); _context.Families.Add(fentity); await _context.SaveChangesAsync(); var result = await GetFamilies(fentity.Id); return(CreatedAtAction("GetFamilies", new { id = fentity.Id }, result)); }
public Families BindViewToModel(Families model) { model.Code = tb_CategoryCode.Text; model.LangToName = model.LangToName ?? new Dictionary <long, string>(); foreach (var lang in EditedLangToName.Keys) { model.LangToName[lang] = EditedLangToName[lang]; } return(model); }
public void TryUpdateFamily(Rock.Client.Family family) { // see if the family exists Rock.Client.Family currFamily = Families.Where(f => f.Id == family.Id).SingleOrDefault( ); // if it does, get its index and replace it. if (currFamily != null) { int currIndex = Families.IndexOf(currFamily); Families[currIndex] = family; } }
private void ProcessRootLevel(string[] lineArray) { switch (_currentRecord) { case GedcomRecordEnum.Individual: Individuals.Add(_currentIndividual); break; case GedcomRecordEnum.Family: Families.Add(_currentFamily); break; case GedcomRecordEnum.Note: Notes.Add(_currentNote); break; } if (lineArray[1] == "HEAD") { _currentRecord = GedcomRecordEnum.Header; _currentSubRecord = GedcomSubRecordEnum.None; } else if (lineArray[1].IndexOf("@") >= 0) { switch (lineArray[2]) { case "INDI": _currentRecord = GedcomRecordEnum.Individual; _currentIndividual = new Individual { Id = lineArray[1] }; _currentSubRecord = GedcomSubRecordEnum.None; break; case "FAM": _currentRecord = GedcomRecordEnum.Family; _currentFamily = new Family { Id = lineArray[1] }; _currentSubRecord = GedcomSubRecordEnum.None; break; case "NOTE": _currentRecord = GedcomRecordEnum.Note; _currentNote = new Note { Id = lineArray[1] }; _currentSubRecord = GedcomSubRecordEnum.None; break; } } }
public void AddAdult(Adult adult, Family family) { int currentFamily = Families.IndexOf(family); int max = Adults.Max(adult => adult.Id); adult.Id = (++max); Families.ElementAt(currentFamily).Adults.Add(adult); Adults.Add(adult); SaveChanges(); }
/// <summary> /// Method to invoke when the AddFamily command is executed. /// </summary> private async Task OnAddFamilyExecuteAsync() { var family = new Family(); // Note that we use the type factory here because it will automatically take care of any dependencies // that the FamilyWindowViewModel will add in the future var typeFactory = this.GetTypeFactory(); var familyWindowViewModel = typeFactory.CreateInstanceWithParametersAndAutoCompletion <FamilyWindowViewModel>(family); if (await _uiVisualizerService.ShowDialogAsync(familyWindowViewModel) ?? false) { Families.Add(family); } }
private static void DeleteById(int id) { var famMem = new Families() { Id = id }; using (var context = new EFCoreStandardContext()) { context.Families.Remove(famMem); context.SaveChanges(); } }
private static void InsertFamily() { var family = new Families { Name = "Duane" }; using (var context = new EFCoreStandardContext()) { context.Families.Add(family); context.SaveChanges(); Console.ReadLine(); } }
public void BindModelToView(Families selectedModel) { tb_CategoryCode.Text = selectedModel.Code; EditedLangToName = new Dictionary <long, string>(); foreach (long lang in cb_Language.Items.Select(x => x.Value)) { EditedLangToName[lang] = presenter.GetNameBySelectedLanguage(lang, selectedModel.Id); } var selectedLangId = (cb_Language.SelectedValue as long?).GetValueOrDefault(); tb_CategoryName.Text = EditedLangToName[selectedLangId]; }
private static List <Person> GetFamily(Families family) { switch (family) { case Families.Kremers: return(GetKremerFamily()); case Families.Moens: return(GetMoenFamily()); default: return(new List <Person>()); } }