示例#1
0
        public PlayWaveEvent(XactClip clip, float timeStamp, float randomOffset, SoundBank soundBank,
                             int[] waveBanks, int[] tracks, byte[] weights, int totalWeights,
                             VariationType variation, Vector2?volumeVar, Vector2?pitchVar, Vector4?filterVar,
                             int loopCount, bool newWaveOnLoop)
            : base(clip, timeStamp, randomOffset)
        {
            _soundBank    = soundBank;
            _waveBanks    = waveBanks;
            _tracks       = tracks;
            _weights      = weights;
            _totalWeights = totalWeights;
            _volumeVar    = volumeVar;
            _pitchVar     = pitchVar;
            _filterVar    = filterVar;
            _wavIndex     = -1;
            _loopIndex    = 0;

            _trackVolume          = 1.0f;
            _trackPitch           = 0;
            _trackFilterFrequency = 0;
            _trackFilterQFactor   = 0;

            _clipVolume    = 1.0f;
            _clipPitch     = 0;
            _clipReverbMix = 0;

            _variation     = variation;
            _loopCount     = loopCount;
            _newWaveOnLoop = newWaveOnLoop;
        }
        private int CreateNewAddToCartMVT()
        {
            int           mvtid       = -1;
            VariationType testVariant = AddToCartButton.GetNextUntestedVariant();

            if (testVariant != null)
            {
                mvtid = MVTHistory.CreateNewLiveMVT(TestTypesEnum.ADDTOCARTBUTTON);
                MVTHistory.AddNewTestVariantToMVT(mvtid, ref testVariant);
            }
            else
            {
                //Could not create new MVT as could not produce new test variant.
                if (AddToCartButton.IsAllVariationTested() == false)
                {
                    //There are still untested variants. This must be an error.
                    if (Configuration.IsDebugModeOn)
                    {
                        _CLI.Out("Error while trying to create new MVT.", true, false);
                    }
                }

                return(-1);
            }

            return(mvtid);
        }
示例#3
0
    private static bool ReadVariationData(out VariationController variation, SetSRT callback)
    {
        float   valuesImportantInEditorButNotHere = 0;
        Vector3 ls = new Vector3(s_reader.ReadSingle(), s_reader.ReadSingle(), s_reader.ReadSingle());

        valuesImportantInEditorButNotHere = s_reader.ReadSingle();
        Vector3 lt = new Vector3(s_reader.ReadSingle(), s_reader.ReadSingle(), s_reader.ReadSingle());

        valuesImportantInEditorButNotHere = s_reader.ReadSingle();
        Vector3 lr = new Vector3(s_reader.ReadSingle(), s_reader.ReadSingle(), s_reader.ReadSingle());

        valuesImportantInEditorButNotHere = s_reader.ReadSingle();
        Vector3 hs = new Vector3(s_reader.ReadSingle(), s_reader.ReadSingle(), s_reader.ReadSingle());

        valuesImportantInEditorButNotHere = s_reader.ReadSingle();
        Vector3 ht = new Vector3(s_reader.ReadSingle(), s_reader.ReadSingle(), s_reader.ReadSingle());

        valuesImportantInEditorButNotHere = s_reader.ReadSingle();
        Vector3 hr = new Vector3(s_reader.ReadSingle(), s_reader.ReadSingle(), s_reader.ReadSingle());

        valuesImportantInEditorButNotHere = s_reader.ReadSingle();
        valuesImportantInEditorButNotHere = s_reader.ReadUInt32();
        valuesImportantInEditorButNotHere = s_reader.ReadUInt32();
        valuesImportantInEditorButNotHere = s_reader.ReadUInt32();
        VariationType vt = (VariationType)s_reader.ReadUInt32();

        valuesImportantInEditorButNotHere = s_reader.ReadUInt32();
        valuesImportantInEditorButNotHere = s_reader.ReadUInt32();

        lr *= Mathf.Rad2Deg;
        hr *= Mathf.Rad2Deg;

        variation = new VariationController(ls, lr, lt, hs, hr, ht, vt, callback);
        return(true);
    }
示例#4
0
        public void HandleEditVariationType(VariationType variationType)
        {
            var view      = new EditVariationTypeWindow();
            var presenter = new EditVariationTypePresenter(view, variationType, variationTypeRepository);

            presenter.Initialize();
            view.ShowDialog();
        }
示例#5
0
        public void AddTestVariant(ref VariationType testVariant)
        {
            int       vid     = variants.Count;
            Variation variant = new Variation(vid, false);

            variant.SetVariationType(testVariant);

            variants.Add(variant);
        }
示例#6
0
 public PlayWaveEvent(   XactClip clip, float timeStamp, float randomOffset, SoundBank soundBank, 
                         int[] waveBanks, int[] tracks, VariationType variation, bool isLooped)
     : base(clip, timeStamp, randomOffset)
 {
     _soundBank = soundBank;
     _waveBanks = waveBanks;
     _tracks = tracks;
     _wavIndex = 0;
     _volume = 1.0f;
     _variation = variation;
     _isLooped = isLooped;
 }
示例#7
0
        public void AddProductVariant(VariationType variant)
        {
            if (item.Variations == null)
            {
                item.Variations = new VariationsType
                {
                    Variation = new VariationTypeCollection()
                };
            }

            item.Variations.Variation.Add(variant);
        }
示例#8
0
 public PlayWaveEvent(XactClip clip, float timeStamp, float randomOffset, SoundBank soundBank,
                      int[] waveBanks, int[] tracks, VariationType variation, bool isLooped)
     : base(clip, timeStamp, randomOffset)
 {
     _soundBank = soundBank;
     _waveBanks = waveBanks;
     _tracks    = tracks;
     _wavIndex  = 0;
     _volume    = 1.0f;
     _variation = variation;
     _isLooped  = isLooped;
 }
示例#9
0
 public Table(VariationType variationType, int capacity, long boot, long minBankRequired, int minPlayersRequired, string channel)
 {
     this.VariationType          = variationType;
     this.Capacity               = capacity;
     this.BootValue              = boot;
     this.MinimumBankRequired    = minBankRequired;
     this.MinimumPlayersRequired = minPlayersRequired;
     this.TableState             = TableState.Inactive;
     this.Channel       = channel;
     this.CurrentStake  = boot;
     this.CurrentPlayer = 0;
     this.SeatedPlayers = new SeatedPlayer[capacity];
 }
        public static void UpdateInventory(string accountName, string token, string itemId, int qty, string sku, int isVariation, int soldQty, double startPrice)
        {
            ApiContext context = new ApiContext();

            context.ApiCredential.eBayToken = token;
            context.SoapApiServerUrl        = "https://api.ebay.com/wsapi";
            context.ApiLogManager           = new ApiLogManager();
            context.ApiLogManager.ApiLoggerList.Add(new FileLogger("log.txt", false, false, false));
            context.ApiLogManager.EnableLogging = true;
            context.Version = "861";
            context.Site    = SiteCodeType.US;
            ReviseFixedPriceItemCall reviseFixedPriceItemCall = new ReviseFixedPriceItemCall(context);
            ItemType item = new ItemType();

            try
            {
                if (isVariation == 0)
                {
                    item.ItemID            = itemId;
                    item.QuantityAvailable = qty;
                    item.Quantity          = qty;
                    //item.StartPrice.Value = startPrice;
                    reviseFixedPriceItemCall.Item = item;
                    reviseFixedPriceItemCall.Execute();
                }
                else
                {
                    item.ItemID = itemId;
                    VariationType           simpleType = new VariationType();
                    VariationTypeCollection vtc        = new VariationTypeCollection();
                    VariationsType          vsType     = new VariationsType();

                    simpleType.SKU      = sku;
                    simpleType.Quantity = qty;
                    vtc.Add(simpleType);
                    vsType.Variation = vtc;
                    item.Variations  = vsType;
                    reviseFixedPriceItemCall.Item = item;
                    reviseFixedPriceItemCall.Execute();
                }
            }
            catch (Exception ex)
            {
                ExceptionUtility exceptionUtility = new ExceptionUtility();
                exceptionUtility.CatchMethod(ex, "UpdateInventoryByReviseFixedPriceItem ", accountName + ":" + itemId + "(" + sku + ")" + " " + ex.Message.ToString(), senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum);
            }
        }
示例#11
0
 public VariationController(Vector3 ls, Vector3 lr, Vector3 lt, Vector3 hs, Vector3 hr, Vector3 ht, VariationType vt, SetSRT callback)
 {
     m_lowScale        = ls;
     m_lowRotation     = lr;
     m_lowTranslation  = lt;
     m_highScale       = hs;
     m_highRotation    = hr;
     m_highTranslation = ht;
     m_variationType   = vt;
     m_setCallback     = callback;
     m_varyFuncs       = new VaryFunc[] { VaryComponentUniform,
                                          VaryVectorUniform,
                                          VarySmoothUniform,
                                          VaryComponentBellApproximation,
                                          VaryVectorBellApproximation,
                                          VarySmoothBellApproximation };
 }
示例#12
0
        internal static void AddNewTestVariantToMVT(int mvtid, ref VariationType testVariant)
        {
            int i;

            for (i = 0; i < _History.Count; i++)
            {
                if (_History[i].Id == mvtid)
                {
                    break;
                }
            }

            if (i < _History.Count)
            {
                _History[i].AddTestVariant(ref testVariant);
            }
        }
示例#13
0
 public PlayWaveEvent(   XactClip clip, float timeStamp, float randomOffset, SoundBank soundBank,
                         int[] waveBanks, int[] tracks, byte[] weights, int totalWeights,
                         VariationType variation, Vector2? volumeVar, Vector2? pitchVar, 
                         int loopCount, bool newWaveOnLoop)
     : base(clip, timeStamp, randomOffset)
 {
     _soundBank = soundBank;
     _waveBanks = waveBanks;
     _tracks = tracks;
     _weights = weights;
     _totalWeights = totalWeights;
     _volumeVar = volumeVar;
     _pitchVar = pitchVar;
     _wavIndex = -1;
     _loopIndex = 0;
     _trackVolume = 1.0f;
     _variation = variation;
     _loopCount = loopCount;
     _newWaveOnLoop = newWaveOnLoop;
 }
示例#14
0
        public void Delete(VariationType variationType)
        {
            if (variationType == null)
            {
                throw new RepositoryException($"Tipo de variação não pode estar nulo ou vazio.");
            }

            using (var session = NHibernateSessionFactory.OpenSession())
            {
                try
                {
                    session.Delete(variationType);
                    session.Flush();
                }
                catch (Exception ex)
                {
                    throw new RepositoryException($"Não foi possível deletar o tipo de variação '{variationType.Type}/{variationType.Value}': {ex.Message}", ex);
                }
            }
        }
示例#15
0
        private void AddProductVariants(product p)
        {
            // only add if there's more than 1 variant
            if (p.product_variants.Count > 1)
            {
                foreach (var entry in p.product_variants)
                {
                    var variant = new VariationType
                    {
                        SKU      = entry.sku,
                        Quantity = ebayProduct.quantity
                    };

                    var variants = new NameValueListTypeCollection();

                    if (!string.IsNullOrEmpty(entry.color))
                    {
                        variants.Add(new NameValueListType()
                        {
                            Name  = "color",
                            Value = new StringCollection(new[] { entry.color })
                        });
                    }

                    if (!string.IsNullOrEmpty(entry.size))
                    {
                        variants.Add(new NameValueListType()
                        {
                            Name  = "size",
                            Value = new StringCollection(new[] { entry.size })
                        });
                    }

                    variant.VariationSpecifics = variants;
                    service.AddProductVariant(variant);
                }
            }
        }
示例#16
0
        public void Add(VariationType variationType)
        {
            if (variationType == null)
            {
                throw new RepositoryException($"Tipo de variação não pode estar nulo ou vazio.");
            }

            using (var session = NHibernateSessionFactory.OpenSession())
            {
                try
                {
                    session.Save(variationType);
                    session.Flush();
                }
                catch (ConstraintViolationException ex)
                {
                    throw new RepositoryException($"Tipo de variação '{variationType.Type}'/'{variationType.Value}' já existe.", ex);
                }
                catch (Exception ex)
                {
                    throw new RepositoryException($"Não foi possível adicionar o tipo de variação '{variationType.Type}/{variationType.Value}': {ex.Message}", ex);
                }
            }
        }
 public FeatureFlagAttribute(string key, VariationType type, object defaultValue = null)
 {
     Key          = key;
     DefaultValue = defaultValue;
     Type         = type;
 }
示例#18
0
 public void SetVariationType(VariationType vtype)
 {
     VariationType = vtype;
 }
示例#19
0
 public static CompareResult Compare(VariationType variation, Hand a, Hand b, Dictionary <string, string> additionalInfo)
 {
     return(Strategies[variation].Compare(a, b, additionalInfo));
 }
示例#20
0
 public EditVariationTypePresenter(IEditVariationTypeView view, VariationType variationType, IVariationTypeRepository repository)
 {
     this.view          = view;
     this.repository    = repository;
     this.variationType = variationType;
 }
示例#21
0
 public Variation(VariationType variationType)
 {
     this.VariationType = variationType;
 }
示例#22
0
        /// <summary>
        /// Build sample item Variations
        /// </summary>
        /// <returns>Variations object</returns>
        static VariationsType buildVariationsType()
        {
            // listing variations
            VariationsType variations = new VariationsType();

            // first variation
            VariationType variation1 = new VariationType();
            // create the content of VariationSpecifics
            NameValueListTypeCollection nvcol1 = new NameValueListTypeCollection();
            NameValueListType           nv11   = new NameValueListType();

            nv11.Name = "Color";
            StringCollection nv1StrCol = new StringCollection();

            String[] strArr1 = new string[] { "RED" };
            nv1StrCol.AddRange(strArr1);
            nv11.Value = nv1StrCol;
            NameValueListType nv12 = new NameValueListType();

            nv12.Name = "Size";
            StringCollection nv2StrCol = new StringCollection();

            String[] strArr2 = new string[] { "M" };
            nv2StrCol.AddRange(strArr2);
            nv12.Value = nv2StrCol;
            nvcol1.Add(nv11);
            nvcol1.Add(nv12);
            // set variation-level specifics for first variation
            variation1.VariationSpecifics = nvcol1;
            // set start price
            AmountType amount1 = new AmountType();

            amount1.Value         = 100;
            amount1.currencyID    = CurrencyCodeType.USD;
            variation1.StartPrice = amount1;
            // set quantity
            variation1.Quantity = 10;
            // set variation name
            variation1.VariationTitle = "RED,M";

            // second variation
            VariationType variation2 = new VariationType();
            // create the content of specifics for each variation
            NameValueListTypeCollection nvcol2 = new NameValueListTypeCollection();
            NameValueListType           nv21   = new NameValueListType();

            nv21.Name = "Color";
            StringCollection nv21StrCol = new StringCollection();

            String[] strArr21 = new string[] { "BLACK" };
            nv21StrCol.AddRange(strArr21);
            nv21.Value = nv21StrCol;
            NameValueListType nv22 = new NameValueListType();

            nv22.Name = "Size";
            StringCollection nv22StrCol = new StringCollection();

            String[] strArr22 = new string[] { "L" };
            nv22StrCol.AddRange(strArr22);
            nv22.Value = nv22StrCol;
            nvcol2.Add(nv21);
            nvcol2.Add(nv22);
            // set variation-level specifics for first variation
            variation2.VariationSpecifics = nvcol2;
            // set start price
            AmountType amount2 = new AmountType();

            amount2.Value         = 110;
            amount2.currencyID    = CurrencyCodeType.USD;
            variation2.StartPrice = amount2;
            // set quantity
            variation2.Quantity = 20;
            // set variation name
            variation2.VariationTitle = "BLACK,L";

            // set variation
            VariationTypeCollection varCol = new VariationTypeCollection();

            varCol.Add(variation1);
            varCol.Add(variation2);
            variations.Variation = varCol;

            // create the content of specifics for variations
            NameValueListTypeCollection nvcol3 = new NameValueListTypeCollection();
            NameValueListType           nv31   = new NameValueListType();

            nv31.Name = "Color";
            StringCollection nv31StrCol = new StringCollection();

            String[] strArr31 = new string[] { "BLACK", "RED" };
            nv31StrCol.AddRange(strArr31);
            nv31.Value = nv31StrCol;
            NameValueListType nv32 = new NameValueListType();

            nv32.Name = "Size";
            StringCollection nv32StrCol = new StringCollection();

            String[] strArr32 = new string[] { "M", "L" };
            nv32StrCol.AddRange(strArr32);
            nv32.Value = nv32StrCol;
            nvcol3.Add(nv31);
            nvcol3.Add(nv32);
            // set variationSpecifics
            variations.VariationSpecificsSet = nvcol3;
            return(variations);
        }
        public override async Task <ItemType> Run(ItemType item, CommercePipelineExecutionContext context)
        {
            Condition.Requires(item).IsNotNull($"{Name}: The argument can not be null");
            try
            {
                var foundEntity = context.CommerceContext.GetObjects <FoundEntity>().FirstOrDefault(p => p.Entity is SellableItem);
                if (foundEntity != null)
                {
                    var sellableItem = foundEntity.Entity as SellableItem;
                    if (sellableItem.HasComponent <ItemVariationsComponent>())
                    {
                        // This item has variations
                        item.Variations = new VariationsType {
                            Variation = new VariationTypeCollection()
                        };

                        var itemVariationsComponent = sellableItem.GetComponent <ItemVariationsComponent>();

                        var allColors = new StringCollection();

                        foreach (var variationComponent in itemVariationsComponent.ChildComponents.OfType <ItemVariationComponent>())
                        {
                            var newVariation = new VariationType {
                                VariationTitle = variationComponent.DisplayName
                            };

                            var listPricingPolicy = sellableItem.GetPolicy <ListPricingPolicy>();
                            var listPrice         = listPricingPolicy.Prices.FirstOrDefault();

                            newVariation.StartPrice = new AmountType
                            {
                                currencyID = CurrencyCodeType.USD,
                                Value      = System.Convert.ToDouble(listPrice.Amount)
                            };

                            newVariation.SKU                = variationComponent.Id;
                            newVariation.Quantity           = 10;
                            newVariation.VariationSpecifics = new NameValueListTypeCollection();
                            var displayPropertiesComponent = variationComponent.GetComponent <DisplayPropertiesComponent>();

                            if (string.IsNullOrEmpty(displayPropertiesComponent.Color))
                            {
                                displayPropertiesComponent.Color = "None";
                            }

                            newVariation.VariationSpecifics.Add(new NameValueListType()
                            {
                                Name = "Color", Value = new StringCollection()
                                {
                                    displayPropertiesComponent.Color
                                }
                            });

                            if (!allColors.Contains(displayPropertiesComponent.Color))
                            {
                                allColors.Add(displayPropertiesComponent.Color);
                            }

                            item.Variations.Variation.Add(newVariation);

                            item.Variations.VariationSpecificsSet = new NameValueListTypeCollection();
                            item.Variations.VariationSpecificsSet.Add(new NameValueListType()
                            {
                                Name = "Color", Value = allColors
                            });
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                context.Logger.LogError($"Ebay.PrepareItemVariationsBlock.Exception: Message={ex.Message}");
                await context.CommerceContext.AddMessage("Error", "PrepareItemVariationsBlock.Run.Exception", new object[] { ex }, ex.Message);
            }

            return(item);
        }
        /// <summary>
        /// The execute.
        /// </summary>
        /// <param name="item">
        /// An ItemType.
        /// </param>
        /// <param name="context">
        /// The context.
        /// </param>
        /// <returns>
        /// The <see cref="EbayConfigEntity"/>.
        /// </returns>
        public override async Task <ItemType> Run(ItemType item, CommercePipelineExecutionContext context)
        {
            Condition.Requires(item).IsNotNull($"{this.Name}: The argument can not be null");
            //var result2 = await Task.Run(() => new EbayConfigEntity() { Id = Guid.NewGuid().ToString() });

            //var item = new ItemType();
            try
            {
                //item = new ItemType
                //{
                //    SKU = sellableItem.Id.Replace("Entity-SellableItem-", ""),
                //    Currency = CurrencyCodeType.USD,
                //    Country = CountryCodeType.US,
                //    ListingDuration = "Days_7",
                //    PrimaryCategory = new CategoryType { CategoryID = "12" },
                //    Location = "Dallas, TX",
                //    Quantity = 10
                //};
                var foundEntity = context.CommerceContext.GetObjects <FoundEntity>().FirstOrDefault(p => p.Entity is SellableItem);
                if (foundEntity != null)
                {
                    var sellableItem = foundEntity.Entity as SellableItem;
                    if (sellableItem.HasComponent <ItemVariationsComponent>())
                    {
                        //This item has variations
                        item.Variations           = new VariationsType();
                        item.Variations.Variation = new VariationTypeCollection();

                        var itemVariationsComponent = sellableItem.GetComponent <ItemVariationsComponent>();


                        //if (itemVariationsComponent.GetComponents<ItemVariationComponent>().Count > 1)
                        //{
                        var allColors = new StringCollection()
                        {
                        };

                        foreach (var variationComponent in itemVariationsComponent.ChildComponents.OfType <ItemVariationComponent>())
                        {
                            var newVariation = new VariationType()
                            {
                                VariationTitle = variationComponent.DisplayName
                            };

                            var listPricingPolicy = sellableItem.GetPolicy <ListPricingPolicy>();
                            var listPrice         = listPricingPolicy.Prices.FirstOrDefault();

                            newVariation.StartPrice = new AmountType
                            {
                                currencyID = CurrencyCodeType.USD,
                                Value      = System.Convert.ToDouble(listPrice.Amount)
                            };

                            newVariation.SKU                = variationComponent.Id;
                            newVariation.Quantity           = 10;
                            newVariation.VariationSpecifics = new NameValueListTypeCollection();
                            var displayPropertiesComponent = variationComponent.GetComponent <DisplayPropertiesComponent>();

                            if (string.IsNullOrEmpty(displayPropertiesComponent.Color))
                            {
                                displayPropertiesComponent.Color = "None";
                            }

                            newVariation.VariationSpecifics.Add(new NameValueListType()
                            {
                                Name = "Color", Value = new StringCollection()
                                {
                                    displayPropertiesComponent.Color
                                }
                            });



                            if (!allColors.Contains(displayPropertiesComponent.Color))
                            {
                                allColors.Add(displayPropertiesComponent.Color);
                            }

                            item.Variations.Variation.Add(newVariation);

                            item.Variations.VariationSpecificsSet = new NameValueListTypeCollection();
                            item.Variations.VariationSpecificsSet.Add(new NameValueListType()
                            {
                                Name = "Color", Value = allColors
                            });
                        }
                        //}
                    }
                }

                //item.Variations.


                //item.Variations.Variation[0].VariationTitle = "variation1";
                //item.Variations.VariationSpecificsSet.Add(new NameValueListType());
            }
            catch (Exception ex)
            {
                context.Logger.LogError($"Ebay.PrepareItemVariationsBlock.Exception: Message={ex.Message}");
                await context.CommerceContext.AddMessage("Error", "PrepareItemVariationsBlock.Run.Exception", new Object[] { ex }, ex.Message);
            }
            return(item);
        }