public ChartOfAccountsViewModel() { event_aggregator = ServiceLocator.Current.GetInstance <IEventAggregator>(); service_factory = ServiceLocator.Current.GetInstance <IServiceFactory>(); SaveCommand = new DelegateCommand(DoSave, CanDoSave); _currentCoObject = CurrentCompany as Client.Entities.Company; if (_currentCoObject.GLAccounts != null) { var _coa = _currentCoObject.GLAccounts; _coa_acct_types = new List <string>(_coa.Select(x => x.AccountType).Distinct().OrderBy(x => x).ToList()); _coa_bal_types = new List <string>(_coa.Select(x => x.BalanceType).Distinct().OrderBy(x => x).ToList()); } }
private void MapObjectToProps(Client.Entities.Company company) { Company = new CompanyWrapper(company); if (company.GLAccounts != null) { AccountTypes = new List <string>(Company.GLAccounts.Select(x => x.AccountType).Distinct().OrderBy(x => x).ToList()); BalanceTypes = new List <string>(Company.GLAccounts.Select(x => x.BalanceType).Distinct().OrderBy(x => x).ToList()); } if (company.CompanyAddresses != null) { DefaultShippingAddress = Company.CompanyAddresses.Where(type => type.AddressType == QIQOAddressType.Shipping).FirstOrDefault(); DefaultBillingAddress = Company.CompanyAddresses.Where(type => type.AddressType == QIQOAddressType.Billing).FirstOrDefault(); } Company.PropertyChanged += Context_PropertyChanged; }
public CompanyViewModel(IEventAggregator event_aggtr, IServiceFactory service_fctry, IRegionManager region_manager, IStateListService address_postal_serv) { event_aggregator = event_aggtr; service_factory = service_fctry; _regionManager = region_manager; address_postal_service = address_postal_serv; _currentCoObject = CurrentCompany as Client.Entities.Company; BindCommands(); GetStateList(); GetEmployeeList(); MapObjectToProps(_currentCoObject); //GetAttributeList(); RegisterApplicationCommands(); event_aggregator.GetEvent <CompanyLoadedEvent>().Publish("Company data loaded sucessfully"); InvalidateCommands(); }