public PickupInformationViewModel(CustomerOrderTransaction custTransaction) { this.transaction = custTransaction; // Get list of addresses storeDataManager = new DM.StoreDataManager( SalesOrder.InternalApplication.Settings.Database.Connection, SalesOrder.InternalApplication.Settings.Database.DataAreaID); customerDataManager = new DM.CustomerDataManager( SalesOrder.InternalApplication.Settings.Database.Connection, SalesOrder.InternalApplication.Settings.Database.DataAreaID); // Create a read-only collection stores = new ReadOnlyCollection <DataEntity.Store>(storeDataManager.GetStoresForPickup(SalesOrder.InternalApplication.Settings.Database.DataAreaID)); // Load date if (custTransaction.RequestedDeliveryDate > DateTime.MinValue) { this.pickUpDate = custTransaction.RequestedDeliveryDate; } // Load store if (!string.IsNullOrWhiteSpace(custTransaction.WarehouseId)) { this.selectedStore = storeDataManager.GetWarehouseStore(custTransaction.WarehouseId); } else { this.selectedStore = storeDataManager.GetStore(LSRetailPosis.Settings.ApplicationSettings.Terminal.StoreId); } }
/// <summary> /// Get the address for the currently selected store /// </summary> /// <returns></returns> public Address GetStoreAddress(DataEntity.Store store) { Address storeAddress = null; if (store != null && store.Party != null) { // Get the primary address (and ONLY the primary address) DataEntity.PostalAddress address = customerDataManager.GetPrimaryPostalAddress(store.Party.Id); if (address != null) { storeAddress = customerDataManager.GetAddress(address.Id); } } return(storeAddress); }