protected override void OnInitialized() { base.OnInitialized(); Entiteiten = EntiteitRepository.GetAll(); _beheerderFormModel = new BeheerderFormModel(Entiteiten.ToList()); _editContext = new EditContext(_beheerderFormModel); _editContext.OnFieldChanged += HandleFieldChanged; }
protected override void OnInitialized() { base.OnInitialized(); _entiteit = EntiteitRepository.GetByEmail(UserManager.GetUserName(HttpContextAccessor.HttpContext.User)); _personeelslidFormModel = new PersoneelslidFormModel(); _editContext = new EditContext(_personeelslidFormModel); _editContext.OnFieldChanged += HandleFieldChanged; }
protected override void OnInitialized() { base.OnInitialized(); _entiteit = EntiteitRepository.GetByEmail(UserManager.GetUserName(HttpContextAccessor.HttpContext.User)); _afwezigheid = AfwezigheidRepository.GetById(long.Parse(Id)); _afwezigheidFormModel = new AfwezigheidFormModel(_afwezigheid); _editContext = new EditContext(_afwezigheidFormModel); _editContext.OnFieldChanged += HandleFieldChanged; }
protected async void VerwijderEntiteit(MouseEventArgs e, long id) { var confirmModal = Modal.Show <ConfirmDelete>("Entiteit verwijderen"); var result = await confirmModal.Result; if (!result.Cancelled) { EntiteitRepository.Verwijder(id); Navigation.NavigateTo("/Admin/Entiteit/Overzicht/Delete"); } }
public void UpdateThema(Thema thema, HttpPostedFileBase ImageFile) { initNonExistingRepo(false); Thema toUpdate = GetThema(thema.EntiteitId); if (ImageFile != null) { EntiteitRepository repo = new EntiteitRepository(); toUpdate.Image = repo.ConvertToBytes(ImageFile); } toUpdate.SleutenWoorden = thema.SleutenWoorden; toUpdate.Naam = thema.Naam; entiteitRepository.UpdateThema(toUpdate); }
protected override void OnInitialized() { base.OnInitialized(); Entiteiten = EntiteitRepository.GetAll(); _beheerder = BeheerderRepository.GetById(long.Parse(Id)); if (_beheerder is null) { Navigation.NavigateTo("/Error"); } _beheerderFormModel = new BeheerderFormModel(Entiteiten.ToList(), _beheerder.Entiteiten.Select(e => e.Entiteit).ToList()) { Email = _beheerder.Email }; _editContext = new EditContext(_beheerderFormModel); }
public Organisatie ChangeOrganisatie(Organisatie ChangedOrganisatie, HttpPostedFileBase ImageFile) { initNonExistingRepo(false); Organisatie toUpdate = GetOrganisatie(ChangedOrganisatie.EntiteitId); if (ImageFile != null) { EntiteitRepository repo = new EntiteitRepository(); toUpdate.Image = repo.ConvertToBytes(ImageFile); } toUpdate.Naam = ChangedOrganisatie.Naam; toUpdate.Gemeente = ChangedOrganisatie.Gemeente; toUpdate.Posts = ChangedOrganisatie.Posts; toUpdate.Trends = ChangedOrganisatie.Trends; return(entiteitRepository.UpdateOrganisatie(ChangedOrganisatie)); }
public Persoon ChangePerson(Persoon ChangedPerson, HttpPostedFileBase ImageFile) { initNonExistingRepo(false); Persoon toUpdate = GetPerson(ChangedPerson.EntiteitId); if (ImageFile != null) { EntiteitRepository repo = new EntiteitRepository(); toUpdate.Image = repo.ConvertToBytes(ImageFile); } toUpdate.FirstName = ChangedPerson.FirstName; toUpdate.LastName = ChangedPerson.LastName; toUpdate.Naam = ChangedPerson.FirstName + " " + ChangedPerson.LastName; foreach (Organisatie o in toUpdate.Organisations) { ChangeOrganisatie(o, ImageFile); } return(entiteitRepository.UpdatePerson(toUpdate)); }
public List <String> getTopPersonWords(Persoon person) { EntiteitRepository erepo = new EntiteitRepository(); Entiteit entiteit = erepo.ReadEntiteit(person.EntiteitId); initNonExistingRepo(); List <Post> posts = person.Posts; List <Word> persoonWords = new List <Word>(); foreach (Post post in posts) { persoonWords.AddRange(postRepository.GetAllWordsFromPost(post)); } Dictionary <string, int> WordCountDic = new Dictionary <string, int>(); foreach (Word item in persoonWords) { if (!WordCountDic.ContainsKey(item.word)) { WordCountDic.Add(item.word, 1); } else { int count = 0; WordCountDic.TryGetValue(item.word, out count); WordCountDic.Remove(item.word); WordCountDic.Add(item.word, count + 1); } } var sortedDict = WordCountDic.OrderByDescending(entry => entry.Value) .Take(10) .ToDictionary(pair => pair.Key, pair => pair.Value); var values = sortedDict.Keys.ToList(); return(values); }
protected async void HandleValidSubmit() { if (UserManager.Users.FirstOrDefault(u => u.Email.ToLower().Equals(_entiteitFormModel.Email)) is null) { _userAlreadyExists = false; Models.Entiteit entiteit = new Models.Entiteit(_entiteitFormModel.Entiteitsnaam, _entiteitFormModel.Email); EntiteitRepository.VoegToe(entiteit); IdentityUser entiteitUser = new IdentityUser { UserName = entiteit.Email, Email = entiteit.Email }; await UserManager.CreateAsync(entiteitUser, _entiteitFormModel.Password); await UserManager.AddClaimAsync(entiteitUser, new Claim(ClaimTypes.Role, "entiteit")); Navigation.NavigateTo("/Admin/Entiteit/Overzicht/Create"); } else { _userAlreadyExists = true; } }
public void ChangePerson(Persoon changedPerson, IEnumerable <string> selectedOrganisations, HttpPostedFileBase ImageFile) { initNonExistingRepo(false); Persoon toUpdated = GetPerson(changedPerson.EntiteitId); //Remove all references toUpdated.Organisations = new List <Organisatie>(); if (ImageFile != null) { EntiteitRepository repo = new EntiteitRepository(); toUpdated.Image = repo.ConvertToBytes(ImageFile); } //Add new References foreach (string oId in selectedOrganisations) { toUpdated.Organisations.Add(GetOrganisatie(Int32.Parse(oId))); } toUpdated.FirstName = changedPerson.FirstName; toUpdated.LastName = changedPerson.LastName; entiteitRepository.UpdatePerson(toUpdated); }
protected override void OnInitialized() { base.OnInitialized(); _entiteit = EntiteitRepository.GetByEmail(UserManager.GetUserName(HttpContextAccessor.HttpContext.User)); Afwezigheden = AfwezigheidRepository.GetByEntiteit(_entiteit.Id); }