Example #1
0
        private async Task Load()
        {
            Transactions.Clear();
            var service = new EnvelopeManager();

            Envelope = await service.GetEnvelopeDetailsWithTransactionAsync(envelopeID);

            Income  = 0;
            Expense = 0;
            foreach (var item in Envelope.Transactions)
            {
                if (item.Type == false)
                {
                    Expense += item.Value;
                }
                else if (item.Type == true)
                {
                    Income += item.Value;
                }
                Transactions.Add(item);
            }
            EnvelopeName    = Envelope.Name;
            EnvelopeDetails = Envelope.Details;
            Income         += Envelope.Value;
            remaining       = Income - Expense;
            RemainingMoney  = remaining.ToString();
            accID           = Envelope.AccountId;
        }
Example #2
0
        private async Task LoadAsync()
        {
            Envelopes.Clear();
            var service   = new EnvelopeManager();
            var envelopes = await service.GetEnvelopeByAccountAsync(accID);

            foreach (var item in envelopes)
            {
                Envelopes.Add(item);
            }
        }
Example #3
0
        public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state)
        {
            envelopeID = (int)parameter;
            var service = new EnvelopeManager();

            Envelope = await service.EditAsync(envelopeID);

            EnvelopeName      = Envelope.Name;
            EnvelopeValue     = Envelope.Value;
            EnvelopeDetails   = Envelope.Details;
            envelopeAccountID = Envelope.AccountId;

            await base.OnNavigatedToAsync(parameter, mode, state);
        }
Example #4
0
        private async void CreateAsync()
        {
            var service = new EnvelopeManager();

            Envelope el = new Envelope
            {
                Name      = EnvelopeName,
                Value     = EnvelopeValue,
                AccountId = accID,
                Details   = EnvelopeDetails
            };
            await service.CreateEnvelopeAsync(el);

            NavigationService.Navigate(typeof(EnvelopePage), accID);
        }
Example #5
0
        private async void EditAsync()
        {
            var service = new EnvelopeManager();

            Envelope el = new Envelope
            {
                Name      = EnvelopeName,
                Value     = EnvelopeValue,
                Id        = envelopeID,
                AccountId = envelopeAccountID,
                Details   = EnvelopeDetails
            };

            await service.EditEnvelopeAsync(el);

            NavigationService.Navigate(typeof(EnvelopeDetails), envelopeID);
        }
Example #6
0
        private async void DeleteAsync()
        {
            ContentDialog Delete = new ContentDialog
            {
                BorderBrush       = new SolidColorBrush(Colors.Black),
                BorderThickness   = new Thickness(1.5),
                Title             = "Delete Envelope",
                Content           = "Are you sure want to Delete " + SelectedEnvelope.Name + " Envelope?",
                CloseButtonText   = "No",
                PrimaryButtonText = "Yes"
            };
            ContentDialogResult res = await Delete.ShowAsync();

            if (res == ContentDialogResult.Primary)
            {
                var  service = new EnvelopeManager();
                bool result  = await service.DeleteEnvelopeConfirmedAsync(SelectedEnvelope.Id);
                await LoadAsync();
            }
        }
Example #7
0
        private async void DeleteConfirmation()
        {
            ContentDialog Delete = new ContentDialog
            {
                BorderBrush       = new SolidColorBrush(Colors.Black),
                BorderThickness   = new Thickness(1.5),
                Title             = "Delete Envelope",
                Content           = "Are you sure want to Delete " + EnvelopeName + " Envelope?",
                CloseButtonText   = "No",
                PrimaryButtonText = "Yes"
            };
            ContentDialogResult res = await Delete.ShowAsync();

            if (res == ContentDialogResult.Primary)
            {
                var  service = new EnvelopeManager();
                bool result  = await service.DeleteEnvelopeConfirmedAsync(envelopeID);

                NavigationService.Navigate(typeof(EnvelopePage), accID);
            }
        }