Exemplo n.º 1
0
        private async void DoRemoveUser()
        {
            if (SelectedUser == null)
            {
                MessageBox.Show("Please select a row first");
                return;
            }

            var confirmMessage = $"Are you sure you want to remove {SelectedUser.FullName()} from the system?" +
                                 $"Warning! this action will remove any related data to this user.";

            if (!ImHereMessageBox.ShowYesNo("Remove User", confirmMessage))
            {
                return;
            }

            var success  = true;
            var errorMsg = "";

            try
            {
                await SelectedUser.RemoveFromAllCommitteesAsync(AppModel);

                AppModel.BasicUsers.Remove(SelectedUser);
                _fullUsersList.Remove(SelectedUser);

                await AppModel.SaveChangesAsync();
            }
            catch (Exception e)
            {
                success  = false;
                errorMsg = e.Message;
            }

            if (success)
            {
                return;
            }
            ImHereMessageBox.ShowError("Error deleting row!", errorMsg);
        }
Exemplo n.º 2
0
        private async void DoRemoveUser()
        {
            if (SelectedMember == null)
            {
                MessageBox.Show("Please select a row first");
                return;
            }

            var confirmMessage = $"Are you sure you want to remove {SelectedMember.FullName()} from committee?";

            if (!ImHereMessageBox.ShowYesNo("Remove Member", confirmMessage))
            {
                return;
            }

            var success  = true;
            var errorMsg = "";

            try
            {
                MembersList.Remove(SelectedMember);
                CurrentCommittee.Members = MembersList;
                AppModel.Entry(CurrentCommittee).State = EntityState.Modified;
                await AppModel.SaveChangesAsync();
            }
            catch (Exception e)
            {
                success  = false;
                errorMsg = e.Message;
            }

            if (success)
            {
                return;
            }
            ImHereMessageBox.ShowError("Error deleting row!", errorMsg);
        }
Exemplo n.º 3
0
        private async void DoRemoveActivity()
        {
            if (SelectedActivity == null)
            {
                MessageBox.Show("Please select a row first");
                return;
            }

            var confirmMessage = $"Are you sure you want to remove this activity from committee activities?";

            if (!ImHereMessageBox.ShowYesNo("Remove Activity", confirmMessage))
            {
                return;
            }

            var success  = true;
            var errorMsg = "";

            try
            {
                AppModel.CommitteeActivities.Remove(SelectedActivity);
                ActivityList.Remove(SelectedActivity);
                await AppModel.SaveChangesAsync();
            }
            catch (Exception e)
            {
                success  = false;
                errorMsg = e.Message;
            }

            if (success)
            {
                return;
            }
            ImHereMessageBox.ShowError("Error deleting row!", errorMsg);
        }
Exemplo n.º 4
0
        private async void DoRemoveDoc()
        {
            if (SelectedDocument == null)
            {
                MessageBox.Show("Please select a row first");
                return;
            }

            var confirmMessage = $"Are you sure you want to remove {SelectedDocument.Name} from committee documents?";

            if (!ImHereMessageBox.ShowYesNo("Remove Document", confirmMessage))
            {
                return;
            }

            var success  = true;
            var errorMsg = "";

            try
            {
                AppModel.CommitteeDocuments.Remove(SelectedDocument);
                DocumentsList.Remove(SelectedDocument);
                await AppModel.SaveChangesAsync();
            }
            catch (Exception e)
            {
                success  = false;
                errorMsg = e.Message;
            }

            if (success)
            {
                return;
            }
            ImHereMessageBox.ShowError("Error deleting row!", errorMsg);
        }
Exemplo n.º 5
0
        private async void DoRemoveDonation()
        {
            if (SelectedDonation == null)
            {
                MessageBox.Show("Please select a row first");
                return;
            }

            var confirmMessage = $"Are you sure you want to remove thisdonation from orginization donations?";

            if (!ImHereMessageBox.ShowYesNo("Remove Donation", confirmMessage))
            {
                return;
            }

            var success  = true;
            var errorMsg = "";

            try
            {
                AppModel.Donations.Remove(SelectedDonation);
                UserDonationsList.Remove(SelectedDonation);
                await AppModel.SaveChangesAsync();
            }
            catch (Exception e)
            {
                success  = false;
                errorMsg = e.Message;
            }

            if (success)
            {
                return;
            }
            ImHereMessageBox.ShowError("Error deleting row!", errorMsg);
        }