Exemplo n.º 1
0
        /// <summary>
        /// Create a seller record
        /// </summary>
        /// <param name="r"></param>
        private void CreateSeller(Response r, ref List <IRecord> recList)
        {
            //for each entry in dictionary
            foreach (KeyValuePair <string, Seller> entry in r.sellers)
            {
                //set the value that we care about
                var val = entry.Value.csv;

                IncrementalNumberGenerator generator = new IncrementalNumberGenerator();
                var Id = generator.Next(); //Common.Tools.SequentialGuid.NewGuid();

                //if array is null skip
                if (val == null)
                {
                    continue;
                }

                //if even split
                if (val.Length % 2 == 0)
                {
                    //create a usable tuple from the csv
                    var tuple = ExtractRatings(val);

                    //Only gets the most recent ratings and their associated timestamps this is faster and makes more sense for multiple request over time
                    //create seller record
                    SellerRecord sellerRec = new SellerRecord(Id, entry.Value.domainId, entry.Value.trackedSince, entry.Value.lastUpdate, entry.Value.sellerId, entry.Value.sellerName, entry.Value.isScammer, entry.Value.hasFBA, entry.Value.totalStorefrontAsins[0], entry.Value.totalStorefrontAsins[1], tuple.value, tuple.time, tuple.value2, tuple.time2);

                    //add seller Record
                    recList.Add(sellerRec);

                    //if asin list is null skip
                    if (entry.Value.asinList == null)
                    {
                        continue;
                    }

                    for (int z = 0; z < entry.Value.asinList.Length; z++)
                    {
                        //create seller record
                        SellerItemRecord sellerItemRec = new SellerItemRecord(sellerRec.SellerUid, entry.Value.asinList[z], entry.Value.asinListLastSeen[z]);

                        //add seller item record
                        recList.Add(sellerItemRec);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static void ObserverPattern(string[] args)
        {
            //NumberGenerator generator = new RandomNumberGenerator();
            //var observer1 = new DigitObserver(generator);
            //var observer2 = new GraphObserver(generator);
            //generator.AddObserver(observer1);
            //generator.AddObserver(observer2);
            //generator.Execute();

            NumberGenerator incrementalNumberGenerator = new IncrementalNumberGenerator(10, 50, 5);
            var             observer3 = new DigitObserver(incrementalNumberGenerator);
            var             observer4 = new GraphObserver(incrementalNumberGenerator);

            incrementalNumberGenerator.AddObserver(observer3);
            incrementalNumberGenerator.AddObserver(observer4);
            incrementalNumberGenerator.Execute();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Default constructor for the Product Record
        /// </summary>
        /// <param name="productType"></param>
        /// <param name="asin"></param>
        /// <param name="domainId"></param>
        /// <param name="title"></param>
        /// <param name="trackingSince"></param>
        /// <param name="listedSince"></param>
        /// <param name="lastUpdate"></param>
        /// <param name="lastRatingUpdate"></param>
        /// <param name="lastPriceChange"></param>
        /// <param name="lastEbayUpdate"></param>
        /// <param name="imagesCSV"></param>
        /// <param name="rootCategory"></param>
        /// <param name="parentAsin"></param>
        /// <param name="variationCSV"></param>
        /// <param name="mpn"></param>
        /// <param name="hasReviews"></param>
        /// <param name="type"></param>
        /// <param name="manufacturer"></param>
        /// <param name="brand"></param>
        /// <param name="label"></param>
        /// <param name="department"></param>
        /// <param name="publisher"></param>
        /// <param name="productGroup"></param>
        /// <param name="partNumber"></param>
        /// <param name="author"></param>
        /// <param name="binding"></param>
        /// <param name="numberOfItems"></param>
        /// <param name="numberOfPages"></param>
        /// <param name="publicationDate"></param>
        /// <param name="releaseDate"></param>
        /// <param name="studio"></param>
        /// <param name="genre"></param>
        /// <param name="model"></param>
        /// <param name="color"></param>
        /// <param name="size"></param>
        /// <param name="edition"></param>
        /// <param name="platform"></param>
        /// <param name="format"></param>
        /// <param name="description"></param>
        /// <param name="hazardousMaterialType"></param>
        /// <param name="packageHeight"></param>
        /// <param name="packageLength"></param>
        /// <param name="packageWidth"></param>
        /// <param name="packageWeight"></param>
        /// <param name="packageQuantity"></param>
        /// <param name="availabilityAmazon"></param>
        /// <param name="isAdultProduct"></param>
        /// <param name="newPriceIsMAP"></param>
        /// <param name="isEligibleForTradeIn"></param>
        /// <param name="isEligibleForSuperSaverShipping"></param>
        /// <param name="fbaFees"></param>
        /// <param name="isRedirectASIN"></param>
        /// <param name="isSNS"></param>
        /// <param name="offersSuccessful"></param>
        public ProductRecord(int?productType, string asin, int?domainId, string title, int?trackingSince, int?listedSince, int?lastUpdate, int?lastRatingUpdate, int?lastPriceChange, int?lastEbayUpdate, string imagesCSV, long?rootCategory, string parentAsin, string variationCSV, string mpn, bool?hasReviews, string type, string manufacturer, string brand, string label, string department, string publisher, string productGroup, string partNumber, string author, string binding, int?numberOfItems, int?numberOfPages, int?publicationDate, int?releaseDate, string studio, string genre, string model, string color, string size, string edition, string platform, string format, string description, int?hazardousMaterialType, int?packageHeight, int?packageLength, int?packageWidth, int?packageWeight, int?packageQuantity, int?availabilityAmazon, bool?isAdultProduct, bool?newPriceIsMAP, bool?isEligibleForTradeIn, bool?isEligibleForSuperSaverShipping, bool?isRedirectASIN, bool?isSNS, bool?offersSuccessful)
        {
            IncrementalNumberGenerator generator = new IncrementalNumberGenerator();

            this.ProductId        = generator.Next();
            this.productType      = productType;
            this.asin             = asin;
            this.domainId         = domainId;
            this.title            = title;
            this.trackingSince    = trackingSince;
            this.listedSince      = listedSince;
            this.lastUpdate       = lastUpdate;
            this.lastRatingUpdate = lastRatingUpdate;
            this.lastPriceChange  = lastPriceChange;
            this.lastEbayUpdate   = lastEbayUpdate;
            this.imagesCSV        = imagesCSV;
            this.rootCategory     = rootCategory;
            this.parentAsin       = parentAsin;
            this.variationCSV     = variationCSV;
            this.mpn                             = mpn;
            this.hasReviews                      = hasReviews;
            this.type                            = type;
            this.manufacturer                    = manufacturer;
            this.brand                           = brand;
            this.label                           = label;
            this.department                      = department;
            this.publisher                       = publisher;
            this.productGroup                    = productGroup;
            this.partNumber                      = partNumber;
            this.author                          = author;
            this.binding                         = binding;
            this.numberOfItems                   = numberOfItems;
            this.numberOfPages                   = numberOfPages;
            this.publicationDate                 = publicationDate;
            this.releaseDate                     = releaseDate;
            this.studio                          = studio;
            this.genre                           = genre;
            this.model                           = model;
            this.color                           = color;
            this.size                            = size;
            this.edition                         = edition;
            this.platform                        = platform;
            this.format                          = format;
            this.description                     = description;
            this.hazardousMaterialType           = hazardousMaterialType;
            this.packageHeight                   = packageHeight;
            this.packageLength                   = packageLength;
            this.packageWidth                    = packageWidth;
            this.packageWeight                   = packageWeight;
            this.packageQuantity                 = packageQuantity;
            this.availabilityAmazon              = availabilityAmazon;
            this.isAdultProduct                  = isAdultProduct;
            this.newPriceIsMAP                   = newPriceIsMAP;
            this.isEligibleForTradeIn            = isEligibleForTradeIn;
            this.isEligibleForSuperSaverShipping = isEligibleForSuperSaverShipping;

            this.isRedirectASIN   = isRedirectASIN;
            this.isSNS            = isSNS;
            this.offersSuccessful = offersSuccessful;
            this.RecordType       = RecordType.Keepa;
            this.KeepaRecordType  = KeepaRecordType.ProductRecord;
            this.TimeStamp        = XModule.Tools.Utilities.GetUnixTime();
        }