private void AddFA() { NewFA = new AccountsBudgetDetailsSet { AccountsMainId = Account.Id }; FAList = new ObservableCollection <FASet>(_faService.GetFAList()); if (AccountStoresList.Count == 1) { NewFA.AccountStoreNumber = AccountStoresList.FirstOrDefault().StoreNumber; } if (AccountCapexList.Count == 1) { NewFA.EquipmentCapexId = AccountCapexList.FirstOrDefault().CapexId; } AddFAOpen = true; }
private void AddStoresToAccount(List <int> storesNumbers) { if (storesNumbers.Count <= 0) { return; } var storesForAddList = new ObservableCollection <AccountsStoreDetailsSet>(); foreach (var storeNumber in storesNumbers.Where(storeNumber => AccountStoresList.All(s => s.StoreNumber != storeNumber) && storesForAddList.All(s => s.AccountStore != storeNumber))) { storesForAddList.Add(new AccountsStoreDetailsSet { AccountsMainId = CurrentAccount.Id, AccountStore = storeNumber }); } if (storesForAddList.Count == 0) { return; } _accountStoresService.AddStoresToAccount(storesForAddList); AccountStoresList = new ObservableCollection <StoresSet>(_accountStoresService.GetAccountStoresById(CurrentAccount.Id)); StoresWorkList = new ObservableCollection <StoreProvenWorkSet>(_storesWorkService.GetWorksList(AccountStoresList, false)); Application.Current.Dispatcher.BeginInvoke(new Action(() => StoresForLoad = string.Empty)); }