/// <summary>
        /// The get search result items.
        /// </summary>
        /// <returns>
        /// The <see cref="EquipSearchRowItem"/>.
        /// </returns>
        public EquipSearchRowItem GetSearchResultItems()
        {
            EquipSearchRowItem result = null;
            if (this.SearchToolViewModel != null)
            {
                ItemEquipSearch itemSearchCategory = this.SearchToolViewModel.ListItemResultSearch.FirstOrDefault(x => x.ItemType == SystemType.Category);
                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);

                    result = new EquipSearchRowItem
                                 {
                                     EquipCategoryId = itemSearchCategory == null ? 0 : itemSearchCategory.ListSourceItems.SelectedItem.ItemId,
                                     EquipCategoryName = itemSearchCategory == null ? null : itemSearchCategory.ListSourceItems.SelectedItem.Name,
                                     EquipTypeId = itemSearchType == null ? 0 : itemSearchType.ListSourceItems.SelectedItem.ItemId,
                                     EquipTypeName = itemSearchType == null ? null : itemSearchType.ListSourceItems.SelectedItem.Name,
                                     EquipMakeId = itemSearchMake == null ? 0 : itemSearchMake.ListSourceItems.SelectedItem.ItemId,
                                     EquipMakeName = itemSearchMake == null ? null : itemSearchMake.ListSourceItems.SelectedItem.Name,
                                     EquipModelId = itemSearchModel == null ? 0 : itemSearchModel.ListSourceItems.SelectedItem.ItemId,
                                     EquipModelName = itemSearchModel == null ? null : itemSearchModel.ListSourceItems.SelectedItem.Name,
                                 };
            }

            return result;
        }
        /// <summary>
        /// The get detail data source.
        /// </summary>
        /// <param name="itemSelected">
        /// The item selected.
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public async Task GetDetailDataSource(RegisteredAssetRowItem itemSelected)
        {
            this.ListAssetRegisters =
                new ObservableCollection<AssetRegisterRowItem>(await RegisteredAssetFunction.GetListRegister());
            this.ListAssetRegisters.Insert(
                0,
                new AssetRegisterRowItem
                    {
                        ID = -1,
                RegisterName = "<None>",
            });

            this.ListAssetSupplier =
                new ObservableCollection<AssetRelationRowItem>(await RegisteredAssetFunction.GetListSupplier());
            this.ListAssetSupplier.Insert(
                0,
                new AssetRelationRowItem
                    {
                        NodeId = -1,
                NodeName = "<None>",
            });

            this.ListAssetSubStatus =
                new ObservableCollection<SystemParam>(await RegisteredAssetFunction.GetListSubStatus());
            this.ListAssetSubStatus.Insert(
                0,
                new SystemParam
                    {
                        ParamId = -1,
                DisplayName = "<None>",
            });

            this.IsGlModuleKey = await Authorisation.IsModuleInstalledAsync(Modules.GLModule);
            // Load data for equip search control
            this.GetDataForEquipSearch();
            if (itemSelected.Id != 0)
            {
                this.RegisterAssetId = itemSelected.Id;
                this.AssetStatus = itemSelected.AssetStatus;
                this.StateId = itemSelected.StateId;
                this.StatusId = itemSelected.StatusId;
                this.AssetState = itemSelected.AssetState;
                this.AssetAcquisitionDate = itemSelected.AcqDate;
                this.AssetPoNumber = itemSelected.PONumber;
                this.AssetContractNum = itemSelected.ContractNumber;
                this.AssetSerialNum = itemSelected.SerialNumber;
                this.AssetDescription = itemSelected.Description;
                this.AssetGst = itemSelected.GstAsset;
                this.NetAssetCost = itemSelected.Cost;
                this.TotalAssetCost = this.NetAssetCost + this.AssetGst;
                this.AssetPoNumber = itemSelected.PONumber;
                this.InternalCompanyId = itemSelected.InternalCoyNodeId;
                this.FinancerId = itemSelected.FinancierNodeId;
                this.AssetAnnexure = RegisteredAssetFunction.GetAssetAnnexure(itemSelected.Id);
                this.SelectedRegister = await AssetRegisterFunction.GetAssetRegisterDetail(itemSelected.AssetRegisterId);
                this.AssetEffectiveDate = RegisteredAssetFunction.GetEffectiveDay(itemSelected.Id);
                if (this.AssetEffectiveDate == null)
                {
                    this.AssetEffectiveDate = DateTime.Today;
                }

                // Load data for equip search control
                // this.GetDataForEquipSearch();
                this.CurrentSearchResultItem = new EquipSearchRowItem
                                                            {
                                                                EquipCategoryId = itemSelected.CategoryId,
                                                                EquipTypeId = itemSelected.TypeId,
                                                                EquipMakeId = itemSelected.MakeId,
                                                                EquipModelId = itemSelected.ModelId,
                                                            };
                EquipSearchRowItem serachItemResult = new EquipSearchRowItem
                                                          {
                                                              EquipCategoryId = itemSelected.CategoryId,
                                                              EquipTypeId = itemSelected.TypeId,
                                                              EquipMakeId = itemSelected.MakeId,
                                                              EquipModelId = itemSelected.ModelId,
                                                          };
                await this.GenerateDataSearchSelected(serachItemResult);

                // Get data for Report company drop down list
                if (this.DynamicComboBoxReportCompany.SelectedItem != null)
                {
                    await this.GetDataForReportCompanyComboBox(itemSelected.AssetRegisterId, this.DynamicComboBoxReportCompany.SelectedItem.ItemId);
                }
                else
                {
                    await this.GetDataForReportCompanyComboBox(itemSelected.AssetRegisterId, -1);
                }

                // Get data for Location drop down list
                await this.GetDataForLocationComboBox(itemSelected.AssetRegisterId, itemSelected.AssetRegisterLocationId);

                this.SelectRegisterDefault =
                    this.ListAssetRegisters.FirstOrDefault(x => x.ID.Equals(itemSelected.AssetRegisterId));
                
                if (this.ListAssetSupplier.FirstOrDefault(x => x.NodeId.Equals(itemSelected.SupplierNodeId)) != null)
                {
                    this.SelectSupplierDefault = this.ListAssetSupplier.FirstOrDefault(x => x.NodeId.Equals(itemSelected.SupplierNodeId));
                }
                else
                {
                    this.SelectSupplierDefault = this.ListAssetSupplier.FirstOrDefault(x => x.NodeId == -1);
                }

                if (this.ListAssetSubStatus.FirstOrDefault(x => x.ParamId.Equals(itemSelected.SpAssetStatus)) != null)
                {
                    this.SelectSubDefault =
                        this.ListAssetSubStatus.FirstOrDefault(x => x.ParamId.Equals(itemSelected.SpAssetStatus));
                }
                else
                {
                    this.SelectSubDefault = this.ListAssetSubStatus.FirstOrDefault(x => x.ParamId == -1);
                }

                // Get and load data for Grid Feature
                this.AllRegisteredFeature = new ObservableCollection<RegisteredAssetFeatureRowItem>(await RegisteredAssetFunction.GetRegisteredFeatureItems(itemSelected.Id));
                this.UpdateDataForFeatureGrid();
            }
            else
            {
                this.RegisterAssetId = itemSelected.Id;
                this.AssetStatus = itemSelected.AssetStatus;
                this.AssetState = itemSelected.AssetState;
                this.StatusId = itemSelected.StatusId;
                this.StateId = itemSelected.StateId;
                this.AssetAcquisitionDate = itemSelected.AcqDate;
                this.AssetPoNumber = null;
                this.AssetContractNum = null;
                this.AssetSerialNum = null;
                this.AssetDescription = null;
                this.AssetGst = 0;
                this.NetAssetCost = 0;
                this.TotalAssetCost = this.NetAssetCost + this.NetAssetCost;
                this.AssetPoNumber = null;
                this.AssetAnnexure = null;

                this.SelectRegisterDefault =
                    this.ListAssetRegisters.FirstOrDefault(x => x.IsDefault);

                var assetRegisterRowItem = this.SelectRegisterDefault;
                if (assetRegisterRowItem != null)
                {
                    // Get data for Report company drop down list
                    if (this.DynamicComboBoxReportCompany.SelectedItem != null)
                    {
                        await this.GetDataForReportCompanyComboBox(assetRegisterRowItem.ID, this.DynamicComboBoxReportCompany.SelectedItem.ItemId);
                    }
                    else
                    {
                        await this.GetDataForReportCompanyComboBox(assetRegisterRowItem.ID, -1);
                    }

                    this.ListLocations = new ObservableCollection<AssetRegisterLocationRowItem>(
                       await AssetRegisterFunction.GetLocationsForRegister(assetRegisterRowItem.ID));
                }

                this.ListLocations.Insert(
                                           0,
                                           new AssetRegisterLocationRowItem
                                           {
                                               AssetRegisterLocationID = -1,
                                               LocationName = "<None>",
                                           });
                this.SelectLocationDefault = this.ListLocations.FirstOrDefault(
                    x => x.AssetRegisterLocationID.Equals(-1));

                this.SelectSupplierDefault = this.ListAssetSupplier.FirstOrDefault(x => x.NodeId.Equals(-1));
                
                this.SelectSubDefault =
                    this.ListAssetSubStatus.FirstOrDefault(x => x.ParamId.Equals(-1));
            }

            this.SelectedRegisteredAsset = new RegisteredAssetRowItem
                                               {
                                                   Id = this.RegisterAssetId,
                                                   AssetRegisterId = this.RegisterAssetId,
                                                   AssetStatus = this.AssetStatus,
                                                   StateId = this.StateId,
                                                   StatusId = this.StatusId,
                                                   AssetState = this.AssetState,
                                                   AcqDate = this.AssetAcquisitionDate,
                                                   PONumber = this.AssetPoNumber,
                                                   SerialNumber = this.AssetSerialNum,
                                                   ContractNumber = this.AssetContractNum,
                                                   Description = this.AssetDescription,
                                                   GstAsset = this.AssetGst,
                                                   Cost = this.NetAssetCost,
                                                   FinancierNodeId = this.FinancerId,
                                                   InternalCoyNodeId = this.InternalCompanyId,
                                               };
        }