Ejemplo n.º 1
0
 /// <summary>
 /// Create a new ProductEventType object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="productID">Initial value of the ProductID property.</param>
 /// <param name="eventTypeID">Initial value of the EventTypeID property.</param>
 public static ProductEventType CreateProductEventType(global::System.Guid id, global::System.Guid productID, global::System.Guid eventTypeID)
 {
     ProductEventType productEventType = new ProductEventType();
     productEventType.ID = id;
     productEventType.ProductID = productID;
     productEventType.EventTypeID = eventTypeID;
     return productEventType;
 }
Ejemplo n.º 2
0
        private async void SaveCommandExecuted()
        {
            IsBusy = true;

            if (_product.Product.ProductType.Type == "Membership")
            {
                if (IsEdit && Product.Product.ProductOptionID != null)
                {
                    Product.Product.ProductOptionID = null;
                }
                if (Product.EventTypes.Any())
                {
                    var productEventTypes = await _adminDataUnit.ProductEventTypesRepository.GetAllAsync(x => x.ProductID == Product.Product.ID);
                    foreach (var productEventType in productEventTypes)
                    {
                        _adminDataUnit.ProductEventTypesRepository.Delete(productEventType);
                    }
                    Product.EventTypes = new ObservableCollection<EventTypeModel>();
                    Product.RefreshEventTypesAbbreviations();
                }
                if (IsChargeType)
                    _product.Product.ComponentType = false;
                else if (IsLevyType)
                    _product.Product.ComponentType = true;
            }
            else
            {
                if (Product.EventTypes.Any())
                {
                    foreach (var eventType in Product.EventTypes)
                    {
                        var typeAlreadyExist = Product.Product.ProductEventTypes.Where(x => x.EventTypeID == eventType.EventType.ID).FirstOrDefault();

                        if (typeAlreadyExist == null)
                        {
                            var productType = new ProductEventType()
                            {
                                ID = Guid.NewGuid(),
                                EventTypeID = eventType.EventType.ID,
                                ProductID = _product.Product.ID
                            };

                            _adminDataUnit.ProductEventTypesRepository.Add(productType);
                        }
                    }
                }
                var typesToDelete = Product.Product.ProductEventTypes.Where(x => !(Product.EventTypes.Select(eventType => eventType.EventType).Contains(x.EventType))).ToList();
                _adminDataUnit.ProductEventTypesRepository.Delete(typesToDelete);
            }
            if (!IsEdit)
            {
                Product.Product.PluID = Convert.ToInt32(StartingPLUTillProductsSetting.Value);
                StartingPLUTillProductsSetting.Value = Convert.ToString(Convert.ToInt32(StartingPLUTillProductsSetting.Value) + 1);

                _adminDataUnit.ProductsRepository.Add(Product.Product);
            }
            await _adminDataUnit.SaveChanges();

            SendDataToAllActiveTills();
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ProductEventTypes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProductEventTypes(ProductEventType productEventType)
 {
     base.AddObject("ProductEventTypes", productEventType);
 }