public AddressFacadeTests() { var dbContextFactory = new DbContextInMemoryFactory(nameof(AddressFacadeTests)); var dbx = dbContextFactory.Create(); dbx.Database.EnsureCreated(); var unitOfWork = new UnitOfWork(dbx); _repository = new RepositoryBase <AddressEntity>(unitOfWork); _mapper = new AddressMapper(); var entityFactory = new EntityFactory(dbx.ChangeTracker); _facadeSUT = new AddressFacade(unitOfWork, _repository, _mapper, entityFactory); }
internal LetterheadFacade() { _settings = new LetterheadSettings(); var address = new Address( _settings.LetterheadAddressStreet, _settings.LetterheadAddressUnit, _settings.LetterheadAddressCity, _settings.LetterheadAddressProvince, _settings.LetterheadAddressPostalCode, "", AddressType.B, null); _address = new AddressFacade(address); }
internal LetterheadFacade(string facilityCode) { _letterhead = LetterheadHelper.GetLetterheads(facilityCode); _address = new AddressFacade(_letterhead.Address); }
public MyCartPage(RestaurantDetailPage restaurantDetailPage) { RestaurantDetailPage = restaurantDetailPage; InitializeComponent(); NavigationPage.SetBackButtonTitle(this, AppResources.Back); var listMenuItemViews = RestaurantDetailPage.ListMenuItemViews.Values.SelectMany(t => t); listMenuGroupModifierItemSelected = listMenuItemViews .SelectMany(t => t.ListMenuGroupModifierItemSelected) .ToList(); if (listMenuGroupModifierItemSelected.Count == 0) { ButtonCheckout.IsEnabled = false; } var cartItemsSource = new ObservableCollection <CartMenuGroupModifierItemViewModel>(); var deleteAction = new Action <CartMenuGroupModifierItemViewModel>((t) => { cartItemsSource.Remove(t); listMenuGroupModifierItemSelected.Remove(t.Model); foreach (var listMenuItemView in listMenuItemViews) { listMenuItemView.ListMenuGroupModifierItemSelected.Remove(t.Model); listMenuItemView.IsSelected = listMenuItemView.ListMenuGroupModifierItemSelected.Count > 0; } UpdatePrice(); if (listMenuGroupModifierItemSelected.Count == 0) { ButtonCheckout.IsEnabled = false; } }); var cartItems = listMenuGroupModifierItemSelected.Select(t => new CartMenuGroupModifierItemViewModel(t, deleteAction)).ToList(); foreach (var cartItem in cartItems) { cartItemsSource.Add(cartItem); } ListViewCarts.ItemsSource = cartItemsSource; UpdatePrice(); ListViewCarts.ItemTapped += (sender, e) => { CartMenuGroupModifierItemViewModel cartMenuGroupModifierItem = e.Item as CartMenuGroupModifierItemViewModel; ListViewCarts.SelectedItem = null; RestaurantMenuItemModifierPage restaurantMenuItemModifierPage = new RestaurantMenuItemModifierPage(RestaurantDetailPage.RestaurantVM, cartMenuGroupModifierItem.Model.MenuItemView, cartMenuGroupModifierItem.Model); restaurantMenuItemModifierPage.Saved += (obj) => { Device.BeginInvokeOnMainThread(() => { obj.RaiseAllOnChanged(); UpdatePrice(); }); }; Utils.PushAsync(Navigation, restaurantMenuItemModifierPage, true); }; ButtonCheckout.Clicked += async(sender, e) => { UserFacade userFacade = new UserFacade(); try { var isSucceed = false; this.IsBusy = true; if (restaurantDetailPage.GroupedDeliveryDestination != null) { Shared.LocalAddress = restaurantDetailPage.GroupedDeliveryDestination.Address; } var serviceAddress = new AddressFacade().GetUserAddress(); var myCartPage = new PlaceOrderPage(String.Empty, RestaurantDetailPage, serviceAddress); await Utils.PushAsync(Navigation, myCartPage, true); this.IsBusy = false; } catch (Exception ex) { this.IsBusy = false; Device.BeginInvokeOnMainThread(async() => { var message = string.IsNullOrEmpty(ex.Message) ? AppResources.SomethingWentWrong : ex.Message; await Utils.ShowErrorMessage(message, 5); }); } }; }