protected override void OnChangeOfFunder(SelectListViewModel value)
        {
            bool canProceed = true;

            if (value != null && _OriginalFunderId != value.Id)
            {
                if (FundingFunctions.DoesFunderHaveDefaultFilters(value.Id) == true)
                {
                    ConfirmationWindowView confirm = new ConfirmationWindowView();
                    ConfirmmationViewModel confirmViewModel = new ConfirmmationViewModel();
                    confirmViewModel.Content = "Apply filters from this Funder’s Profile? Please note that selecting Yes will remove Contracts from Tranche prior to resetting filters.";
                    confirmViewModel.Title = "Confirm select of funder";
                    confirm.DataContext = confirmViewModel;

                    confirm.ShowDialog();
                    if (confirm.DialogResult == false)
                    {
                        canProceed = false;
                    }
                }
                else
                {
                    canProceed = true;
                }
            }

            if (canProceed)
            {
                base.OnChangeOfFunder(value);
            }
        }
 protected override async Task SaveAsync()
 {
     this.SaveTrancheProfile();
     if (await FundingFunctions.DoesValidFundingTypeExistAsync() == false)
     {
         ConfirmationWindowView confirm = new ConfirmationWindowView();
         ConfirmmationViewModel confirmViewModel = new ConfirmmationViewModel();
         confirmViewModel.Content = "Valid funding type doesn't exist (required Base Funding Type = ‘Sale of Receivables’)";
         confirmViewModel.Title = "Save - Funding";
         confirm.DataContext = confirmViewModel;
         confirm.ShowDialog();
         return;
     }
     await FundingFunctions.SaveTrancheContractsAsync(
         isNew: false,
         fundingTranche: this.SelectedTrancheProfile,
         fundingStatuses: this.AllFundingStatuses.Where(s => s.IsSelected).Select(s => s.Id).ToList(),
         funders: this.AllFunders.Where(s => s.IsSelected).Select(s => s.Id).ToList(),
         financeTypes: this.AllFinanceTypes.Where(s => s.IsSelected).Select(s => s.Id).ToList(),
         internalCompanies: this.AllInternalCompanies.Where(s => s.IsSelected).Select(s => s.Id).ToList(),
         suppliers: this.AllSuppliers.Where(s => s.IsSelected).Select(s => s.Id).ToList(),
         contracts: this.IncludedInTrancheContracts.ToList());
 }
        public void ValidateAcquisitionDate(EnumRegisteredAssetStatus status)
        {
            bool depreciateInInventory = RegisteredAssetFunction.GetDepreciateInInventory();
            switch (status)
            {
                    case EnumRegisteredAssetStatus.AssetIdle:
                    if (depreciateInInventory)
                    {
                        RegisteredAssetFunction.UpdateBookDepreciation(this.AssetAcquisitionDate, this.RegisterAssetId);
                    }

                    break;
                    case EnumRegisteredAssetStatus.AssetLive:
                    DateTime contractStartDate = RegisteredAssetFunction.GetContractStartDate(this.AssetContractNum);
                    if (this.AssetAcquisitionDate <= contractStartDate)
                    {
                        ConfirmationWindowView confirm = new ConfirmationWindowView();
                        ConfirmmationViewModel confirmViewModel = new ConfirmmationViewModel();
                        confirmViewModel.Content = "Asset is live on Contract " + this.AssetContractNum + " with Start Date of " + contractStartDate + ". Please select OK to continue.";
                        confirmViewModel.Title = "Confirm - Asset Contract";
                        confirm.DataContext = confirmViewModel;

                        confirm.ShowDialog();
                    }
                    else
                    {
                        this.ShowMessageAsync("Asset is live on Contract " + this.AssetContractNum + " with Start Date of " + contractStartDate + ". Acquisition Date cannot be greater than the Contract Start Date. Please remove the Asset from the Contract or change Acquisition Date before trying again.", "Asset Contract - Error");
                    }

                    break;
                    case EnumRegisteredAssetStatus.AssetReserve:
                    DateTime? quoteStartDate = RegisteredAssetFunction.GetQuoteStartDate(this.RegisterAssetId);
                    if (this.AssetAcquisitionDate <= quoteStartDate)
                    {
                        ConfirmationWindowView confirm = new ConfirmationWindowView();
                        ConfirmmationViewModel confirmViewModel = new ConfirmmationViewModel();
                        confirmViewModel.Content = "Asset is reserved on Quote " + this.AssetContractNum + " with Start Date of " + quoteStartDate + ". Please select OK to continue.";
                        confirmViewModel.Title = "Confirm - Asset Quote";
                        confirm.DataContext = confirmViewModel;

                        confirm.ShowDialog();
                    }
                    else
                    {
                        this.ShowMessageAsync("Asset is reserved on Quote " + this.AssetContractNum + " with Start Date of " + quoteStartDate + ". Acquisition Date cannot be greater than the Quote Start Date. Please remove Asset from the Quote or change Acquisition Date before trying again.", "Asset Contract - Error");
                    }

                    break;
            }
        }
        /// <summary>
        /// The selected item changed.
        /// </summary>
        /// <param name="itemComboBox">
        /// The item combo box.
        /// </param>
        private async void ResultSearch_SelectedItemChanged(ItemComboBox itemComboBox)
        {
            ItemEquipSearch itemSearchType = this.SearchToolViewModel.ListItemResultSearch.FirstOrDefault(x => x.ItemType == SystemType.Type);
            ItemEquipSearch itemSearchMake = this.SearchToolViewModel.ListItemResultSearch.FirstOrDefault(x => x.ItemType == SystemType.Make);
            ItemEquipSearch itemSearchModel = this.SearchToolViewModel.ListItemResultSearch.FirstOrDefault(x => x.ItemType == SystemType.Model);

            List<RegisteredAssetFeatureRowItem> listFeatureItems = new List<RegisteredAssetFeatureRowItem>();

            if (itemComboBox != null)
            {
                if (itemSearchType != null)
                {
                    // Generate type items when select category.
                    if (itemComboBox.TypeItem == SystemType.Category)
                    {
                        if (this.IsCheckedOut)
                        {
                            if (this.CurrentSearchResultItem != null && itemComboBox.ItemId != this.CurrentSearchResultItem.EquipCategoryId)
                            {
                                switch (this.CurrentStateStatus)
                                {
                                    case EnumStateAndStatus.ActiveIdle:
                                        if (RegisteredAssetFunction.CheckActiveBookCanChangeWithId(this.RegisterAssetId, itemComboBox.ItemId, SystemType.Category))
                                        {
                                            this.IsChangeBookDepreciation = true;

                                            // Show window to notify if user want to change Category Depreciation Default
                                            ConfirmationWindowView confirm = new ConfirmationWindowView();
                                            ConfirmmationViewModel confirmViewModel = new ConfirmmationViewModel();
                                            confirmViewModel.Content =
                                                "Asset Category depreciation defaults may have changed. Do you wish to update the current Asset’s depreciation settings ?";
                                            confirmViewModel.Title = "Confirm Save - Asset Register";
                                            confirmViewModel.UseOkCancel = false;
                                            confirm.DataContext = confirmViewModel;

                                            confirm.ShowDialog();
                                            if (confirm.DialogResult == false)
                                            {
                                                this.IsChangeBookDepreciation = false;
                                            }
                                        }

                                        break;
                                    case EnumStateAndStatus.ActiveReturned:
                                        if (RegisteredAssetFunction.CheckActiveBookCanChangeWithId(this.RegisterAssetId, itemComboBox.ItemId, SystemType.Category))
                                        {
                                            this.IsChangeBookDepreciation = true;
                                            this.ShowMessageAsync(
                                                "Asset Category depreciation defaults may have changed. Update the current Asset’s depreciation settings if required.",
                                                "Register Asset");
                                        }

                                        break;
                                    case EnumStateAndStatus.ActiveLive:
                                        this.ShowMessageAsync(
                                                "Asset Category depreciation defaults may have changed update the current Asset’s depreciation settings if required.",
                                                "Register Asset");
                                        break;
                                    case EnumStateAndStatus.ActiveReserved:
                                        this.ShowMessageAsync(
                                                "Asset Category depreciation defaults may have changed update the current Asset’s depreciation settings if required.",
                                                "Register Asset");
                                        break;
                                    case EnumStateAndStatus.Terminated:
                                        this.ShowMessageAsync(
                                                "Asset Category depreciation defaults may have changed update the current Asset’s depreciation settings if required.",
                                                "Register Asset");
                                        break;
                                }
                            }
                            else
                            {
                                this.IsChangeBookDepreciation = false;
                            }
                        }

                        if (itemComboBox.ItemId == 0)
                        {
                            itemSearchType.ListSourceItems.ComboBoxItemList = new ObservableCollection<ItemComboBox>
                                                                            {
                                                                               new ItemComboBox { ItemId = 0, Name = "<None>", TypeItem = SystemType.Type }
                                                                            };
                            if (itemSearchMake != null)
                            {
                                itemSearchMake.ListSourceItems.ComboBoxItemList = new ObservableCollection<ItemComboBox>
                                                                            {
                                                                                new ItemComboBox { ItemId = 0, Name = "<None>", TypeItem = SystemType.Make }
                                                                            };
                                itemSearchMake.ListSourceItems.SetSelectedItem(0);
                            }

                            if (itemSearchModel != null)
                            {
                                itemSearchModel.ListSourceItems.ComboBoxItemList = new ObservableCollection<ItemComboBox>
                                                                            {
                                                                                new ItemComboBox { ItemId = 0, Name = "<None>", TypeItem = SystemType.Model }
                                                                            };

                                itemSearchModel.ListSourceItems.SetSelectedItem(0);
                            }
                        }
                        else
                        {
                            itemSearchType.ListSourceItems.ComboBoxItemList = new ObservableCollection<ItemComboBox>(await RegisteredAssetFunction.GetTypeAssignByCategory(itemComboBox.ItemId));
                            itemSearchType.ListSourceItems.ComboBoxItemList.Insert(0, new ItemComboBox { ItemId = 0, Name = "<None>", TypeItem = SystemType.Type });

                            // Get Features items for Grid feature
                            listFeatureItems.AddRange((await RegisteredAssetFunction.GetCategoryFeatureItem(itemComboBox.ItemId)).ConvertAll(x => new RegisteredAssetFeatureRowItem
                            {
                                FeatureId = x.FeatureTypeId,
                                FeatureName = x.FeatureName,
                            }));
                        }

                        itemSearchType.ListSourceItems.SetSelectedItem(0);

                        // Update data for grid Feature
                        this.AllRegisteredFeature = new ObservableCollection<RegisteredAssetFeatureRowItem>(listFeatureItems);
                        this.UpdateDataForFeatureGrid();
                    }

                        // Generate make items when select type.
                        if (itemComboBox.TypeItem == SystemType.Type)
                        {
                            if (this.IsCheckedOut)
                            {
                                if (this.CurrentSearchResultItem != null && itemComboBox.ItemId != this.CurrentSearchResultItem.EquipCategoryId)
                                {
                                    switch (this.CurrentStateStatus)
                                    {
                                        case EnumStateAndStatus.ActiveIdle:
                                            if (RegisteredAssetFunction.CheckActiveBookCanChangeWithId(this.RegisterAssetId, itemComboBox.ItemId, SystemType.Type))
                                            {
                                                this.IsChangeBookDepreciation = true;

                                                // Show window to notify if user want to change Category Depreciation Default
                                                ConfirmationWindowView confirm = new ConfirmationWindowView();
                                                ConfirmmationViewModel confirmViewModel = new ConfirmmationViewModel();
                                                confirmViewModel.Content = "Asset Type depreciation defaults may have changed. Do you wish to update the current Asset’s depreciation settings ?";
                                                confirmViewModel.Title = "Confirm Save - Asset Register";
                                                confirmViewModel.UseOkCancel = false;
                                                confirm.DataContext = confirmViewModel;

                                                confirm.ShowDialog();
                                                if (confirm.DialogResult == false)
                                                {
                                                    this.IsChangeBookDepreciation = false;
                                                }
                                            }

                                            break;
                                        case EnumStateAndStatus.ActiveReturned:
                                            if (RegisteredAssetFunction.CheckActiveBookCanChangeWithId(this.RegisterAssetId, itemComboBox.ItemId, SystemType.Type))
                                            {
                                                this.IsChangeBookDepreciation = true;
                                                this.ShowMessageAsync(
                                                    "Asset Type depreciation defaults may have changed. Update the current Asset’s depreciation settings if required.",
                                                    "Register Asset");
                                            }

                                            break;
                                        case EnumStateAndStatus.ActiveLive:
                                            this.ShowMessageAsync(
                                                    "Asset Type depreciation defaults may have changed update the current Asset’s depreciation settings if required.",
                                                    "Register Asset");
                                            break;
                                        case EnumStateAndStatus.ActiveReserved:
                                            this.ShowMessageAsync(
                                                    "Asset Type depreciation defaults may have changed update the current Asset’s depreciation settings if required.",
                                                    "Register Asset");
                                            break;
                                        case EnumStateAndStatus.Terminated:
                                            this.ShowMessageAsync(
                                                    "Asset Type depreciation defaults may have changed update the current Asset’s depreciation settings if required.",
                                                    "Register Asset");
                                            break;
                                    }
                                }
                                else
                                {
                                    this.IsChangeBookDepreciation = false;
                                }
                            }

                            if (itemComboBox.ItemId == 0)
                            {
                                if (itemSearchMake != null)
                                {
                                    itemSearchMake.ListSourceItems.ComboBoxItemList = new ObservableCollection<ItemComboBox>
                                                                           {
                                                                               new ItemComboBox { ItemId = 0, Name = "<None>", TypeItem = SystemType.Make }
                                                                           };
                                    itemSearchMake.ListSourceItems.SetSelectedItem(0);
                                }

                                if (itemSearchModel != null)
                                {
                                    itemSearchModel.ListSourceItems.ComboBoxItemList = new ObservableCollection<ItemComboBox>
                                                                           {
                                                                               new ItemComboBox { ItemId = 0, Name = "<None>", TypeItem = SystemType.Model }
                                                                           };
                                    itemSearchModel.ListSourceItems.SetSelectedItem(0);
                                }

                                // Remove Features items for Grid feature
                                listFeatureItems.AddRange((await RegisteredAssetFunction.GetTypeFeatureItem(itemComboBox.ItemId)).ConvertAll(x => new RegisteredAssetFeatureRowItem
                                {
                                    FeatureId = x.FeatureTypeId,
                                    FeatureName = x.FeatureName,
                                }));

                                foreach (var item in listFeatureItems)
                                {
                                    this.AllRegisteredFeature.Remove(this.AllRegisteredFeature.FirstOrDefault(x => x.FeatureId == item.FeatureId));
                                }
                            }
                            else
                            {
                                if (itemSearchMake != null)
                                {
                                    itemSearchMake.ListSourceItems.ComboBoxItemList = new ObservableCollection<ItemComboBox>(await RegisteredAssetFunction.GetMakeAssignByType(itemComboBox.ItemId));
                                    itemSearchMake.ListSourceItems.ComboBoxItemList.Insert(0, new ItemComboBox { ItemId = 0, Name = "<None>", TypeItem = SystemType.Make });
                                    itemSearchMake.ListSourceItems.SetSelectedItem(0);
                                }

                                // Get Features items for Grid feature
                                listFeatureItems.AddRange((await RegisteredAssetFunction.GetTypeFeatureItem(itemComboBox.ItemId)).ConvertAll(x => new RegisteredAssetFeatureRowItem
                                {
                                    FeatureId = x.FeatureTypeId,
                                    FeatureName = x.FeatureName,
                                }));

                                foreach (var item in listFeatureItems)
                                {
                                    this.AllRegisteredFeature.Add(item);
                                }

                                // Distinct data
                                this.AllRegisteredFeature = new ObservableCollection<RegisteredAssetFeatureRowItem>(this.AllRegisteredFeature.GroupBy(x => x.FeatureName).Select(x => x.First()).ToList());
                            }

                            // Update data for grid Feature
                            this.UpdateDataForFeatureGrid();
                    }

                    if (itemSearchModel != null)
                    {
                        // Generate model items when select make.
                        if (itemComboBox.TypeItem == SystemType.Make)
                        {
                            if (itemComboBox.ItemId == 0)
                            {
                                itemSearchModel.ListSourceItems.ComboBoxItemList = new ObservableCollection<ItemComboBox>
                                                                                {
                                                                                    new ItemComboBox { ItemId = 0, Name = "<None>", TypeItem = SystemType.Model }
                                                                                };
                            }
                            else
                            {
                                itemSearchModel.ListSourceItems.ComboBoxItemList = new ObservableCollection<ItemComboBox>(await RegisteredAssetFunction.GetModelAssignByMake(itemComboBox.ItemId));
                                itemSearchModel.ListSourceItems.ComboBoxItemList.Insert(0, new ItemComboBox { ItemId = 0, Name = "<None>", TypeItem = SystemType.Model });
                            }

                            itemSearchModel.ListSourceItems.SetSelectedItem(0);
                        }
                    }
                }
            }
        }
        public async Task<bool> CheckIfUnSavedChanges()
        {
            bool canProceed = true;
            if (this.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 - Collection Queue";
                confirm.DataContext = confirmViewModel;

                confirm.ShowDialog();
                if (confirm.DialogResult == false)
                {
                    canProceed = false;
                }
            }
            return canProceed;
        }
        /// <summary>
        /// Handle the action that happen on which the Queue should be refresh.
        /// </summary>
        private async void OnRefresh()
        {
            // indicated the system is loading
            this.Edit.SetBusyAction(LoadingText);
            bool canProceed = true;
            if (this.ActiveViewModel != null && !IsRefreshEdit)
            {
                //this.ActiveViewModel.ConfirmationWindow.Raise(new Insyston.Operations.WPF.ViewModels.Common.ConfirmationWindowViewModel(null) { Content = "Refreshing the collection queues will update all current collection queues. Do you wish to continue?", Title = "Confirm Refresh - Collection Queue Assignment" },
                //    (callBack) =>
                //    {
                //        if (callBack.Confirmed == false)
                //        {
                //            canProceed = false;
                //        }
                //    });
                ConfirmationWindowView confirm = new ConfirmationWindowView();
                ConfirmmationViewModel confirmViewModel = new ConfirmmationViewModel();
                confirmViewModel.Content = "Form has not been saved. Click OK to proceed without saving changes!";
                confirmViewModel.Title = "Confirm Save - Group";
                confirm.DataContext = confirmViewModel;

                confirm.ShowDialog();
                if (confirm.DialogResult == false)
                {
                    canProceed = false;
                }
            }
            if (canProceed)
            {
                await Task.WhenAll(this.PopulateAllCollectionsQueuesAssignmentAsync());
            }
            IsRefreshEdit = false;

            // Indicate we are no longer Busy
            this.Edit.ResetBusyAction();
        }
        /// <summary>
        /// The set selected model async.
        /// </summary>
        /// <param name="value">
        /// The value.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        private async Task SetSelectedModelAsync(EquipModel value)
        {
            bool canProceed = true;
            if (this.AssetModelDetail.IsCheckedOut && this.AssetModelDetail.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 - Assets Model";
                confirm.DataContext = confirmViewModel;
                confirm.ShowDialog();
                if (confirm.DialogResult == false)
                {
                    canProceed = false;
                }
                else
                {
                    this.AssetModelDetail.IsChanged = false;
                }
            }

            if (canProceed)
            {
                this.ValidateNotError();
                this.AssetModelDetail.IsChanged = false;
                this.AssetModelDetail.IsCheckedOut = false;
                this.SetEnableComboBox(false);
                if (value != null && !value.IsNewModel)
                {
                    if (this.SelectedModel != null)
                    {
                        await this.UnLockAsync();
                        this.IsAdd = false;
                    }
                }

                this.SetField(ref this._selectedModel, value, () => this.SelectedModel);
                this.AssetModelDetail.ResetSelectedComboBox();
                if (this.SelectedModel != null)
                {
                    this.AssetModelDetail.ModelDescription = this.SelectedModel.Description;
                    this.AssetModelDetail.ModelEnabled = this.SelectedModel.Enabled;
                    this.AssetModelDetail.ModelId = this.SelectedModel.EquipModelId;
                }

                if (value != null)
                {
                    if (this.StepChanged != null)
                    {
                        this.StepChanged("DetailState");
                        await this.OnStepAsync(Asset.EnumSteps.SelectModel);
                    }
                }

                this.Validate();
                this.SelectedItem = this.SelectedModel;
            }
        }
        public void CancelCommandExecuted(object parameter)
        {
            if (EventCancelCommand != null)
            {
                bool canProceed = true;
                if (this.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 - Collection Assignment";
                    confirm.DataContext = confirmViewModel;

                    confirm.ShowDialog();
                    if (confirm.DialogResult == false)
                    {
                        canProceed = false;
                    }
                }
                if (canProceed)
                {
                    this.isCheckedOut = false;
                    this.IsChanged = false;
                    EventCancelCommand(parameter, null);
                }
            }
        }
Exemplo n.º 9
0
        private async Task SetSelectedGroupAsync(GroupDetails value)
        {
            bool canProceed = true;

            if (this.ActiveViewModel != null && this.ActiveViewModel.IsCheckedOut && this.isChanged)
            {
                //this.ActiveViewModel.ConfirmationWindow.Raise(new Insyston.Operations.WPF.ViewModels.Common.ConfirmationWindowViewModel(null) { Content = "Are you sure to proceed without saving?", Title = "Confirm Save - Group" },
                //    (callBack) =>
                //    {
                //        if (callBack.Confirmed == false)
                //        {
                //            canProceed = false;
                //        }
                //    });
                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 - Group";
                confirm.DataContext = confirmViewModel;

                confirm.ShowDialog();
                if (confirm.DialogResult == false)
                {
                    canProceed = false;
                }
                else
                {
                    this.isChanged = false;
                }
            }
            if (canProceed)
            {
                if (this.Edit.IsCheckedOut)
                {
                    await this.Edit.OnStepAsync(EnumSteps.Cancel);
                }

                // Raise event to change style for hyperlink when select another record.
                this.ValidateNotError();
                this.isChanged = false;

                // Just do UnLockAsync if not in mode Add.
                if (value != null && !value.IsNewGroup)
                {
                    await UnLockAsync();
                }

                this.SetField(ref _SelectedGroup, value, () => SelectedGroup);

                if (this._SelectedGroup != null)
                {
                    this._SelectedGroup.ComponentPermissionChanged += this.Edit.SelectedGroup_ComponentPermissionChanged;
                    this._SelectedGroup.ComponentPermissionChanged += () => { this.OnPropertyChanged(() => SelectedComponentPermissionOption); };
                }

                if (value != null)
                {
                    await this.OnStepAsync(EnumSteps.SelectGroup);
                }
            }
        }
        /// <summary>
        /// The check if un saved changes.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        private bool CheckIfUnSavedChanges()
        {
            bool canProceed = true;
            if (this.AssetModelDetail.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 - Assets Model";
                confirm.DataContext = confirmViewModel;
                confirm.ShowDialog();
                if (confirm.DialogResult == false)
                {
                    canProceed = false;
                }
            }

            return canProceed;
        }
        /// <summary>
        /// The set selected collateral classes.
        /// </summary>
        /// <param name="value">
        /// The value.
        /// </param>
        private async void SetSelectedCollateralClasses(PPSRCollateralClass value)
        {
            bool canProceed = true;

            if (this.IsCheckedOut && this.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 - Asset Collateral";
                confirm.DataContext = confirmViewModel;

                confirm.ShowDialog();
                if (confirm.DialogResult == false)
                {
                    canProceed = false;
                }
                else
                {
                    this.IsChanged = false;
                }
            }

            if (canProceed)
            {
                // Raise event to change style for hyperlink when select another record.
                this.ValidateNotError();
                this.IsChanged = false;
                this.IsCheckedOut = false;
                this.SetIsCheckedOut();

                // Just do UnLockAsync if not in mode Add.
                if (value != null)
                {
                    if (this.SelectedCollateral != null)
                    {
                        await this.UnLockBulkUpdateAssetFeaturesAsync();
                    }
                }

                this.SetField(ref this._selectedCollateral, value, () => this.SelectedCollateral);
                if (value != null)
                {
                    this.SetValueForMappedTo();
                    await this.OnStepAsync(Asset.EnumSteps.SelectedCollateral);
                }
            }
        }
        /// <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);
                }
            }
        }
        /// <summary>
        /// The set selected register async.
        /// </summary>
        /// <param name="value">
        /// The value.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public async Task SetSelectedRegisterAsync(AssetRegisterRowItem value)
        {
            bool canProceed = true;
            if (this.AssetRegistersDetailViewModel.IsCheckedOut && this.AssetRegistersDetailViewModel.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 - Assets Register";
                confirm.DataContext = confirmViewModel;
                confirm.ShowDialog();
                if (confirm.DialogResult == false)
                {
                    canProceed = false;
                }
                else
                {
                    this.AssetRegistersDetailViewModel.IsChanged = false;
                }
            }

            if (canProceed)
            {
                this.ValidateNotError();
                this.AssetRegistersDetailViewModel.IsChanged = false;
                this.AssetRegistersDetailViewModel.IsCheckedOut = false;
                if (value != null)
                {
                    if (this.SelectedRegister != null)
                    {
                        await this.UnLockAsync();
                        this.IsAdd = false;
                    }
                }

                this.SetField(ref this._selectedRegister, value, () => this.SelectedRegister);
                if (value != null)
                {
                    if (this.StepChanged != null && this._currentEnumStep != Asset.EnumSteps.EditRegisterSummary)
                    {
                        await this.OnStepAsync(Asset.EnumSteps.SelectRegister);
                    }
                }

                this.Validate();
            }
        }
        public override async Task OnStepAsync(object stepName)
        {
            this.CurrentStep = (EnumStep)Enum.Parse(typeof(EnumStep), stepName.ToString());

            switch (this.CurrentStep)
            {
                case EnumStep.TrancheSelected:
                    this._Failures.Clear();
                    this.MainViewModel.ValidateNotError();
                    await PopulateTrancheProfile();
                    this.IsChanged = false;
                    this.IsError = false;
                    this.IsFundingDateInvalid = false;
                    this.SelectedTrancheProfile.PropertyChanged -= this.SelectedTrancheProfile_PropertyChanged;
                    this.SelectedTrancheProfile.PropertyChanged += this.SelectedTrancheProfile_PropertyChanged;
                    this.TrancheDateText = this.SelectedTrancheProfile.TrancheDate;
                    break;
                case EnumStep.Edit:
                    if ((TrancheStatus)FundingFunctions.GetFundingTrancheStatus(this.SelectedTrancheProfile.TrancheId)
                        != TrancheStatus.Confirmed)
                    {
                        if (await this.LockAsync())
                        {
                            // Remove errors about confirm or edit a record confirmed.
                            CustomHyperlink error1 = this.MainViewModel.ListErrorHyperlink.FirstOrDefault(x => x.HyperlinkHeader.Contains("Only Pending record is allowed to edit"));
                            CustomHyperlink error2 = this.MainViewModel.ListErrorHyperlink.FirstOrDefault(x => x.HyperlinkHeader.Contains("Only one Confirmed record per Contract is allowed"));
                            if (!this.IsConfirmError || error1 != null || error2 != null)
                            {
                                if (this.MainViewModel.ListErrorHyperlink.Count > 1)
                                {
                                    if (error1 != null && error2 != null)
                                    {
                                        if (this.MainViewModel.ListErrorHyperlink.Count == 2)
                                        {
                                            this.IsConfirmError = false;
                                            this.MainViewModel.ClearNotifyErrors();
                                            this.MainViewModel.ListErrorHyperlink.Clear();
                                            this.IsError = false;
                                            this.MainViewModel.ValidateNotError();
                                        }
                                        else
                                        {
                                            this.MainViewModel.ListErrorHyperlink.Remove(error1);
                                            this.MainViewModel.ListErrorHyperlink.Remove(error2);
                                        }
                                    }
                                    else
                                    {
                                        if (error1 != null)
                                        {
                                            this.MainViewModel.ListErrorHyperlink.Remove(error1);
                                        }

                                        if (error2 != null)
                                        {
                                            this.MainViewModel.ListErrorHyperlink.Remove(error2);
                                        }
                                    }
                                }
                                else
                                {
                                    this.IsConfirmError = false;
                                    this.MainViewModel.ClearNotifyErrors();
                                    this.MainViewModel.ListErrorHyperlink.Clear();
                                    this.IsError = false;
                                    this.MainViewModel.ValidateNotError();
                                }
                                this._Failures.Clear();
                                this.IsFundingDateInvalid = false;
                            }

                            this.MainViewModel.RaiseActionsWhenChangeStep(EnumScreen.FundingSummary, EnumSteps.Edit);
                            this.BusyContent = "Please Wait Loading ...";
                            this.IsBusy = true;


                            this.IsCheckedOut = false;
                            await PopulateTrancheProfile();
                            if (this.IsConfirmError)
                            {
                                await this.BuildBaseQueryNotIncludedAsync();
                            }
                            else
                            {
                                await this.BuildBaseQueryAsync();
                            }
                            this.IsCheckedOut = true;
                            this.CurrentStep = EnumStep.Edit;
                            this.IsChanged = false;

                            // Store the list of selected contract to set list inclucded contract turn to origin when changing FundingDate.
                            List<TrancheContractSummary> _includedInTrancheContracts = new List<TrancheContractSummary>();

                            foreach (var item in this.IncludedInTrancheContracts)
                            {
                                _includedInTrancheContracts.Add(new TrancheContractSummary
                                                                    {
                                                                        FrequencyId = item.FrequencyId,
                                                                        FinanceTypeId = item.FinanceTypeId,
                                                                        FundingStatus = item.FundingStatus,
                                                                        InstalmentType = item.InstalmentType,
                                                                        InternalCompanyId = item.InternalCompanyId,
                                                                        SupplierId = item.SupplierId,
                                                                        Term = item.Term,
                                                                        StartDate = item.StartDate,
                                                                        InvestmentBalance = item.InvestmentBalance,
                                                                        GrossAmountOverDue = item.GrossAmountOverDue,
                                                                        ClientName = item.ClientName,
                                                                        FunderId = item.FunderId,
                                                                        ContractReference = item.ContractReference,
                                                                        ContractId = item.ContractId,
                                                                        ContractPrefix = item.ContractPrefix,
                                                                        NumberOfPayments = item.NumberOfPayments,
                                                                        FirmTermDate = item.FirmTermDate,
                                                                        IsSelected = item.IsSelected,
                                                                        IsExisting = item.IsExisting,
                                                                        FundingStartDate = item.FundingStartDate,
                                                                        IsValid = item.IsValid,
                                                                        FundingStatusId = item.FundingStatusId,
                                                                        LastPaymentDate = item.LastPaymentDate,
                                                                    });
                            }
                            this.IncludedInTrancheContractsOrigin = new List<TrancheContractSummary>(_includedInTrancheContracts.ToList());

                            this.BusyContent = string.Empty;
                            this.IsBusy = false;

                            this.SetupConfirmValidator(false);
                        }
                    }
                    else
                    {
                        if (this.MainViewModel.ListErrorHyperlink != null)
                        {
                            if (this.MainViewModel.ListErrorHyperlink.FirstOrDefault(x => x.HyperlinkHeader.Contains("Only Pending record is allowed to edit")) == null)
                            {
                                this.MainViewModel.ListErrorHyperlink.Add(new CustomHyperlink
                                {
                                    HyperlinkHeader = "Only Pending record is allowed to edit.",
                                    SelectedStyle = (Style)Application.Current.FindResource("HyperlinkLikeButton2"),
                                    Action = HyperLinkAction.None,
                                });
                                this.IsConfirmError = true;
                            }
                        }
                    }
                    break;

                case EnumStep.Cancel:
                    this.BusyContent = "Please Wait Loading ...";
                    this.IsBusy = true;
                    this.IsFundingDateError = false;
                    if (this.CheckIfUnSavedChanges())
                    {
                        this.IsConfirmError = false;
                        this.MainViewModel.RaiseActionsWhenChangeStep(EnumScreen.FundingSummary, EnumSteps.Cancel); 
                        this._Failures.Clear();
                        this.MainViewModel.ValidateNotError();
                        await this.UnLockAsync();
                        await PopulateTrancheProfile();
                        await this.BuildBaseQueryAsync();
                        await this.MainViewModel.OnStepAsync(FundingSummaryViewModel.EnumStep.SelectTranche);
                        this.IsError = false;
                        this.IsFundingDateInvalid = false;
                        this.StillError = false;
                    }
                    this.BusyContent = string.Empty;
                    this.IsBusy = false;
                    break;
                case EnumStep.Save:
                    // Set list Included Tranche to origin.
                    List<TrancheContractSummary> _includedInTrancheContractsOrigin = new List<TrancheContractSummary>();

                    foreach (var item in this.IncludedInTrancheContractsOrigin)
                    {
                        _includedInTrancheContractsOrigin.Add(new TrancheContractSummary
                        {
                            FrequencyId = item.FrequencyId,
                            FinanceTypeId = item.FinanceTypeId,
                            FundingStatus = item.FundingStatus,
                            InstalmentType = item.InstalmentType,
                            InternalCompanyId = item.InternalCompanyId,
                            SupplierId = item.SupplierId,
                            Term = item.Term,
                            StartDate = item.StartDate,
                            InvestmentBalance = item.InvestmentBalance,
                            GrossAmountOverDue = item.GrossAmountOverDue,
                            ClientName = item.ClientName,
                            FunderId = item.FunderId,
                            ContractReference = item.ContractReference,
                            ContractId = item.ContractId,
                            ContractPrefix = item.ContractPrefix,
                            NumberOfPayments = item.NumberOfPayments,
                            FirmTermDate = item.FirmTermDate,
                            IsSelected = item.IsSelected,
                            IsExisting = item.IsExisting,
                            FundingStartDate = item.FundingStartDate,
                            IsValid = item.IsValid,
                            FundingStatusId = item.FundingStatusId,
                            LastPaymentDate = item.LastPaymentDate,
                        });
                    }
                    
                    this.IncludedInTrancheContracts = new ObservableModelCollection<TrancheContractSummary>(_includedInTrancheContractsOrigin.ToList());

                    this.IsConfirmError = false;
                    this.IsFundingDateError = false;
                    this.StillError = true;
                    this.IncludedInTrancheContracts.ForEach(x => x.IsValid = true);
                    this._Failures.RemoveAll(x => x.PropertyName.EndsWith("StartDate"));
                    if (this.Validate() == true)
                    {
                        this.ClearNotifyErrors();
                        this.MainViewModel.ClearNotifyErrors();
                        this.IsFundingDateInvalid = false;
                        this.IsError = false;
                        this.MainViewModel.ListErrorHyperlink.Clear();
                        await this.SaveAsync();
                        await this.UnLockAsync();
                        this.IsChanged = false;
                        this.MainViewModel.ValidateNotError();
                        await this.MainViewModel.OnStepAsync(FundingSummaryViewModel.EnumStep.TrancheSaved);
                        this.MainViewModel.RaiseActionsWhenChangeStep(EnumScreen.FundingSummary, EnumStep.Save, this.SelectedTrancheProfile.TrancheId);
                        this.StillError = false;
                        this.TrancheDateText = this.SelectedTrancheProfile.TrancheDate;
                        await this.BuildBaseQueryAsync();
                    }
                    else
                    {
                        if (this.TrancheDateText == null)
                        {
                            this.IsFundingDateInvalid = true;
                        }
                        else
                        {
                            this.IsFundingDateInvalid = false;
                        }
                        this.SetActionCommandsAsync();
                        this.IsError = false;
                        foreach (var error in this.ListErrorHyperlink)
                        {

                            if (
                                error.HyperlinkHeader.Equals(
                                    "The new Funding Date requires selected records to be removed from the Tranche. Please check the Results page for errors.") &&
                                    this.IsFundingDateInvalid == false)
                            {
                                error.Action = HyperLinkAction.ResultState;
                            }
                        }
                        if (this.ListErrorHyperlink != null)
                        {
                            this.ListErrorHyperlink.RemoveAll(
                                x =>
                                x.HyperlinkHeader.Equals(
                                    "The new Funding Date requires selected records to be removed from the Tranche. Please check the Results page for errors."));
                        }
                        this.MainViewModel.ListErrorHyperlink = this.ListErrorHyperlink;
                        this.MainViewModel.OnErrorHyperlinkSelected();
                    }
                    break;

                case EnumStep.CreateNew:
                    this.IsError = false;
                    this.IsFundingDateInvalid = false;
                    await this.UnLockAsync();
                    await this.MainViewModel.OnStepAsync(FundingSummaryViewModel.EnumStep.CreateNew);
                    break;
                case EnumStep.FunderSelected:
                    this.IsError = false;

                    //this.IsFundingDateInvalid = false;
                    await Task.WhenAll(this.FetchDefaultFundingStatusesByFunderAsync(),
                    this.FetchDefaultFinanceTypesByFunderAsync(),
                    this.FetchDefaultInternalCompaniesByFunderAsync(),
                    this.FetchDefaultSuppliersByFunderAsync(),
                    this.FetchDefaultFundersByFunderAsync());
                    this.TrancheDateText = this.SelectedTrancheProfile.TrancheDate;
                    await this.SetDefaultsByFundingProfileAsync();

                    if (this.IsConfirmError)
                    {
                        if (this.SelectedFunder.Id != -1)
                        {
                            var itemError =
                                this.ListErrorHyperlink.FirstOrDefault(
                                    x => x.HyperlinkHeader.Contains("Cannot proceed as Funder is <None>"));
                            if (itemError != null)
                            {
                                this.ListErrorHyperlink.Remove(itemError);
                                this.MainViewModel.ListErrorHyperlink = this.ListErrorHyperlink;
                                this.MainViewModel.OnErrorHyperlinkSelected();
                                if (this.ListErrorHyperlink.Count == 0)
                                {
                                    this.IsConfirmError = false;
                                }
                                this.SetActionCommandsAsync();
                            }
                        }
                    }
                    break;
                case EnumStep.StatusToConfirmed:
                    this.SetupConfirmValidator(true);
                    this.BusyContent = "Please Wait Loading ...";
                    this.IsBusy = true;
                    this.IsError = false;
                    this.IsFundingDateInvalid = false;
                    if (await this.LockAsync())
                    {
                        this.IsCheckedOut = false;
                        await PopulateTrancheProfile();
                        await this.BuildBaseQueryAsync();

                        this.CurrentStep = EnumStep.StatusToConfirmed;
                        this.OriginalTrancheStatus = TrancheStatus.Confirmed;
                        this.IncludedInTrancheContracts.ForEach(x => x.IsValid = true);
                        if (this.Validate())
                        {
                            this.MainViewModel.ListErrorHyperlink.Clear();
                            this.MainViewModel.ValidateNotError();
                            this.IsConfirmError = false;
                            if (
                                await
                                FundingFunctions.ChangeStatusToConfirmedAsync(
                                    this.SelectedTrancheProfile,
                                    this.IncludedInTrancheContracts.ToList()))
                            {
                                this.SelectedTrancheProfile.TrancheStatusId = (int)TrancheStatus.Confirmed;
                            }
                            else
                            {
                                this.OriginalTrancheStatus =
                                    (TrancheStatus)this.SelectedTrancheProfile.TrancheStatusId;
                            }
                        }
                        else
                        {
                            // this.IsFundingDateInvalid = true;
                            this.IsConfirmError = true;
                            this.OriginalTrancheStatus = (TrancheStatus)this.SelectedTrancheProfile.TrancheStatusId;
                            this.SetActionCommandsAsync();

                            CustomHyperlink itemError =
                                this.ListErrorHyperlink.FirstOrDefault(
                                    x => x.HyperlinkHeader.Contains("Cannot proceed as there is no existing contract"));
                            if (itemError != null)
                            {
                                itemError.Action = HyperLinkAction.ResultState;
                            }

                            CustomHyperlink itemErrorInvalidContract =
                                this.ListErrorHyperlink.FirstOrDefault(
                                    x => x.HyperlinkHeader.Contains("Cannot change the status to Confirmed as there are Invalid Contracts"));
                            if (itemErrorInvalidContract != null)
                            {
                                itemErrorInvalidContract.Action = HyperLinkAction.ResultState;
                                itemErrorInvalidContract.SelectedStyle = (Style)Application.Current.FindResource("HyperlinkLikeButton");
                            }

                            if (itemErrorInvalidContract != null)
                            {
                                this.ListErrorHyperlink.RemoveAll(
                                x =>
                                x.HyperlinkHeader.Contains(
                                    "Cannot change the status to Confirmed as there are Invalid Contracts"));
                                this.ListErrorHyperlink.Add(itemErrorInvalidContract);
                            }

                            CustomHyperlink itemContractError =
                                this.ListErrorHyperlink.FirstOrDefault(
                                    x =>
                                    x.HyperlinkHeader.Contains(
                                        "Contracts are locked in Operations therefore this Tranche cannot be Confirmed"));
                            if (itemContractError != null)
                            {
                                itemContractError.Action = HyperLinkAction.None;
                                itemContractError.SelectedStyle = (Style)Application.Current.FindResource("HyperlinkLikeButton2");
                            }

                            CustomHyperlink itemErrorInvalidConfirm =
                               this.ListErrorHyperlink.FirstOrDefault(
                                   x => x.HyperlinkHeader.Contains("Only one Confirmed record per Contract is allowed."));
                            if (itemErrorInvalidConfirm != null)
                            {
                                itemErrorInvalidConfirm.Action = HyperLinkAction.None;
                                itemErrorInvalidConfirm.SelectedStyle = (Style)Application.Current.FindResource("HyperlinkLikeButton2");
                            }
                            this.MainViewModel.ListErrorHyperlink = this.ListErrorHyperlink;

                            this.MainViewModel.OnErrorHyperlinkSelected();
                            if (this.SelectedTrancheProfile.NodeId == -1)
                            {
                                this.IsError = true;
                            }
                        }
                        await this.UnLockAsync();
                    }
                    this.BusyContent = string.Empty;
                    this.IsBusy = false;
                    break;
                case EnumStep.StatusToPending:
                    this.BusyContent = "Please Wait Loading ...";
                    this.IsBusy = true;
                    if (await this.LockAsync())
                    {
                        await PopulateTrancheProfile();
                        await this.BuildBaseQueryAsync();

                        this.CurrentStep = EnumStep.StatusToPending;
                        if (await FundingFunctions.ChangeStatusToPendingAsync(this.SelectedTrancheProfile))
                        {
                            this.OriginalTrancheStatus = TrancheStatus.Pending;
                            this.SelectedTrancheProfile.TrancheStatusId = (int)TrancheStatus.Pending;
                        }
                        await this.UnLockAsync();
                    }
                    this.BusyContent = string.Empty;
                    this.IsBusy = false;
                    break;
                case EnumStep.StatusToFunded:
                    this.BusyContent = "Please Wait Loading ...";
                    this.IsBusy = true;
                    if (await this.LockAsync())
                    {
                        await PopulateTrancheProfile();
                        await this.BuildBaseQueryAsync();

                        this.CurrentStep = EnumStep.StatusToFunded;
                        this.OriginalTrancheStatus = TrancheStatus.Funded;

                        this.IncludedInTrancheContracts.ForEach(x => x.IsValid = true);
                        if (this.Validate() == true)
                        {
                            if (await FundingFunctions.ChangeStatusToFundedAsync(this.SelectedTrancheProfile, this.IncludedInTrancheContracts.ToList()) == true)
                            {
                                this.SelectedTrancheProfile.TrancheStatusId = (int)TrancheStatus.Funded;
                            }
                            else
                            {
                                this.OriginalTrancheStatus = (TrancheStatus)this.SelectedTrancheProfile.TrancheStatusId;
                            }
                        }
                        else
                        {
                            this.OriginalTrancheStatus = (TrancheStatus)this.SelectedTrancheProfile.TrancheStatusId;
                        }
                        await this.UnLockAsync();
                    }
                    this.BusyContent = string.Empty;
                    this.IsBusy = false;
                    break;
                case EnumStep.Delete:                   
                    if (await this.LockAsync())
                    {
                        bool canProceed = false;
                        ConfirmationWindowView confirm = new ConfirmationWindowView();
                        ConfirmmationViewModel confirmViewModel = new ConfirmmationViewModel();
                        confirmViewModel.Content = "Are you sure you want to delete?";
                        confirmViewModel.Title = "Delete - Funding";
                        confirm.DataContext = confirmViewModel;

                        confirm.ShowDialog();
                        if (confirm.DialogResult == false)
                        {
                            canProceed = false;
                        }
                        else
                        {
                            canProceed = true;
                        }

                        if (canProceed)
                        {
                            this.IsError = false;
                            this.IsFundingDateInvalid = false;
                            await FundingFunctions.DeleteTrancheAsync(this.SelectedTrancheProfile.TrancheId);
                            await this.UnLockAsync();
                            this.IsCheckedOut = this.MainViewModel.IsCheckedOut;
                            this.MainViewModel.OnCancelNewItem(EnumScreen.FundingSummary);
                            await this.MainViewModel.OnStepAsync(FundingSummaryViewModel.EnumStep.Start);
                            this.MainViewModel.RaiseActionsWhenChangeStep(EnumScreen.FundingSummary, EnumStep.Delete, this.SelectedTrancheProfile.TrancheId);
                            this.IsConfirmError = false;
                        }
                        else
                        {
                            await this.UnLockAsync();
                        }
                    }
                    break;
                case EnumStep.Error:
                    NotificationErrorView errorPopup = new NotificationErrorView();
                    NotificationErrorViewModel errorPopupViewModel = new NotificationErrorViewModel();
                    errorPopupViewModel.listCustomHyperlink = this.MainViewModel.ListErrorHyperlink;
                    errorPopup.DataContext = errorPopupViewModel;

                    errorPopup.Style = (Style)Application.Current.FindResource("RadWindowStyleNew");

                    errorPopup.ShowDialog();
                    break;
            }
            await base.OnStepAsync(stepName);
            if (!this.CurrentStep.Equals(EnumStep.SelectTrancheDate)
                && !this.CurrentStep.Equals(EnumStep.FunderSelected)
                && !this.CurrentStep.Equals(EnumStep.TrancheSelected))
            {
                this.SetActionCommandsAsync();
            }
        }
        /// <summary>
        /// The validate popup.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        private bool ValidatePopup()
        {
            ConfirmationWindowView confirm = new ConfirmationWindowView();
            ConfirmmationViewModel confirmViewModel = new ConfirmmationViewModel();
            confirmViewModel.Content = "Form has not been saved. Click OK to proceed without saving changes!";
            confirmViewModel.Title = "Confirm Close - Document Tab";
            confirm.DataContext = confirmViewModel;

            confirm.ShowDialog();
            if (confirm.DialogResult == false)
            {
                return false;
            }

            return true;
        }
        /// <summary>
        /// The check collateral class id.
        /// </summary>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public async Task<bool> CheckCollateralClassId()
        {
            bool canProceed = true;
            if (this.TypeDetailViewModel.OldCollateralClassId != this.TypeDetailViewModel.SelectedCollateralClassItem.ItemId && this.SelectedTypeItem.EquipTypeId != 0)
            {
                ConfirmationWindowView confirm = new ConfirmationWindowView();
                ConfirmmationViewModel confirmViewModel = new ConfirmmationViewModel();
                confirmViewModel.Content = "Changing collateral class on an equipment type will invalidate the existing PPSR registration data.  Do you wish to update all unregistered PPSR data and continue?";
                confirmViewModel.Title = "Confirm - Asset Classes Type";
                confirm.DataContext = confirmViewModel;

                confirm.ShowDialog();
                if (confirm.DialogResult == false)
                {
                    canProceed = false;
                }
            }

            return canProceed;
        }
Exemplo n.º 17
0
        /// <summary>
        /// The set selected feature type.
        /// </summary>
        /// <param name="value">
        /// The value.
        /// </param>
        private async void SetSelectedFeatureType(FeatureType value)
        {
            bool canProceed = true;

            if (this.IsCheckedOut && this.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 - Asset Features";
                confirm.DataContext = confirmViewModel;

                confirm.ShowDialog();
                if (confirm.DialogResult == false)
                {
                    canProceed = false;
                }
                else
                {
                    this.IsChanged = false;
                }
            }

            if (canProceed)
            {
                // Raise event to change style for hyperlink when select another record.
                this.ValidateNotError();
                if (this.AssetFeaturesDetailViewModel != null)
                {
                    this.AssetFeaturesDetailViewModel.ClearNotifyErrors();
                }

                this.IsChanged = false;
                this.IsCheckedOut = false;
                this.SetIsCheckedOut();

                // Just do UnLockAsync if not in mode Add.
                if (value != null && !value.IsNewFeatureType)
                {
                    if (this.SelectedFeatureType != null)
                    {
                        await this.UnLockBulkUpdateAssetFeaturesAsync();
                        this.IsAdd = false;
                    }
                }

                this.SetField(ref this._selectedFeatureType, value, () => this.SelectedFeatureType);
                if (value != null)
                {
                    await this.OnStepAsync(Asset.EnumSteps.SelectedFeatureType);
                }
            }
            else
            {
                this.CurrentStep = Asset.EnumSteps.None;
            }
        }
Exemplo n.º 18
0
        public async Task<bool> CheckIfUnSavedChanges()
        {
            if (this.OnUsersInGroupChanged != null)
            {
                this.OnUsersInGroupChanged(null, null);
            }

            bool canProceed = true;
            if (this.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 - Membership";
                confirm.DataContext = confirmViewModel;

                confirm.ShowDialog();
                if (confirm.DialogResult == false)
                {
                    canProceed = false;
                }
            }
            return canProceed;
        }
Exemplo n.º 19
0
        /// <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)
        {
            bool canProcess;
            this._currentEnumStep = (Asset.EnumSteps)Enum.Parse(typeof(Asset.EnumSteps), stepName.ToString());
            if (this._currentEnumStep != Asset.EnumSteps.DetailsState && this._currentEnumStep != Asset.EnumSteps.AssignedToState)
            {
                this.CurrentStep = this._currentEnumStep;
            }

            switch (this._currentEnumStep)
            {
                case Asset.EnumSteps.Start:
                    this.SetBusyAction(LoadingText);
                    this.ActiveViewModel = this;
                    this.IsAdd = false;
                    this.GetPermission();
                    await this.PopulateAllFeatureTypesForViewAsync();
                    this.RaiseSelectedItemChanged();
                    this.ResetBusyAction();
                    break;
                case Asset.EnumSteps.SelectedFeatureType:
                    this.SetBusyAction(LoadingText);
                    if (this.OnStoryBoardChanged != null)
                    {
                        this.OnStoryBoardChanged(Asset.EnumSteps.GridContentState.ToString());
                    }

                    this.SetGridStype(false);
                    this.SetValueForAssetFeaturesDetail(this.SelectedFeatureType);
                    await this.SetValueForAssetFeaturesAssignedTo(this.SelectedFeatureType);
                    if (this.IsCheckedOut && this.AssetFeaturesDetailViewModel.Enabled)
                    {
                        this.AssetFeaturesAssignedToViewModel.DynamicAssetCategoriesViewModel.IsEnableHoverRow = true;
                        this.AssetFeaturesAssignedToViewModel.DynamicAssetTypesViewModel.IsEnableHoverRow = true;
                    }

                    this.SetActionCommandsAsync();
                    this.RaiseActionsWhenChangeStep(EnumScreen.AssetFeatures, EnumSteps.SelectedFeatureType, this.SelectedFeatureType);
                    this.ResetBusyAction();
                    break;
                case Asset.EnumSteps.GridContentState:
                    if (this.OnStoryBoardChanged != null)
                    {
                        this.OnStoryBoardChanged(this._currentEnumStep.ToString());
                    }

                    break;
                case Asset.EnumSteps.DetailsState:
                    this.OnStepChanged(Asset.EnumSteps.DetailsState.ToString());
                    this.CurrentTab = Asset.EnumSteps.DetailsState;
                    
                    break;
                case Asset.EnumSteps.AssignedToState:
                    this.OnStepChanged(Asset.EnumSteps.AssignedToState.ToString());
                    this.CurrentTab = Asset.EnumSteps.AssignedToState;
                    break;
                case Asset.EnumSteps.GridSummaryState:
                    if (this.OnStoryBoardChanged != null)
                    {
                        this.OnStoryBoardChanged(this._currentEnumStep.ToString());
                    }

                    break;
                case Asset.EnumSteps.AssignFeatureState:
                    var items = new ObservableCollection<AssetFeatureTypeRowItem>(this.DynamicFeatureTypeViewModel.SelectedItems.Cast<AssetFeatureTypeRowItem>());
                    if (items.Count > 0)
                    {
                        bool result;
                        List<int> list = new List<int>(items.Select(x => x.FeatureTypeId));
                        result = await this.LockBulkUpdateAssetFeaturesAsync(list);
                        if (!result)
                        {
                            // Raise event to visible FormMenu if record selected is locked.
                            this.RaiseActionsWhenChangeStep(EnumScreen.AssetFeatures, EnumSteps.ItemLocked);
                            return;
                        }

                        this.IsCheckedOut = true;
                        this.SetIsCheckedOut();
                        this.SetGridStype(true);
                        var selectedFeatureTypes =
                            new ObservableCollection<AssetFeatureTypeRowItem>(
                                this.DynamicFeatureTypeViewModel.SelectedItems.Cast<AssetFeatureTypeRowItem>());
                        await
                            this.AssetFeaturesAssignFeatureViewModel.PopulateAssignFeatureDrogDrag(selectedFeatureTypes);
                        if (this.OnStoryBoardChanged != null)
                        {
                            this.OnStoryBoardChanged(this._currentEnumStep.ToString());
                        }

                        this.RaiseActionsWhenChangeStep(EnumScreen.AssetFeatures, EnumSteps.EditBulkUpdate);
                        this.SetActionCommandsAsync();
                    }
                    else
                    {
                        this.ShowMessageAsync("Select one or more record to Assign Features.", "Confirm - Asset Feature");
                        this.CurrentStep = Asset.EnumSteps.None;
                    }
                    
                    break;
                case Asset.EnumSteps.BulkUpdate:
                    this.DynamicFeatureTypeViewModel.IsEnableHoverRow = true;
                    this.IsBulkUpdate = true;
                    this.SetActionCommandsAsync();
                    break;
                case Asset.EnumSteps.Add:
                    this.IsAdd = true;
                    this.SetNewFeatureType();
                    if (this.OnStoryBoardChanged != null)
                    {
                        this.OnStoryBoardChanged(Asset.EnumSteps.GridContentState.ToString());
                    }

                    this.OnStepChanged(Asset.EnumSteps.DetailsState.ToString());
                    this.CurrentTab = Asset.EnumSteps.DetailsState;
                    this.SetValueForAssetFeaturesDetail(this.SelectedFeatureType);
                    await this.SetValueForAssetFeaturesAssignedTo(this.SelectedFeatureType);
                    this.RaiseActionsWhenChangeStep(EnumScreen.AssetFeatures, EnumSteps.Add);
                    await this.OnStepAsync(Asset.EnumSteps.Edit);
                    break;
                case Asset.EnumSteps.Edit:
                    if (this.SelectedFeatureType != null && !this.SelectedFeatureType.IsNewFeatureType)
                    {
                        this.IsAdd = false;
                        bool checkLock =
                            await
                            this.LockBulkUpdateAssetFeaturesAsync(
                                new List<int> { this.SelectedFeatureType.FeatureTypeId },
                                true);
                        if (!checkLock)
                        {
                            // Raise event to visible FormMenu if record selected is locked.
                            this.RaiseActionsWhenChangeStep(EnumScreen.AssetFeatures, EnumSteps.ItemLocked);

                            // Change background if record selected is locked when editing.
                            this.SetGridStype(false);
                            this.CurrentStep = Asset.EnumSteps.None;
                            return;
                        }
                    }

                    this.IsCheckedOut = true;
                    this.SetIsCheckedOut();
                    this.SetGridStype(true);
                    if (this.AssetFeaturesAssignedToViewModel.IsCheckedOut)
                    {
                        this.AssetFeaturesAssignedToViewModel.DynamicAssetCategoriesViewModel.IsEnableHoverRow = true;
                        this.AssetFeaturesAssignedToViewModel.DynamicAssetTypesViewModel.IsEnableHoverRow = true;
                    }

                    this.RaiseActionsWhenChangeStep(EnumScreen.AssetFeatures, EnumSteps.Edit);
                    break;
                case Asset.EnumSteps.EditBulkUpdate:
                    var item2S = new ObservableCollection<AssetFeatureTypeRowItem>(this.DynamicFeatureTypeViewModel.SelectedItems.Cast<AssetFeatureTypeRowItem>());
                    if (item2S.Count != 0)
                    {
                        this.IsBulkUpdate = true;
                        bool result;
                        List<int> list = new List<int>(item2S.Select(x => x.FeatureTypeId));
                        result = await this.LockBulkUpdateAssetFeaturesAsync(list);
                        if (!result)
                        {
                            // Raise event to visible FormMenu if record selected is locked.
                            this.RaiseActionsWhenChangeStep(EnumScreen.AssetFeatures, EnumSteps.ItemLocked);
                            return;
                        }
                    }

                    this.IsCheckedOut = true;
                    this.SetIsCheckedOut();
                    this.SetGridStype(true);
                    this.RaiseActionsWhenChangeStep(EnumScreen.AssetFeatures, EnumSteps.EditBulkUpdate);
                    break;
                case Asset.EnumSteps.SaveBulkUpdate:
                    try
                    {
                        await this.SaveFeatureBulkUpdateAsync();
                        await this.UnLockBulkUpdateAssetFeaturesAsync();
                        this.IsBulkUpdate = false;
                        this.IsCheckedOut = false;
                        this.SetIsCheckedOut();
                        this.SetGridStype(false);
                        this.IsChanged = false;
                        this.RaiseActionsWhenChangeStep(EnumScreen.AssetFeatures, EnumSteps.SaveAssignFeature);
                    }
                    catch (Exception exc)
                    {
                        ExceptionLogger.WriteLog(exc);
                        this.ShowErrorMessage("Error encountered while Saving Asset Feature Bulk Update.", "Asset Features");
                    }

                    break;
                case Asset.EnumSteps.Save:
                    try
                    {
                        this.AssetFeaturesDetailViewModel.Validate();
                        if (this.AssetFeaturesDetailViewModel.HasErrors == false)
                        {
                            this.IsAdd = false;
                            if (this.SelectedFeatureType != null && !this.SelectedFeatureType.IsNewFeatureType)
                            {
                                await this.UnLockBulkUpdateAssetFeaturesAsync();
                            }
                            else
                            {
                                this.IsCheckedOut = false;
                                this.SetIsCheckedOut();
                                this.IsChanged = false;
                            }

                            this.IsCheckedOut = false;
                            this.SetIsCheckedOut();
                            this.IsChanged = false;
                            this.SelectedFeatureType = await this.SaveFeatureAsync();
                            this.UpdateDataFeatureTypesAsync();
                            this.SelectedFeatureType.IsNewFeatureType = false;

                            this.ValidateNotError();
                            this.AllFeatureTypes = new ObservableCollection<FeatureType>(await AssetFeatureFunction.GetAllFeatureTypesAsync());
                            await this.OnStepAsync(Asset.EnumSteps.SelectedFeatureType);
                            this.RaiseActionsWhenChangeStep(EnumScreen.AssetFeatures, EnumSteps.Save, this.SelectedFeatureType.FeatureTypeId);
                        }
                        else
                        {
                            this.CurrentStep = Asset.EnumSteps.Error;
                            this.SetActionCommandsAsync();
                            this.ListErrorHyperlink = this.AssetFeaturesDetailViewModel.ListErrorHyperlink;
                            this.OnErrorHyperlinkSelected();
                        }
                    }
                    catch (Exception exc)
                    {
                        ExceptionLogger.WriteLog(exc);
                        this.ShowErrorMessage("Error encountered while Saving Asset Feature Details.", "Asset Features");
                    }

                    break;
                case Asset.EnumSteps.SaveAndAdd:
                    await this.OnStepAsync(Asset.EnumSteps.Save);
                    if (this.AssetFeaturesDetailViewModel.HasErrors == false)
                    {
                        await this.OnStepAsync(Asset.EnumSteps.Add);
                    }

                    break;
                case Asset.EnumSteps.Delete:
                    this.AssetFeaturesDetailViewModel.ClearNotifyErrors();
                    this.ValidateNotError();
                    this.Validate();
                    if (this.HasErrors == false)
                    {
                        bool canProceed = false;
                        ConfirmationWindowView confirm = new ConfirmationWindowView();
                        ConfirmmationViewModel confirmViewModel = new ConfirmmationViewModel();
                        confirmViewModel.Content = "Select OK to confirm deletion?";
                        confirmViewModel.Title = "Delete - Asset Feature";
                        confirm.DataContext = confirmViewModel;

                        confirm.ShowDialog();
                        if (confirm.DialogResult == true)
                        {
                            canProceed = true;
                        }

                        if (canProceed)
                        {
                            if (this.SelectedFeatureType != null && !this.SelectedFeatureType.IsNewFeatureType)
                            {
                                await
                                    AssetFeatureFunction.DeleteSelectedFeatureTypeAsync(
                                        this.SelectedFeatureType.FeatureTypeId);
                                await this.UnLockBulkUpdateAssetFeaturesAsync();
                                this.AllFeatureTypes =
                                   new ObservableCollection<FeatureType>(
                                       await AssetFeatureFunction.GetAllFeatureTypesAsync());
                                this.RaiseActionsWhenChangeStep(
                                    EnumScreen.AssetFeatures,
                                    EnumSteps.Delete,
                                    this.SelectedFeatureType.FeatureTypeId);
                                await this.UnLockBulkUpdateAssetFeaturesAsync();
                                this.UpdateDataFeatureTypesAsync(true);
                                this.IsCheckedOut = false;
                                this.SetIsCheckedOut();
                                this.IsChanged = false;
                                this.OnCancelNewItem(EnumScreen.AssetFeatures);
                                if (this.OnStoryBoardChanged != null)
                                {
                                    this.OnStoryBoardChanged(Asset.EnumSteps.GridSummaryState.ToString());
                                    this.CurrentStep = Asset.EnumSteps.GridSummaryState;
                                }
                            }
                        }
                        else
                        {
                            this.CurrentStep = Asset.EnumSteps.None;
                        }
                    }
                    else
                    {
                        this.CurrentStep = Asset.EnumSteps.Error;
                        this.SetActionCommandsAsync();

                        if (!_permissionFeatureAssignTo.CanSee)
                        {
                            foreach (var itemError in this.ListErrorHyperlink)
                            {
                                itemError.SelectedStyle = (Style)Application.Current.FindResource("HyperlinkLikeButton2");
                                itemError.Action = HyperLinkAction.DetailsState;
                            }
                        }
                        
                        this.OnErrorHyperlinkSelected();
                    }

                    break;
                case Asset.EnumSteps.Cancel:
                    canProcess = await this.CheckIfUnSavedChanges();
                    if (canProcess)
                    {
                        this.AssetFeaturesDetailViewModel.ClearNotifyErrors();
                        this.ValidateNotError();

                        // Just do UnLockAsync if not in mode Add.
                        if (this.SelectedFeatureType != null && !this.SelectedFeatureType.IsNewFeatureType)
                        {
                            await this.UnLockBulkUpdateAssetFeaturesAsync();
                        }
                        else
                        {
                            this.IsCheckedOut = false;
                            this.SetIsCheckedOut();
                            this.IsChanged = false;
                        }

                        this.IsCheckedOut = false;
                        this.IsChanged = false;
                        this.SetIsCheckedOut();
                        this.SetGridStype(false);
                        this.RaiseActionsWhenChangeStep(EnumScreen.AssetFeatures, EnumSteps.Cancel);
                        if (this.SelectedFeatureType == null
                            || (this.SelectedFeatureType != null && this.SelectedFeatureType.IsNewFeatureType))
                        {
                            this.OnCancelNewItem(EnumScreen.AssetFeatures);
                            if (this.OnStoryBoardChanged != null)
                            {
                                this.OnStoryBoardChanged(Asset.EnumSteps.GridSummaryState.ToString());
                                this.CurrentStep = Asset.EnumSteps.GridSummaryState;
                            }
                        }
                        else
                        {
                            this.AssetFeaturesAssignedToViewModel.DynamicAssetCategoriesViewModel.IsEnableHoverRow =
                                false;
                            this.AssetFeaturesAssignedToViewModel.DynamicAssetTypesViewModel.IsEnableHoverRow = false;
                            this.SetValueForAssetFeaturesDetail(this.SelectedFeatureType);
                            await this.SetValueForAssetFeaturesAssignedTo(this.SelectedFeatureType);
                        }
                    }
                    else
                    {
                        this.CurrentStep = Asset.EnumSteps.None;
                    }

                    break;
                case Asset.EnumSteps.CancelAssignFeature:
                    canProcess = await this.CheckIfUnSavedChanges();
                    if (canProcess)
                    {
                        // await this.UnLockAsync();
                        this.IsChanged = false;
                        var selectedFeatureTypesCancel = new ObservableCollection<AssetFeatureTypeRowItem>(this.DynamicFeatureTypeViewModel.SelectedItems.Cast<AssetFeatureTypeRowItem>());
                        if (selectedFeatureTypesCancel.Count() != 0)
                        {
                            await this.UnLockBulkUpdateAssetFeaturesAsync();
                        }
                        else
                        {
                            this.IsCheckedOut = false;
                            this.SetIsCheckedOut();
                            this.IsChanged = false;
                        }

                        await this.AssetFeaturesAssignFeatureViewModel.PopulateAssignFeatureDrogDrag(selectedFeatureTypesCancel);
                        this.IsCheckedOut = false;
                        this.IsBulkUpdate = false;
                        this.SetIsCheckedOut();
                        this.SetGridStype(false);
                        this.RaiseActionsWhenChangeStep(EnumScreen.AssetFeatures, EnumSteps.CancelAssignFeature);
                    }
                    else
                    {
                        this.CurrentStep = Asset.EnumSteps.None;
                    }

                    break;
                case Asset.EnumSteps.CancelBulkUpdate:
                    canProcess = await this.CheckIfUnSavedChanges();
                    if (canProcess)
                    {
                        this.IsBulkUpdate = false;
                        this.DynamicFeatureTypeViewModel.SelectedItem = null;
                        this.DynamicFeatureTypeViewModel.IsEnableHoverRow = false;
                        this.DynamicFeatureTypeViewModel.SelectedRows = new List<object>();

                        this.RaiseActionsWhenChangeStep(EnumScreen.AssetFeatures, EnumSteps.CancelBulkUpdate);
                    }

                    break;
                case Asset.EnumSteps.Error:
                    // Show NotificationWindow when click Error button.
                    NotificationErrorView errorPopup = new NotificationErrorView();
                    NotificationErrorViewModel errorPopupViewModel = new NotificationErrorViewModel();
                    errorPopupViewModel.listCustomHyperlink = this.ListErrorHyperlink;
                    errorPopup.DataContext = errorPopupViewModel;

                    errorPopup.Style = (Style)Application.Current.FindResource("RadWindowStyleNew");

                    errorPopup.ShowDialog();
                    break;
            }

            this.SetActionCommandsAsync();
        }
        private async Task SetSelectedQueueAsync(QueueDetailsModel value)
        {
            bool canProceed = true;

            if (this.ActiveViewModel != null && this.ActiveViewModel.IsCheckedOut && this.IsChanged)
            {
                //this.ActiveViewModel.ConfirmationWindow.Raise(new Insyston.Operations.WPF.ViewModels.Common.ConfirmationWindowViewModel(null) { Content = "Data has been modified. Are you sure you wish to proceed without saving?", Title = "Confirm Save - Collection Queue" },
                //    (callBack) =>
                //    {
                //        if (callBack.Confirmed == false)
                //        {
                //            canProceed = false;
                //        }
                //    });
                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 - Collection Queue";
                confirm.DataContext = confirmViewModel;

                confirm.ShowDialog();
                if (confirm.DialogResult == false)
                {
                    canProceed = false;
                }
                else
                {
                    this.IsChanged = false;
                }
            }
            if (canProceed)
            {
                if (this.Edit.IsCheckedOut)
                {
                    await this.Edit.OnStepAsync(EnumSteps.Cancel);
                }
                this.ValidateNotError();
                this.RaiseActionsWhenChangeStep(EnumScreen.CollectionAssignment, EnumSteps.ItemLocked);
                this.GridStyle = (Brush)Application.Current.FindResource("GridStyleNotEdit");
                this.IsChanged = false;
                await UnLockAsync();

                this.SetField(ref _SelectedQueue, value, () => SelectedQueue);

                // just trigger the CheckedOut property in the scenario edit mode.
                this.Edit.IsCheckedOut = false;
                this.Edit.OnShowAllEnabledChanged();
                if (value != null)
                {
                    await this.OnStepAsync(EnumSteps.SelectQueue);
                }
                
            }
        }
        private async Task SetSelectedQueueAsync(CollectionAssignmentModel value)
        {
            bool canProceed = true;

            if (this.ActiveViewModel != null && this.ActiveViewModel.IsCheckedOut && this.isChanged)
            {
                //this.ActiveViewModel.ConfirmationWindow.Raise(new Insyston.Operations.WPF.ViewModels.Common.ConfirmationWindowViewModel(null) { Content = "Data has been modified. Are you sure you wish to proceed without saving?", Title = "Confirm Save - Collection Queue Filter" },
                //    (callBack) =>
                //    {
                //        if (callBack.Confirmed == false)
                //        {
                //            canProceed = false;
                //        }
                //    });
                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 - Collection Assignment";
                confirm.DataContext = confirmViewModel;

                confirm.ShowDialog();
                if (confirm.DialogResult == false)
                {
                    canProceed = false;
                }
                else
                {
                    this.isChanged = false;
                }
            }
            if (canProceed)
            {
                this.RaiseActionsWhenChangeStep(EnumScreen.CollectionAssignment, EnumSteps.ItemLocked);
                this.GridStyle = (Brush)Application.Current.FindResource("GridStyleNotEdit");
                this.SetBusyAction(LoadingText);
                this.Edit.SetBusyAction(LoadingText);
                this.ActiveViewModel = this;
                var strMessage = await this.ValidateSelectedQueue(value);
                this.ResetBusyAction();
                this.Edit.ResetBusyAction();
                if (!string.IsNullOrEmpty(strMessage))
                {
                    NotificationValidate notificationValidate = new NotificationValidate();
                    NotificationValidateViewModel notificationViewModel = new NotificationValidateViewModel();
                    notificationViewModel.Content = strMessage;
                    notificationViewModel.Title = "Collection Assignment";

                    notificationValidate.DataContext = notificationViewModel;
                    notificationValidate.Show();
                    //MessageBox.Show(strMessage);
                    //this.ShowMessageAsync(strMessage, "Collection Assignment");
                    if (ResetSelectedItem != null)
                    {
                        ResetSelectedItem(this, null);
                    }
                    return;
                }
                this.IsChanged = false;
                await UnLockAsync();
                this.SetField(ref _SelectedQueue, value, () => SelectedQueue);

                if (value != null)
                {
                    await this.OnStepAsync(EnumSteps.SelectQueue);
                }
               
            }
        }