/// <summary> /// Forces to re-evaluate CanExecute on the Prism commands /// </summary> public override void RaiseCanExecuteChanges() { base.RaiseCanExecuteChanges(); SubmitCommand.RaiseCanExecuteChanged(); CloseDialogCommand.RaiseCanExecuteChanged(); }
private void Delete(CartItemModel obj) { _cartService.RemoveFromCart(new CartItem { UserId = _userId, ProductId = obj.Product.Id }); Products.Remove(obj); if (Products.Count == 0) { CartNotEmpty = false; } else { CartNotEmpty = true; } var eventPayload = new CartItemEventModel { Product = obj.Product, Count = obj.Count, Action = CartAction.Remove }; _eventAggregator.GetEvent <UpdateCartEvent>().Publish(eventPayload); SubmitCommand.RaiseCanExecuteChanged(); }
private void ThisPropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "PackageContents") { CanSubmit(); SubmitCommand.RaiseCanExecuteChanged(); } }
private void OnEventBookedProductModelPropertyChanged(object sender, PropertyChangedEventArgs args) { if (args.PropertyName == "Room") { CreateClockItems(); } SubmitCommand.RaiseCanExecuteChanged(); }
public void RaisePropertyChanged(string propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(propertyName)); } SubmitCommand.RaiseCanExecuteChanged(); }
private void DeleteBookedProductCommandExecuted(EventBookedProductModel obj) { obj.PropertyChanged -= OnEventBookedProductModelPropertyChanged; _eventGolf.EventBookedProducts.Remove(obj); _event.EventCharges.Remove(obj.EventCharge); _eventDataUnit.EventChargesRepository.Delete(obj.EventCharge.EventCharge); _event.EventBookedProducts.Remove(obj); _eventDataUnit.EventBookedProductsRepository.Delete(obj.EventBookedProduct); SubmitCommand.RaiseCanExecuteChanged(); }
private void OnEventBookedProductModelPropertyChanged(object sender, PropertyChangedEventArgs args) { // When you select a time, default the start time of the booking to the same time. if (args.PropertyName == "Time") { _eventCatering.StartTime = _eventCatering.Time; } if (args.PropertyName == "Room") { CreateClockItems(); } SubmitCommand.RaiseCanExecuteChanged(); }
private void SubmitCommandExecuted() { if (IsBusy) { return; } IsBusy = true; SubmitCommand.RaiseCanExecuteChanged(); if (!_isEditMode) { _event.EventInvoices.Add(EventInvoice); _eventDataUnit.EventInvoicesRepository.Add(EventInvoice.EventInvoice); foreach (var product in EventInvoice.EventBookedProducts) { product.EventCharge.EventCharge.ShowInInvoice = EventInvoice.EventInvoice.ShowInInvoice; _event.EventCharges.Add(product.EventCharge); _eventDataUnit.EventChargesRepository.Add(product.EventCharge.EventCharge); _event.EventBookedProducts.Add(product); _eventDataUnit.EventBookedProductsRepository.Add(product.EventBookedProduct); } } else { EventInvoice.EventBookedProducts.ForEach(eventBookedProduct => { eventBookedProduct.EventCharge.EventCharge.ShowInInvoice = EventInvoice.EventInvoice.ShowInInvoice; }); var newProdcuts = _eventInvoice.EventBookedProducts.Except(_event.EventBookedProducts).ToList(); if (newProdcuts.Any()) { foreach (var prodcut in newProdcuts) { _event.EventBookedProducts.Add(prodcut); _eventDataUnit.EventBookedProductsRepository.Add(prodcut.EventBookedProduct); _event.EventCharges.Add(prodcut.EventCharge); _eventDataUnit.EventChargesRepository.Add(prodcut.EventCharge.EventCharge); } } } RaisePropertyChanged("CloseDialog"); }
void OnPropertyChanged(string propertyName) { ValidateModel(); SubmitCommand.RaiseCanExecuteChanged(); PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); }
private void AddItemCommandExecuted() { AddGolfProduct(EventGolf); SubmitCommand.RaiseCanExecuteChanged(); }
private async void SubmitCommandExecuted() { IsBusy = true; SubmitCommand.RaiseCanExecuteChanged(); if (EventGolf.HasErrors) { IsBusy = false; SubmitCommand.RaiseCanExecuteChanged(); return; } EventGolf.EventGolf.Event = _event.Event; var eventGolf = EventGolf.Clone(); EventGolfModel linkedEventGolf = GetEventGolf(); EventGolf linkedGolf = null; _eventDataUnit.EventGolfsRepository.Refresh(RefreshMode.ClientWins); var golfs = await _eventDataUnit.EventGolfsRepository.GetAllAsync(); golfs = _eventDataUnit.EventGolfsRepository.SetGolfCurrentValues(golfs).ToList(); var eventGolfs = golfs.Select(x => new EventGolfModel(x)).ToList(); if (_isEditMode) { if (EventGolf.EventGolf.LinkedEventGolfId != null) { linkedGolf = eventGolfs.FirstOrDefault(p => p.EventGolf.ID == EventGolf.EventGolf.LinkedEventGolfId).EventGolf; eventGolfs.RemoveAll(x => x.EventGolf.ID == EventGolf.EventGolf.LinkedEventGolfId); } } eventGolfs.RemoveAll(x => x.EventGolf.ID == _eventGolf.EventGolf.ID); if (AlreadyBookedGolfs != null) { AlreadyBookedGolfs.ForEach(alreadyBookedItem => { eventGolfs.RemoveAll(p => p.EventGolf.ID == alreadyBookedItem.EventGolf.ID); if (alreadyBookedItem.EventGolf.EventGolf1 != null) { eventGolfs.RemoveAll(p => p.EventGolf.ID == alreadyBookedItem.EventGolf.EventGolf1.ID); } }); } var bookingService = new BookingsService { BookedGolfs = eventGolfs }; MapChangedDataAfterRefresh(EventGolf.EventGolf, eventGolf.EventGolf); //check 1st Golf Booking var startTime = new DateTime(_event.Date.Year, _event.Date.Month, _event.Date.Day, _eventGolf.Time.Hour, _eventGolf.Time.Minute, 0); var endTime = startTime.AddMinutes(EventGolf.Golf.TimeInterval.TotalMinutes * EventGolf.EventGolf.Slots); var firstBookingAllowed = bookingService.IsGolfAvailable(EventGolf.Golf, startTime, endTime); var linkedBookingAllowed = false; var bookingAllowed = false; //Check if first booking allowed and then check second if allowed if (firstBookingAllowed) { //Check Whether Golf is 9 golfHoles or 18 Holes if (EventGolf.GolfHole.Hole.ToLower() == "18 holes") { if (EventGolf.Golf.TurnDefault != null) { var golf = Golfs.FirstOrDefault(m => m.ID == EventGolf.Golf.TurnDefault); if (golf != null) { startTime = startTime.Add(EventGolf.Golf.TurnTime); startTime = startTime.AddMinutes(((new TimeSpan(startTime.Hour, startTime.Minute, 0).TotalMinutes - golf.StartTime.TotalMinutes) % golf.TimeInterval.TotalMinutes)); // startTime = startTime.AddTicks((golf.StartTime.Ticks + new TimeSpan(0, 0, 1).Ticks - new TimeSpan(startTime.Hour, startTime.Minute, startTime.Second).Ticks) / golf.TimeInterval.Ticks); endTime = startTime.AddMinutes(Golfs.FirstOrDefault(m => m.ID == EventGolf.Golf.TurnDefault).TimeInterval.TotalMinutes *EventGolf.EventGolf.Slots); MapChangedDataAfterRefresh(linkedEventGolf.EventGolf, eventGolf.EventGolf); linkedEventGolf.EventGolf.TeeID = golf.ID; linkedEventGolf.EventGolf.Time = new DateTime(0001, 01, 01, startTime.Hour, startTime.Minute, startTime.Second); linkedEventGolf.EventGolf.IsLinked = true; linkedEventGolf.EventGolf.Event = _event.Event; linkedBookingAllowed = bookingService.IsGolfAvailable(golf, startTime, endTime); } } else { EventGolf.EventGolf.LinkedEventGolfId = null; linkedBookingAllowed = true; } bookingAllowed = firstBookingAllowed && linkedBookingAllowed; } else { bookingAllowed = firstBookingAllowed; } } else { bookingAllowed = firstBookingAllowed; } if (bookingAllowed && EventGolf.HasValidProducts) { if (!_isEditMode) { if (EventGolf.GolfHole.Hole.ToLower() == "18 holes" && EventGolf.Golf.TurnDefault != null && Golfs.FirstOrDefault(m => m.ID == EventGolf.Golf.TurnDefault) != null) { EventGolf.EventGolf.EventGolf1 = linkedEventGolf.EventGolf; EventGolf.EventGolf.LinkedEventGolfId = linkedEventGolf.EventGolf.ID; } _event.EventGolfs.Add(EventGolf); _eventDataUnit.EventGolfsRepository.Add(EventGolf.EventGolf); //if (EventGolf.GolfHole.Hole.ToLower() == "18 holes") // _eventDataUnit.EventGolfsRepository.Add(linkedEventGolf.EventGolf); foreach (var product in EventGolf.EventBookedProducts) { product.EventCharge.EventCharge.ShowInInvoice = EventGolf.EventGolf.ShowInInvoice; _event.EventCharges.Add(product.EventCharge); _eventDataUnit.EventChargesRepository.Add(product.EventCharge.EventCharge); _event.EventBookedProducts.Add(product); _eventDataUnit.EventBookedProductsRepository.Add(product.EventBookedProduct); } } else { if (linkedGolf != null) { _eventDataUnit.EventGolfsRepository.Delete(linkedGolf); } if (EventGolf.GolfHole.Hole.ToLower() == "18 holes" && EventGolf.Golf.TurnDefault != null && Golfs.FirstOrDefault(m => m.ID == EventGolf.Golf.TurnDefault) != null) { EventGolf.EventGolf.EventGolf1 = linkedEventGolf.EventGolf; EventGolf.EventGolf.LinkedEventGolfId = linkedEventGolf.EventGolf.ID; } //if (EventGolf.GolfHole.Hole.ToLower() == "18 holes") // _eventDataUnit.EventGolfsRepository.Add(linkedEventGolf.EventGolf); EventGolf.EventBookedProducts.ForEach(eventBookedProduct => { eventBookedProduct.EventCharge.EventCharge.ShowInInvoice = EventGolf.EventGolf.ShowInInvoice; }); var newProdcuts = _eventGolf.EventBookedProducts.Except(_event.EventBookedProducts).ToList(); if (newProdcuts.Any()) { foreach (var prodcut in newProdcuts) { _event.EventBookedProducts.Add(prodcut); _eventDataUnit.EventBookedProductsRepository.Add(prodcut.EventBookedProduct); _event.EventCharges.Add(prodcut.EventCharge); _eventDataUnit.EventChargesRepository.Add(prodcut.EventCharge.EventCharge); } } } RaisePropertyChanged("CloseDialog"); } else { IsBusy = false; SubmitCommand.RaiseCanExecuteChanged(); RaisePropertyChanged("DisableParentWindow"); string confirmText = Resources.MESSAGE_TEE_IS_BOOKED; RadWindow.Alert(new DialogParameters() { Owner = Application.Current.MainWindow, Content = confirmText, }); RaisePropertyChanged("EnableParentWindow"); } }
private void OnEventBookedProductModelPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs) { SubmitCommand.RaiseCanExecuteChanged(); }
private void AddItemCommandExecuted() { AddCateringProduct(EventCatering); SubmitCommand.RaiseCanExecuteChanged(); }
private void SetLoadingIndicator(bool busyState) { IsBusy = busyState; SubmitCommand.RaiseCanExecuteChanged(); }
private void EventNoteOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs) { SubmitCommand.RaiseCanExecuteChanged(); }
public Page1ViewModel() { _firstName.PropertyChanged += (sender, args) => SubmitCommand.RaiseCanExecuteChanged(); }
private void AddItemCommandExecuted() { AddRoomProduct(EventRoom); SubmitCommand.RaiseCanExecuteChanged(); }
public void RaiseSettingChanged() { HasChanged = true; SubmitCommand.RaiseCanExecuteChanged(); }
private void Correspondence_PropertyChanged(object sender, PropertyChangedEventArgs e) { SubmitCommand.RaiseCanExecuteChanged(); PreviewCommand.RaiseCanExecuteChanged(); }