private void ConfirmButton_Click(object sender, EventArgs e) { AccountManagement am = new AccountManagement(); am.ChangePassword(accountId, passwordBox.Text); this.Close(); // wylacz okno }
// wybranie obiektu z listy private void AccountList_Click(object sender, EventArgs e) { if (AccountList.SelectedItem != null) { // Console.WriteLine("Wybrano " + AccountList.SelectedItem.ToString()); AccountManagement am = new AccountManagement(); availableEvents = am.GetEventMap(); int id = getIdOfSelectedAccount(); showUserEvents(id); } }
// klikniecie przycisku 'refresh' private void button1_Click(object sender, EventArgs e) { AccountManagement am = new AccountManagement(); AccountList.BeginUpdate(); AccountList.Items.Clear(); foreach (Account acc in am.GetAllAccounts()) { AccountList.Items.Add(acc.id + " - " + acc.login + " - " + acc.email + " - " + acc.type.ToString()); } AccountList.EndUpdate(); }
// przycisk odrzucania zapisu private void RejectBtn_Click(object sender, EventArgs e) { int id = getIdOfSelectedEvent(); if (id != -1) { AccountManagement am = new AccountManagement(); am.SetConfirmation(id, "no"); int accId = getIdOfSelectedAccount(); showUserEvents(accId); } }
// przycisk 'delete' private void DeleteButton_Click(object sender, EventArgs e) { // pobierz ID zaznaczonego obiektu int id = getIdOfSelectedAccount(); if (id != -1) { AccountManagement am = new AccountManagement(); am.DeleteAccountByID(id); AccountList.BeginUpdate(); AccountList.Items.Remove(AccountList.SelectedItem); AccountList.EndUpdate(); } }
// wyswietl wydarzenia dla danego konta private void showUserEvents(int id) { AccountManagement am = new AccountManagement(); EventList.BeginUpdate(); EventList.Items.Clear(); // wyczysc liste // wstaw do niej wszystkie wydarzenia uzytkownika foreach (EventRegistration er in am.GetEventRegistrationList(id)) { EventItem eventItem = availableEvents[er.eventId]; EventList.Items.Add(er.eventRegistrationId + " - " + eventItem.name + " - " + er.foodType + " - " + er.type + " - " + er.confirmation); } EventList.EndUpdate(); }