private void LoadData()
        {
            AppModel.Entry(CurrentCommittee).State = EntityState.Unchanged;
            var fetchedExpenssesFromServer = CurrentCommittee.CommitteeExpenses.ToList();

            ExpenssesList = new ObservableCollection <CommitteeExpens>(CurrentCommittee.CommitteeExpenses);
        }
        private void LoadData()
        {
            AppModel.Entry(CurrentCommittee).State = EntityState.Unchanged;
            var fetchedReportsFromServer = CurrentCommittee.Activities.ToList();

            ActivityList = new ObservableCollection <CommitteeActivity>(fetchedReportsFromServer);
        }
        private int?GetCommitteeTotalExpensess()
        {
            int?totalExpensses = null;

            AppModel.Entry(CurrentCommittee).State = EntityState.Unchanged;
            totalExpensses = CurrentCommittee?.CommitteeExpenses?.Sum(exp => exp.Amount);
            return(totalExpensses);
        }
Exemple #4
0
        private void LoadData()
        {
            AppModel.Entry(CurrentCommittee).State = EntityState.Unchanged;
            var fetchedMembersFromServer = CurrentCommittee.Members.ToList();

            MembersList         = new ObservableCollection <MemberUser>(fetchedMembersFromServer);
            CommitteeBudgetText = GetBudgetText;
        }
        private int?GetReportsFromPastMonth()
        {
            int?totalActvitiesFromPastMonth = null;

            AppModel.Entry(CurrentCommittee).State = EntityState.Unchanged;
            totalActvitiesFromPastMonth            =
                CurrentCommittee?.Activities?.Count(activity => activity.ReportedDate >= DateTime.Today.AddDays(-30));
            return(totalActvitiesFromPastMonth);
        }
        private async void LoadData()
        {
            if (AppModel == null)
            {
                return;
            }

            AppModel.Entry(CurrentCommittee).State = EntityState.Unchanged;
            var fetchedDocsFromServer = CurrentCommittee.CommitteeDocuments.ToList();

            DocumentsList = new ObservableCollection <CommitteeDocument>(fetchedDocsFromServer);
        }
Exemple #7
0
        private async void AddMemberToCommittee()
        {
            try
            {
                var member = SelectedUser as MemberUser;
                member.MemberOf.Add(CurrentCommittee);
                AppModel.Entry(SelectedUser).State = EntityState.Modified;
                AppModel.SaveChanges();

                OnSuccess?.Invoke(member);
                MessengerInstance.Send(new ClosePopUpMessage(null));
            }
            catch (Exception e)
            {
                ImHereMessageBox.ShowError("Error Adding New Entry", e.Message);
            }
        }
Exemple #8
0
        public async void LoadData()
        {
            if (UserHasExecutivePrivlliges)
            {
                await AppModel.Donations.LoadAsync();

                await AppModel.BasicUsers.LoadAsync();

                UserDonationsList = AppModel.Donations.Local;
            }
            else
            {
                AppModel.Entry(CurrentUser).State = EntityState.Unchanged;
                UserDonationsList = new ObservableCollection <Donation>(CurrentUser.Donations);
            }
            TotatDonationsAmount = UserDonationsList.Sum(d => d.Amount).ToString();
            LastDonationDate     = GetLastDonation()?.Date.ToLongDateString() ?? EmptyNumbersString;
        }
Exemple #9
0
        protected async void AddNewEntityToSet()
        {
            if (!IsFormValid())
            {
                ImHereMessageBox.ShowError("Validation Errors", $"{Title} Form still has some errors!");
                return;
            }
            try
            {
                AppModel.Set <T>().Add(NewEntity);
                AppModel.SaveChanges();
                AppModel.Entry(NewEntity).State = EntityState.Detached;

                OnSuccess?.Invoke(NewEntity);
                MessengerInstance.Send(new ClosePopUpMessage(null));
            }
            catch (Exception e)
            {
                ImHereMessageBox.ShowError("Error Adding New Entry", e.Message);
            }
        }
Exemple #10
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);
        }
Exemple #11
0
 private async void SetNewBuget(int newBudget)
 {
     CurrentCommittee.CurrentYearBudget     = newBudget;
     AppModel.Entry(CurrentCommittee).State = EntityState.Modified;
     await AppModel.SaveChangesAsync();
 }