public async Task ShowExpenseReportAsync(ExpenseReportViewModel expenseReportViewModel)
        {
            await DependencyService.Get <IViewService>().ExecuteBusyActionAsync(
                async() =>
            {
                var serviceFactory = DependencyService.Get <IServiceFactory>();
                //TODO:
                expenseReportViewModel.EmployeeId = App.EmployeeId;

                var editReportVM = new EditExpenseReportViewModel(serviceFactory)
                {
                    ExpenseReport = expenseReportViewModel,
                };
                AddChargesViewModel addChargesVM = new AddChargesViewModel(serviceFactory);
                await addChargesVM.LoadChargesAsync();
                editReportVM.AddCharges = addChargesVM;

                ExpenseReportChargesViewModel associatedChargesVM = new ExpenseReportChargesViewModel(serviceFactory);
                await associatedChargesVM.LoadChargesAsync(expenseReportViewModel.ExpenseReportId);
                editReportVM.AssociatedCharges = associatedChargesVM;

                await Navigation?.PushAsync(new ExpenseReportDetailPage()
                {
                    ViewModel = editReportVM
                }, true);
            });
        }
Esempio n. 2
0
        void ExpenseReportsView_ShowExpenseReport(object sender, EventArgs e)
        {
            if (sender == null)
            {
                return;
            }
            DevExpress.Mvvm.IDialogService service = ViewReportDialogService;
            ExpenseReportViewModel         expenseReportViewModel = (ExpenseReportViewModel)sender;

            var editReportVM = new EditExpenseReportViewModel();

            editReportVM.ExpenseReport = expenseReportViewModel;

            AddChargesViewModel addChargesVM = new AddChargesViewModel();

            addChargesVM.LoadCharges();
            editReportVM.AddCharges = addChargesVM;

            ExpenseReportChargesViewModel associatedChargesVM = new ExpenseReportChargesViewModel();

            associatedChargesVM.LoadCharges(expenseReportViewModel.ExpenseReportId);
            editReportVM.AssociatedCharges = associatedChargesVM;

            List <UICommand> commands = new List <UICommand>();

            if (DataContext is ApproveExpenseReportsViewModel)
            {
                ICommand approveCommand = new DelegateCommand <CancelEventArgs>(x => {
                    //if(ApproveDialogService.ShowDialog(MessageBoxButton.OKCancel, "Confirm expense report", null) == MessageBoxResult.OK) {
                    expenseReportViewModel.ApproveReportCommand.Execute(null);
                    //} else {
                    //    x.Cancel = true;
                    //}
                });
                commands.Add(new UICommand(null, "Approve", approveCommand, true, false));
            }
            if (editReportVM.CanSubmit)
            {
                commands.Add(new UICommand(null, "Submit", expenseReportViewModel.SubmitReportCommand, true, false));
            }

            UICommand cancelCommand = new UICommand(null, "Close", null, false, true);

            commands.Add(cancelCommand);


            if (service.ShowDialog(commands, expenseReportViewModel.Purpose + " report", editReportVM) != cancelCommand)
            {
                expenseReportViewModel.ExpenseReportsViewModel.OnExpenseReportApproved(editReportVM);
            }
        }
Esempio n. 3
0
        public void ShowExpenseReport(ExpenseReportViewModel expenseReportViewModel)
        {
            var editReportVM = new EditExpenseReportViewModel();

            editReportVM.ExpenseReport = expenseReportViewModel;

            AddChargesViewModel addChargesVM = new AddChargesViewModel();

            addChargesVM.LoadCharges();
            editReportVM.AddCharges = addChargesVM;

            ExpenseReportChargesViewModel associatedChargesVM = new ExpenseReportChargesViewModel();

            associatedChargesVM.LoadCharges(expenseReportViewModel.ExpenseReportId);
            editReportVM.AssociatedCharges = associatedChargesVM;

            this.CurrentViewModel = editReportVM;
        }
Esempio n. 4
0
        public async void ShowExpenseReportAsync(ExpenseReportViewModel expenseReportViewModel)
        {
            await this.ViewService.ExecuteBusyActionAsync(
                async() =>
            {
                var editReportVM           = new EditExpenseReportViewModel();
                editReportVM.ExpenseReport = expenseReportViewModel;

                AddChargesViewModel addChargesVM = new AddChargesViewModel();
                await addChargesVM.LoadChargesAsync();
                editReportVM.AddCharges = addChargesVM;

                ExpenseReportChargesViewModel associatedChargesVM = new ExpenseReportChargesViewModel();
                await associatedChargesVM.LoadChargesAsync(expenseReportViewModel.ExpenseReportId);
                editReportVM.AssociatedCharges = associatedChargesVM;

                this.CurrentViewModel = editReportVM;
            });
        }