Beispiel #1
0
        public void FedApprovalRequiredIssue()
        {
            // test using database
            FundingProcessor processor = new FundingProcessor();
            FundingSummary   summary   = processor.AcceptFunding(409, "Federal", 500m);

            Assert.IsTrue(summary.FederalApprovalRequired);
        }
Beispiel #2
0
        public void FedApprovalRequiredIssue()
        {
            // test using mock
            FundingProcessor processor = new FundingProcessor(new MockFundingRepository());
            FundingSummary   summary   = processor.AcceptFunding(409, "Federal", 500m);

            Assert.IsTrue(summary.FederalApprovalRequired);
        }
 /// <summary>
 /// The on step async.
 /// </summary>
 /// <param name="stepName">
 /// The step name.
 /// </param>
 /// <returns>
 /// The <see cref="Task"/>.
 /// </returns>
 public override async Task OnStepAsync(object stepName)
 {
     this._CurrentEnumStep = (EnumStep)Enum.Parse(typeof(EnumStep), stepName.ToString());
     switch (this._CurrentEnumStep)
     {
         case EnumStep.Start:
             this.SetBusyAction(LoadingText);
             this.ActiveViewModel = this;
             this.TrancheSummary = await FundingFunctions.GetAllTranchesAsync();
             
             if (this.NewTrancheViewModel == null)
             { 
                 this.NewTrancheViewModel = new NewTrancheViewModel(this); 
             }
             if (this.ExistingTrancheViewModel == null)
             {
                 this.ExistingTrancheViewModel = new ExistingTrancheViewModel(this);
             }
             this.ResetBusyAction();
             break;
         case EnumStep.SelectTranche:
             this.SetBusyAction(LoadingText);
             await this.ExistingTrancheViewModel.SetTrancheIdAsync(this.SelectedTranche.TrancheId);
             this.FundingDetails = this.ExistingTrancheViewModel;
             this.FundingDetails.ListErrorHyperlink.Clear();
             this.FundingDetails.IsConfirmError = false;
             this.ActiveViewModel = this.FundingDetails;
             await this.FundingDetails.OnStepAsync(ExistingTrancheViewModel.EnumStep.TrancheSelected);
             this.ResetBusyAction();
             this.RaiseActionsWhenChangeStep(EnumScreen.FundingSummary, EnumStep.SelectTranche, this.SelectedTranche);
             break;
         case EnumStep.CreateNew:
             this.RaiseActionsWhenChangeStep(EnumScreen.FundingSummary,EnumStep.CreateNew);
             this.FundingDetails = this.NewTrancheViewModel;
             this.FundingDetails.IsConfirmError = false;
             await this.NewTrancheViewModel.OnStepAsync(EnumStep.Start);
             this.ActiveViewModel = this.FundingDetails;
             break;
         case EnumStep.TrancheSaved:
             this.SelectedTranche.FunderName = this.FundingDetails.SelectedFunder.Text;
             break;
         case EnumStep.TrancheAdded:
             this.TrancheSummary = await FundingFunctions.GetAllTranchesAsync();
             await this.ExistingTrancheViewModel.SetTrancheIdAsync(this.AddedTrancheId);
             this._SelectedTranche = this.TrancheSummary.FirstOrDefault(x => x.TrancheId == this.AddedTrancheId);
             this.FundingDetails = this.ExistingTrancheViewModel;
             this.ActiveViewModel = this.FundingDetails;
             await this.FundingDetails.OnStepAsync(ExistingTrancheViewModel.EnumStep.TrancheSelected);
             break;
     }
     this.SetActionCommandsAsync();
     this.OnStepChanged(_CurrentEnumStep.ToString());
 }
        /// <summary>
        /// The set selected tranche async.
        /// </summary>
        /// <param name="value">
        /// The value.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        private async Task SetSelectedTrancheAsync(FundingSummary value)
        {
            bool canProceed = true;
            if (this.FundingDetails != null && this.FundingDetails.IsCheckedOut && this.FundingDetails.IsChanged)
            {
                ConfirmationWindowView confirm = new ConfirmationWindowView();
                ConfirmmationViewModel confirmViewModel = new ConfirmmationViewModel();
                confirmViewModel.Content = "Changes have not been saved. Click OK to proceed without saving changes.";
                confirmViewModel.Title = "Confirm Save - Funding";
                confirm.DataContext = confirmViewModel;

                confirm.ShowDialog();
                if (confirm.DialogResult == false)
                {
                    canProceed = false;
                }
            }
            if (canProceed)
            {
                this.SetField(ref _SelectedTranche, value, () => SelectedTranche);
                if (value != null)
                {
                    if (this.FundingDetails != null)
                    {
                        Application.Current.Dispatcher.InvokeAsync(new Action(async () => await this.FundingDetails.UnlockAsync()));
                    }
                    await this.OnStepAsync(EnumStep.SelectTranche);
                }
            }
        }