private void DeleteBookedProductCommandExecuted(EventBookedProductModel obj)
        {
            obj.PropertyChanged -= OnEventBookedProductModelPropertyChanged;

            _eventInvoice.EventBookedProducts.Remove(obj);

            _event.EventCharges.Remove(obj.EventCharge);
            _eventDataUnit.EventChargesRepository.Delete(obj.EventCharge.EventCharge);

            _event.EventBookedProducts.Remove(obj);
            _eventDataUnit.EventBookedProductsRepository.Delete(obj.EventBookedProduct);
        }
        private void AddInvoiceProduct(EventInvoiceModel model)
        {
            var charge = new EventCharge()
            {
                ID = Guid.NewGuid(),
                EventID = _event.Event.ID,
                ShowInInvoice = model.EventInvoice.ShowInInvoice
            };

            var item = new EventBookedProductModel(new EventBookedProduct()
            {
                ID = Guid.NewGuid(),
                EventBookingItemID = model.EventInvoice.ID,
                EventID = _event.Event.ID,
                EventCharge = charge
            });

            item.Quantity = _event.Event.Places;
            item.PropertyChanged += OnEventBookedProductModelPropertyChanged;

            model.EventBookedProducts.Add(item);
        }
Esempio n. 3
0
 /// <summary>
 /// Update the product and charges quantities when number of people changes 
 /// for a particular product if the quantity is same as number of people before changing the number of peope. 
 /// </summary>
 /// <param name="product"></param>
 private void SetProductCountAndCharges(EventBookedProductModel product)
 {
     if (product.Quantity == _originalEvent.Places)
     {
         product.Quantity = Event.Places;
         _event.EventCharges.Where(p => p.EventCharge.ID == product.EventCharge.EventCharge.ID).ForEach(eCharge =>
         {
             eCharge.Quantity = Event.Places;
         });
     }
 }
        private void RemoveEventBookedProductAndCharges(EventBookedProductModel product)
        {
            _eventsDataUnit.EventChargesRepository.Delete(product.EventCharge.EventCharge);
            _eventsDataUnit.EventBookedProductsRepository.Delete(product.EventBookedProduct);
            var eventCharges = new System.Collections.Generic.List<EventChargeModel>();
            _event.EventCharges.ForEach(eventCharge =>
            {
                if (eventCharge.EventCharge.ID == product.EventCharge.EventCharge.ID)
                {
                    eventCharges.Add(eventCharge);
                }
            });
            eventCharges.ForEach(echarge => _event.EventCharges.Remove(echarge));

            _event.EventBookedProducts.Remove(product);

        }
Esempio n. 5
0
        private void DeleteBookedProductCommandExecuted(EventBookedProductModel obj)
        {
            obj.PropertyChanged -= OnEventBookedProductModelPropertyChanged;

            _eventCatering.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();
        }
Esempio n. 6
0
        private void AddCateringProduct(EventCateringModel model)
        {
            var charge = new EventCharge
            {
                ID = Guid.NewGuid(),
                EventID = _event.Event.ID,
                ShowInInvoice = model.EventCatering.ShowInInvoice
            };

            var productModel = new EventBookedProductModel(new EventBookedProduct
            {
                ID = Guid.NewGuid(),
                EventBookingItemID = model.EventCatering.ID,
                EventID = _event.Event.ID,
                EventCharge = charge
            });

            productModel.Quantity = _event.Event.Places;
            productModel.PropertyChanged += OnEventBookedProductModelPropertyChanged;

            model.EventBookedProducts.Add(productModel);
        }