Ejemplo n.º 1
0
 public JsonResult AddFeature(string addTerm)
 {
     try
     {
         Features features     = new Features();
         var      featuresName = (from Features in features.GetFeatures()
                                  where Features.features_name.StartsWith(addTerm)
                                  select new
         {
             label = Features.features_name,
             val = Features.id
         }).ToList();
         if (featuresName.Count > 0)
         {
             return(Json(featuresName, JsonRequestBehavior.AllowGet));
         }
         else
         {
             feature featureterm = new feature();
             featureterm.features_name = addTerm.ToUpper();
             featureterm.isactive      = true;
             features.AddFeature(featureterm);
             return(null);
         }
     }
     catch (Exception ex)
     {
         //handling exception
         throw ex;
     }
 }
Ejemplo n.º 2
0
        public featuress PintarUbicacio()
        {
            llistaUbicacions = _context.Ubicacio.ToList();

            featuress features = new featuress();

            features.type = "FeatureCollection";

            features.features = new List <feature>();

            foreach (Ubicacio ubicacio in llistaUbicacions)
            {
                feature feature = new feature();
                feature.type = "Feature";

                feature.Geometry                = new geometry();
                feature.Geometry.coordinates    = new double?[2];
                feature.Geometry.coordinates[0] = ubicacio.Longitud;
                feature.Geometry.coordinates[1] = ubicacio.Latitud;
                feature.Geometry.type           = "Point";

                feature.Properties             = new properties();
                feature.Properties.nomUbicacio = ubicacio.nomUbicacio;

                feature.idEstacio = ubicacio.idEstacio;

                features.features.Add(feature);
            }

            return(features);
        }
Ejemplo n.º 3
0
        public override global::System.Data.DataSet Clone()
        {
            feature cln = ((feature)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Ejemplo n.º 4
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            feature ds = new feature();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
Ejemplo n.º 5
0
        public float GetProbablity(List <float> instance)
        {
            float  prob = 1;
            string line = pose_name;

            byte [] bytes = BitConverter.GetBytes((int)mask);

            //byte [] bytes = BitConverter.GetBytes(mask);
            BitArray bits = new BitArray(bytes);

            Debug.Log("Converted to bits");

            //only look at the relevant angles
            for (int i = 0; i < instance.Count; i++)
            {
                if (bits[i])                //check if this feature is active in our mask


                //DEBUGGING :
                {
                    Debug.Log("looking at joint mask " + i);


                    feature feat     = features[i];
                    float   new_prob = feat.CalculateProbability(instance[i]);
                    line += " " + new_prob;

                    if (new_prob < .1f)
                    {
                        new_prob = .1f;
                    }
                    prob *= new_prob;
                }
            }

            /*for(int i = 0; i < features.Count && i < instance.Count; i++){
             *      feature feat = features[i];
             *      float new_prob = feat.CalculateProbability(instance[i]);
             *
             *      Debug.Log(new_prob);
             *
             *      line += " " + new_prob;
             *
             *      if(new_prob < .1f)
             *              new_prob = .1f;
             *      prob*=new_prob;
             * }*/

            line += ": " + prob;
            Debug.Log(line);
            return(prob);
        }
        public float GetProbablity(List <float> instance)
        {
            float  prob = 1;
            string line = pose_name;

            for (int i = 0; i < features.Count && i < instance.Count; i++)
            {
                feature feat     = features[i];
                float   new_prob = feat.CalculateProbability(instance[i]);

                line += " " + new_prob;

//					features[i].CalculateProbablity(instance[i]);
                if (new_prob < .1f)
                {
                    new_prob = .1f;
                }
                prob *= new_prob;
            }

            line += ": " + prob;
            //Debug.Log(line);
            return(prob);
        }
Ejemplo n.º 7
0
 public static feature Createfeature(int appId, int featureId, string featureName)
 {
     feature feature = new feature();
     feature.AppId = appId;
     feature.FeatureId = featureId;
     feature.FeatureName = featureName;
     return feature;
 }
Ejemplo n.º 8
0
 public void AddTofeatures(feature feature)
 {
     base.AddObject("features", feature);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Default constructor of Allocator
        /// </summary>
        public Allocator()
        {
            this.TopBlock = new BufferBlock <IRecord>();

            this.LinkOptions = new DataflowLinkOptions {
                PropagateCompletion = true
            };

            #region NewInsertBlocks
            this.InsertBestSellersAction = new ActionBlock <best_sellers[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.best_sellers.AddRange(a);
                    context.SaveChangesAsync();
                }
            });

            this.InsertCategoryAction = new ActionBlock <category[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.categories.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertCategoryLookupAction = new ActionBlock <category_lookup[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.category_lookup.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertCategoryTreeAction = new ActionBlock <category_tree[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.category_tree.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertEanAction = new ActionBlock <ean[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.eans.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertFbaFeesAction = new ActionBlock <fba_fees[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.fba_fees.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertFeatureAction = new ActionBlock <feature[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.features.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertFreqBoughtAction = new ActionBlock <freq_bought_together[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.freq_bought_together.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertLanguageAction = new ActionBlock <language[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    Console.WriteLine("HIT - Language");

                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.languages.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertMostRatedSellersAction = new ActionBlock <most_rated_sellers[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    Console.WriteLine("HIT - MostRatedSellers");

                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.most_rated_sellers.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertPriceHistoryAction = new ActionBlock <price_history[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    Console.WriteLine("HIT - PriceHistory");

                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.price_history.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertProductAction = new ActionBlock <product[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    Console.WriteLine("HIT - Product");

                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.products.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertSellerAction = new ActionBlock <seller[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    Console.WriteLine("HIT - Seller");
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.sellers.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertSellersListedItemsAction = new ActionBlock <sellers_listed_items[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    Console.WriteLine("HIT - SellersListedItems");
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.sellers_listed_items.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertStatisticAction = new ActionBlock <statistic[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    Console.WriteLine("HIT - Statistic");
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.statistics.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertUpcAction = new ActionBlock <upc[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    Console.WriteLine("HIT - Upc");
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.upcs.AddRange(a);
                    context.SaveChanges();
                }
            });

            this.InsertVariationAction = new ActionBlock <variation[]>(a =>
            {
                using (var context = new KeepaContext())
                {
                    Console.WriteLine("HIT - Variation");
                    //context.Configuration.AutoDetectChangesEnabled = false;
                    context.variations.AddRange(a);
                    context.SaveChanges();
                }
            });
            #endregion

            #region NewBatchBlocks
            this.bestSellerBlock      = new BatchBlock <best_sellers>(BATCH_SIZE);
            this.categoryBlock        = new BatchBlock <category>(BATCH_SIZE);
            this.categoryLookupBlock  = new BatchBlock <category_lookup>(BATCH_SIZE);
            this.categoryTreeBlock    = new BatchBlock <category_tree>(BATCH_SIZE);
            this.eanBlock             = new BatchBlock <ean>(BATCH_SIZE);
            this.fbaFeesBlock         = new BatchBlock <fba_fees>(BATCH_SIZE);
            this.featuresBlock        = new BatchBlock <feature>(BATCH_SIZE);
            this.freqBoughtBlock      = new BatchBlock <freq_bought_together>(BATCH_SIZE);
            this.languagesBlock       = new BatchBlock <language>(BATCH_SIZE);
            this.mostRatedSellerBlock = new BatchBlock <most_rated_sellers>(BATCH_SIZE);
            this.priceHistoryBlock    = new BatchBlock <price_history>(BATCH_SIZE);
            this.productBlock         = new BatchBlock <product>(BATCH_SIZE);
            //this.promotionBlock = new BatchBlock<PromotionRecord>(BATCH_SIZE);
            this.sellerItemBlock = new BatchBlock <sellers_listed_items>(BATCH_SIZE);
            this.sellerBlock     = new BatchBlock <seller>(BATCH_SIZE);
            this.statisticsBlock = new BatchBlock <statistic>(BATCH_SIZE);
            //this.topSellerBlock = new BatchBlock<TopSellersRecord>(BATCH_SIZE);
            this.upcBlock       = new BatchBlock <upc>(BATCH_SIZE);
            this.variationBlock = new BatchBlock <variation>(BATCH_SIZE);
            #endregion

            #region NewTransformBlocks
            this.BestSellerTBlock = new TransformBlock <IRecord, best_sellers>(x => {
                var dobj = (BestSellerRecord)x;
                var val  = new best_sellers(dobj.DomainId, dobj.LastUpdate, dobj.CategoryId, dobj.Asin, dobj.TimeStamp);
                return(val);
            });
            this.CategoryLookupTBlock = new TransformBlock <IRecord, category_lookup>(x =>
            {
                var dobj = (CategoryLookupRecord)x;
                var val  = new category_lookup(dobj.domainId, dobj.catId, dobj.name, dobj.children, dobj.parent, dobj.highestRank, dobj.productCount, dobj.TimeStamp);
                return(val);
            });
            this.CategoryTBlock = new TransformBlock <IRecord, category>(x => {
                var dobj = (CategoryRecord)x;
                var val  = new category(dobj.ProductId, dobj.AmznCategoryId, dobj.TimeStamp);
                return(val);
            });
            //this.CategoryTreeTBlock
            //this.DealTBlock
            this.EanTBlock = new TransformBlock <IRecord, ean>(x => {
                var dobj = (EanRecord)x;
                var val  = new ean(dobj.ProductId, dobj.EanNumber, dobj.TimeStamp);
                return(val);
            });
            this.FbaFeesTBlock = new TransformBlock <IRecord, fba_fees>(x => {
                var dobj = (FbaFeesRecord)x;
                var val  = new fba_fees(dobj.ProductId, dobj.PickPackFee, dobj.PickPackFeeTax, dobj.StorageFee, dobj.StorageFeeTax, dobj.TimeStamp);
                return(val);
            });
            this.FeatureTBlock = new TransformBlock <IRecord, feature>(x => {
                var dobj = (FeaturesRecord)x;
                var val  = new feature(dobj.ProductId, dobj.Features, dobj.TimeStamp);
                return(val);
            });
            this.FreqBoughtTBlock = new TransformBlock <IRecord, freq_bought_together>(x => {
                var dobj = (FreqBoughtTogetherRecord)x;
                var val  = new freq_bought_together(dobj.ProductId, dobj.AssociatedAsin, dobj.TimeStamp);
                return(val);
            });
            this.LanguageTBlock = new TransformBlock <IRecord, language>(x => {
                var dobj = (LanguagesRecord)x;
                var val  = new language(dobj.ProductId, dobj.LanguageName, dobj.LanguageType, dobj.AudioFormat, dobj.TimeStamp);
                return(val);
            });
            this.MostRatedSellersTBlock = new TransformBlock <IRecord, most_rated_sellers>(x => {
                var dobj = (MostRatedSellersRecord)x;
                var val  = new most_rated_sellers(dobj.AmznSellerIdentifier, dobj.TimeStamp);
                return(val);
            });
            this.PriceHistoryTBlock = new TransformBlock <IRecord, price_history>(x => {
                var dobj = (PriceHistoryRecord)x;
                var val  = new price_history(dobj.ProductId, dobj.obHistoryType, dobj.obDate, dobj.obPrice, dobj.obShipping, dobj.TimeStamp);
                return(val);
            });
            this.ProductTBlock = new TransformBlock <IRecord, product>(x =>
            {
                var dobj = (ProductRecord)x;
                var val  = new product(dobj.ProductId, dobj.productType.ToString(), dobj.asin, dobj.domainId, dobj.title, dobj.trackingSince, dobj.listedSince, dobj.lastUpdate,
                                       dobj.lastRatingUpdate, dobj.lastPriceChange, dobj.lastEbayUpdate, dobj.imagesCSV, dobj.rootCategory, dobj.parentAsin, dobj.variationCSV, dobj.mpn, dobj.hasReviews,
                                       dobj.type, dobj.manufacturer, dobj.brand, dobj.label, dobj.department, dobj.publisher, dobj.productGroup, dobj.partNumber, dobj.author, dobj.binding,
                                       dobj.numberOfItems, dobj.numberOfPages, dobj.publicationDate, dobj.releaseDate, dobj.studio, dobj.genre, dobj.model, dobj.color, dobj.size, dobj.edition,
                                       dobj.platform, dobj.format, dobj.description, dobj.hazardousMaterialType, dobj.packageHeight, dobj.packageLength, dobj.packageWidth, dobj.packageWeight, dobj.packageQuantity, dobj.availabilityAmazon,
                                       dobj.isAdultProduct, dobj.newPriceIsMAP, dobj.isEligibleForTradeIn, dobj.isEligibleForSuperSaverShipping, dobj.isRedirectASIN, dobj.isSNS, dobj.offersSuccessful, dobj.TimeStamp);
                return(val);
            });
            this.SellerTBlock = new TransformBlock <IRecord, seller>(x => {
                var dobj = (SellerRecord)x;
                var val  = new seller(dobj.SellerUid, dobj.DomainId, dobj.TrackingSince, dobj.LastUpdate, dobj.SellerId, dobj.SellerName, dobj.IsScammer, dobj.HasFba,
                                      dobj.TotalStoreFrontAsinRecTime, dobj.TotalStoreFrontAsins, dobj.Rating, dobj.RatingTime, dobj.RatingCount, dobj.RatingCountTime, dobj.TimeStamp);
                return(val);
            });
            this.SellerListedItemsTBlock = new TransformBlock <IRecord, sellers_listed_items>(x => {
                var dobj = (SellerItemRecord)x;
                var val  = new sellers_listed_items(dobj.AssociatedSeller, dobj.Asin, dobj.AsinLastSeen, dobj.TimeStamp);
                return(val);
            });
            this.StatisticsTBlock = new TransformBlock <IRecord, statistic>(x => {
                var dobj = (StatisticsRecord)x;
                var val  = new statistic(dobj.ProductId, dobj.StatType, dobj.Current, dobj.Avg, dobj.Avg30, dobj.Avg90, dobj.Avg180, dobj.AtIntervalStart, dobj.MinPriceType, dobj.MinPriceRecTime,
                                         dobj.MinPriceValue, dobj.MaxPriceType, dobj.MaxPriceRecTime, dobj.MaxPriceValue, dobj.IntervalMinPriceType, dobj.IntervalMinPriceRecTime, dobj.IntervalMinPriceValue,
                                         dobj.IntervalMaxPriceType, dobj.IntervalMaxPriceRecTime, dobj.IntervalMaxPriceValue, dobj.OutOfStockPercentageInInterval, dobj.OutOfStockPercentage30, dobj.OutOfStockPercentage90,
                                         dobj.LastOffersUpdate, dobj.TotalOffersCount, dobj.LightningDealInfo, dobj.RetrievedOfferCount, dobj.BuyBoxPrice, dobj.BuyBoxShipping, dobj.BuyBoxIsUnqualified,
                                         dobj.BuyBoxIsShippable, dobj.BuyBoxIsPreorder, dobj.BuyBoxIsFba, dobj.BuyBoxIsAmazon, dobj.BuyBoxIsMap, dobj.BuyBoxIsUsed, dobj.SellerIdsLowestFba, dobj.SellerIdsLowestFbm,
                                         dobj.OfferCountFba, dobj.OfferCountFbm, dobj.TimeStamp);
                return(val);
            });
            this.UpcTBlock = new TransformBlock <IRecord, upc>(x => {
                var dobj = (UpcRecord)x;
                var val  = new upc(dobj.ProductId, dobj.UpcNumber, dobj.TimeStamp);
                return(val);
            });
            this.VariationTBlock = new TransformBlock <IRecord, variation>(x => {
                var dobj = (VariationRecord)x;
                var val  = new variation(dobj.productId, dobj.Variation, dobj.vDimension, dobj.vValue, dobj.TimeStamp);
                return(val);
            });
            #endregion

            #region NewFilters
            this.CategoryLookupFilter     = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.CategoryLookupRecord); };
            this.BestSellerFilter         = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.BestSellerRecord); };
            this.CategoryFilter           = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.CategoryRecord); };
            this.CategoryTreeFilter       = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.CategoryTreeRecord); };
            this.DealFilter               = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.DealRecord); };
            this.EanFilter                = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.EanRecord); };
            this.FbaFeesFilter            = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.FbaFeesRecord); };
            this.FeatureFilter            = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.FeaturesRecord); };
            this.FreqBoughtTogetherFilter = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.FrequentlyBoughtTogetherRecord); };
            this.LanguageFilter           = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.LanguagesRecord); };
            this.MRSFilter                = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.TopSellerRecord); };
            this.PriceHistoryFilter       = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.PriceHistoryRecord); };
            this.ProductFilter            = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.ProductRecord); };
            this.SellerFilter             = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.SellerRecord); };
            this.SLIFilter                = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.SellerItemRecord); };
            this.StatisticsFilter         = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.StatisitcsRecord); };
            this.UpcFilter                = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.UpcRecord); };
            this.VariationFilter          = (IRecord r) => { return(r.KeepaRecordType == KeepaRecordType.VariationsRecord); };
            #endregion

            //Dataflow Links
            #region Links
            //set up links using propogate oncompletion and appropriate filters
            #region TopToTransform
            this.TopBlock.LinkTo(this.BestSellerTBlock, this.LinkOptions, this.BestSellerFilter);
            this.TopBlock.LinkTo(this.CategoryTBlock, this.LinkOptions, this.CategoryFilter);
            this.TopBlock.LinkTo(this.CategoryLookupTBlock, this.LinkOptions, this.CategoryLookupFilter);
            this.TopBlock.LinkTo(this.EanTBlock, this.LinkOptions, this.EanFilter);
            this.TopBlock.LinkTo(this.FbaFeesTBlock, this.LinkOptions, this.FbaFeesFilter);
            this.TopBlock.LinkTo(this.FeatureTBlock, this.LinkOptions, this.FeatureFilter);
            this.TopBlock.LinkTo(this.FreqBoughtTBlock, this.LinkOptions, this.FreqBoughtTogetherFilter);
            this.TopBlock.LinkTo(this.LanguageTBlock, this.LinkOptions, this.LanguageFilter);
            this.TopBlock.LinkTo(this.MostRatedSellersTBlock, this.LinkOptions, this.MRSFilter);
            this.TopBlock.LinkTo(this.PriceHistoryTBlock, this.LinkOptions, this.PriceHistoryFilter);
            this.TopBlock.LinkTo(this.ProductTBlock, this.LinkOptions, this.ProductFilter);
            this.TopBlock.LinkTo(this.SellerTBlock, this.LinkOptions, this.SellerFilter);
            this.TopBlock.LinkTo(this.SellerListedItemsTBlock, this.LinkOptions, this.SLIFilter);
            this.TopBlock.LinkTo(this.StatisticsTBlock, this.LinkOptions, this.StatisticsFilter);
            this.TopBlock.LinkTo(this.UpcTBlock, this.LinkOptions, this.UpcFilter);
            this.TopBlock.LinkTo(this.VariationTBlock, this.LinkOptions, this.VariationFilter);
            #endregion
            //attach transforms to batch
            #region TransformToBatch
            this.BestSellerTBlock.LinkTo(this.bestSellerBlock, this.LinkOptions);
            this.CategoryTBlock.LinkTo(this.categoryBlock, this.LinkOptions);
            this.CategoryLookupTBlock.LinkTo(this.categoryLookupBlock, this.LinkOptions);
            this.EanTBlock.LinkTo(this.eanBlock, this.LinkOptions);
            this.FbaFeesTBlock.LinkTo(this.fbaFeesBlock, this.LinkOptions);
            this.FeatureTBlock.LinkTo(this.featuresBlock, this.LinkOptions);
            this.FreqBoughtTBlock.LinkTo(this.freqBoughtBlock, this.LinkOptions);
            this.LanguageTBlock.LinkTo(this.languagesBlock, this.LinkOptions);
            this.MostRatedSellersTBlock.LinkTo(this.mostRatedSellerBlock, this.LinkOptions);
            this.PriceHistoryTBlock.LinkTo(this.priceHistoryBlock, this.LinkOptions);
            this.ProductTBlock.LinkTo(this.productBlock, this.LinkOptions);
            this.SellerTBlock.LinkTo(this.sellerBlock, this.LinkOptions);
            this.SellerListedItemsTBlock.LinkTo(this.sellerItemBlock, this.LinkOptions);
            this.StatisticsTBlock.LinkTo(this.statisticsBlock, this.LinkOptions);
            this.UpcTBlock.LinkTo(this.upcBlock, this.LinkOptions);
            this.VariationTBlock.LinkTo(this.variationBlock, this.LinkOptions);
            #endregion
            //insert delegate for batches
            #region BatchToInsert
            this.bestSellerBlock.LinkTo(InsertBestSellersAction, this.LinkOptions);
            this.bestSellerBlock.Completion.ContinueWith(delegate
            {
                InsertBestSellersAction.Complete();
                InsertBestSellersAction.Completion.Wait();
            });

            this.categoryBlock.LinkTo(InsertCategoryAction, this.LinkOptions);
            this.categoryBlock.Completion.ContinueWith(delegate
            {
                InsertCategoryAction.Complete();
                InsertCategoryAction.Completion.Wait();
            });

            this.categoryLookupBlock.LinkTo(InsertCategoryLookupAction, this.LinkOptions);
            this.categoryLookupBlock.Completion.ContinueWith(delegate
            {
                InsertCategoryLookupAction.Complete();
                InsertCategoryLookupAction.Completion.Wait();
            });

            this.categoryTreeBlock.LinkTo(InsertCategoryTreeAction, this.LinkOptions);
            this.categoryTreeBlock.Completion.ContinueWith(delegate
            {
                InsertCategoryTreeAction.Complete();
                InsertCategoryTreeAction.Completion.Wait();
            });

            this.eanBlock.LinkTo(InsertEanAction, this.LinkOptions);
            this.eanBlock.Completion.ContinueWith(delegate
            {
                InsertEanAction.Complete();
                InsertEanAction.Completion.Wait();
            });

            this.fbaFeesBlock.LinkTo(InsertFbaFeesAction, this.LinkOptions);
            this.fbaFeesBlock.Completion.ContinueWith(delegate
            {
                InsertFbaFeesAction.Complete();
                InsertFbaFeesAction.Completion.Wait();
            });

            this.featuresBlock.LinkTo(InsertFeatureAction, this.LinkOptions);
            this.featuresBlock.Completion.ContinueWith(delegate
            {
                InsertFeatureAction.Complete();
                InsertFeatureAction.Completion.Wait();
            });

            this.freqBoughtBlock.LinkTo(InsertFreqBoughtAction, this.LinkOptions);
            this.freqBoughtBlock.Completion.ContinueWith(delegate
            {
                InsertFreqBoughtAction.Complete();
                InsertFreqBoughtAction.Completion.Wait();
            });

            this.languagesBlock.LinkTo(InsertLanguageAction, this.LinkOptions);
            this.languagesBlock.Completion.ContinueWith(delegate
            {
                InsertLanguageAction.Complete();
                InsertLanguageAction.Completion.Wait();
            });

            this.mostRatedSellerBlock.LinkTo(InsertMostRatedSellersAction, this.LinkOptions);
            this.mostRatedSellerBlock.Completion.ContinueWith(delegate
            {
                InsertMostRatedSellersAction.Complete();
                InsertMostRatedSellersAction.Completion.Wait();
            });

            this.priceHistoryBlock.LinkTo(InsertPriceHistoryAction, this.LinkOptions);
            this.priceHistoryBlock.Completion.ContinueWith(delegate
            {
                InsertPriceHistoryAction.Complete();
                InsertPriceHistoryAction.Completion.Wait();
            });

            this.productBlock.LinkTo(InsertProductAction, this.LinkOptions);
            this.productBlock.Completion.ContinueWith(delegate
            {
                InsertProductAction.Complete();
                InsertProductAction.Completion.Wait();
            });

            this.sellerItemBlock.LinkTo(InsertSellersListedItemsAction, this.LinkOptions);
            this.sellerItemBlock.Completion.ContinueWith(delegate
            {
                InsertSellersListedItemsAction.Complete();
                InsertSellersListedItemsAction.Completion.Wait();
            });

            this.sellerBlock.LinkTo(InsertSellerAction, this.LinkOptions);
            this.sellerBlock.Completion.ContinueWith(delegate
            {
                InsertSellerAction.Complete();
                InsertSellerAction.Completion.Wait();
            });

            this.statisticsBlock.LinkTo(InsertStatisticAction, this.LinkOptions);
            this.statisticsBlock.Completion.ContinueWith(delegate
            {
                InsertStatisticAction.Complete();
                InsertStatisticAction.Completion.Wait();
            });

            this.upcBlock.LinkTo(InsertUpcAction, this.LinkOptions);
            this.upcBlock.Completion.ContinueWith(delegate
            {
                InsertUpcAction.Complete();
                InsertUpcAction.Completion.Wait();
            });

            this.variationBlock.LinkTo(InsertVariationAction, this.LinkOptions);
            this.variationBlock.Completion.ContinueWith(delegate
            {
                InsertVariationAction.Complete();
                InsertVariationAction.Completion.Wait();
            });

            #endregion
            #endregion
        }
Ejemplo n.º 10
0
        public Sequence(XmlTextReader xreader)
        {
            string thisName = "";
            bool addVal = false;
            featurelist.Clear();
            feature newFeat = new feature();
            while (xreader.Read())
            {
                switch (xreader.NodeType)
                {
                    case XmlNodeType.Element:
                        thisName = xreader.Name;
                        break;

                    case XmlNodeType.Text:
                        switch (thisName)
                        {
                            case "GBFeature_key":
                                string featName = xreader.Value.Replace('_', ' ');
                                List<Sequence.feature> results = featurelist.FindAll(x => x.name.Contains(featName));
                                newFeat.notes = "";
                                if (results.Count != 0)
                                {
                                    newFeat.name = featName + "(" + results.Count + ")";
                                    break;
                                }
                                newFeat.name = featName;
                                break;

                            case "GBInterval_from":
                                newFeat.start = Int32.Parse(xreader.Value);
                                break;

                            case "GBInterval_to":
                                newFeat.end = Int32.Parse(xreader.Value);
                                break;

                            case "GBSeq_strandedness":
                                stranded = xreader.Value;
                                break;

                            case "GBSeq_moltype":
                                moltype = xreader.Value;
                                break;

                            case "GBSeq_topology":
                                topology = xreader.Value;
                                break;

                            case "GBSeq_definition":
                                def = xreader.Value;
                                break;

                            case "GBReference_pubmed":
                                if(abrID == null) abrID = xreader.Value;
                                break;

                            case "GBSeq_organism":
                                organism = xreader.Value;
                                break;

                            case "GBSeq_sequence":
                                setSEQ(xreader.Value);
                                break;

                            case "GBSeq_primary-accession":
                                setAccession(xreader.Value);
                                break;

                            case "GBQualifier_name":
                                if (xreader.Value == "gene")
                                {
                                    addVal = true;
                                    newFeat.notes += "-> From gene ";
                                }
                                else if (xreader.Value == "product")
                                {
                                    addVal = true;
                                    newFeat.notes += "-> This codes for ";
                                } else if (xreader.Value == "regulatory_class") {
                                    addVal = true;
                                    newFeat.notes += "-> Type of regulation: ";
                                } else if (xreader.Value == "note") {
                                    addVal = true;
                                    newFeat.notes += "-> ";
                                }
                                break;

                            case "GBQualifier_value":
                                if (addVal)
                                {
                                    newFeat.notes += xreader.Value.Replace('_', ' ') + "\r\n";
                                    addVal = false;
                                }
                                break;
                            default:
                                break;
                        }
                        Console.WriteLine(xreader.Value);
                        break;

                    case XmlNodeType.EndElement:
                        if (xreader.Name == "GBFeature")
                        {
                            if (newFeat.name == "source") { break; }
                            featurelist.Add(newFeat);
                        }
                        break;

                    default:
                        break;
                }
            }
        }
Ejemplo n.º 11
0
 foreach (var(feature, enabled) in features)
Ejemplo n.º 12
0
 if (IsClassNameExist(feature, className))
 {
     return(feature.SingleOrDefault(t => (t.Item1 as string) == (className)).Item2);
Ejemplo n.º 13
0
        public Sequence(XmlTextReader xreader)
        {
            string thisName = "";
            bool   addVal   = false;

            featurelist.Clear();
            feature newFeat = new feature();

            while (xreader.Read())
            {
                switch (xreader.NodeType)
                {
                case XmlNodeType.Element:
                    thisName = xreader.Name;
                    break;

                case XmlNodeType.Text:
                    switch (thisName)
                    {
                    case "GBFeature_key":
                        string featName = xreader.Value.Replace('_', ' ');
                        List <Sequence.feature> results = featurelist.FindAll(x => x.name.Contains(featName));
                        newFeat.notes = "";
                        if (results.Count != 0)
                        {
                            newFeat.name = featName + "(" + results.Count + ")";
                            break;
                        }
                        newFeat.name = featName;
                        break;

                    case "GBInterval_from":
                        newFeat.start = Int32.Parse(xreader.Value);
                        break;

                    case "GBInterval_to":
                        newFeat.end = Int32.Parse(xreader.Value);
                        break;

                    case "GBSeq_strandedness":
                        stranded = xreader.Value;
                        break;

                    case "GBSeq_moltype":
                        moltype = xreader.Value;
                        break;

                    case "GBSeq_topology":
                        topology = xreader.Value;
                        break;

                    case "GBSeq_definition":
                        def = xreader.Value;
                        break;

                    case "GBReference_pubmed":
                        if (abrID == null)
                        {
                            abrID = xreader.Value;
                        }
                        break;

                    case "GBSeq_organism":
                        organism = xreader.Value;
                        break;

                    case "GBSeq_sequence":
                        setSEQ(xreader.Value);
                        break;

                    case "GBSeq_primary-accession":
                        setAccession(xreader.Value);
                        break;

                    case "GBQualifier_name":
                        if (xreader.Value == "gene")
                        {
                            addVal         = true;
                            newFeat.notes += "-> From gene ";
                        }
                        else if (xreader.Value == "product")
                        {
                            addVal         = true;
                            newFeat.notes += "-> This codes for ";
                        }
                        else if (xreader.Value == "regulatory_class")
                        {
                            addVal         = true;
                            newFeat.notes += "-> Type of regulation: ";
                        }
                        else if (xreader.Value == "note")
                        {
                            addVal         = true;
                            newFeat.notes += "-> ";
                        }
                        break;

                    case "GBQualifier_value":
                        if (addVal)
                        {
                            newFeat.notes += xreader.Value.Replace('_', ' ') + "\r\n";
                            addVal         = false;
                        }
                        break;

                    default:
                        break;
                    }
                    Console.WriteLine(xreader.Value);
                    break;

                case XmlNodeType.EndElement:
                    if (xreader.Name == "GBFeature")
                    {
                        if (newFeat.name == "source")
                        {
                            break;
                        }
                        featurelist.Add(newFeat);
                    }
                    break;

                default:
                    break;
                }
            }
        }
Ejemplo n.º 14
0
        public void Save(int id, string price, string capacity, string numberOfRooms, feature selectedFeature, account cont)
        {
            HotelEntities context = new HotelEntities();

            if (id == -1)
            {
                context.AddRoom(int.Parse(capacity), int.Parse(numberOfRooms), int.Parse(price), selectedFeature.id);
                context.SaveChanges();
            }
            else
            {
                context.ModifyRoom(id, int.Parse(numberOfRooms), int.Parse(price), selectedFeature.id, int.Parse(capacity));
                context.SaveChanges();
            }
            MainViewModel.Instance.ActiveScreen = new RoomsViewModel(cont);
        }
Ejemplo n.º 15
0
        public ActionResult Details(int id)
        {
            try
            {
                //Check Authentication
                if (Session["user"] == null)
                {
                    return(RedirectToAction("Index", "Login"));
                }
                //Object Initiliaze
                ListingModel model       = new ListingModel();
                Listings     lstdetails  = new Listings();
                listing      objlisting  = new listing();
                Features     objfeatures = new Features();
                Buildings    objBuilding = new Buildings();
                List <ListingFeaturesControl> lstListingFeaturesControl = new List <ListingFeaturesControl>();
                BuildingFeatures objbuildingfeatures = new BuildingFeatures();
                List <feature>   lstfeat             = new List <feature>();
                objlisting = lstdetails.GetListing(id);

                //Start performing the logic section
                List <buildingfeature> newobjBuildingFeatures = objbuildingfeatures.GetBuildingFeature(objlisting.buildingid);
                foreach (var item in newobjBuildingFeatures)
                {
                    feature objfeat = objfeatures.GetFeatureById(item.id);
                    lstfeat.Add(objfeat);
                }
                foreach (var item in lstfeat)
                {
                    ListingFeaturesControl objListFeat = new ListingFeaturesControl();
                    if (string.IsNullOrEmpty(Convert.ToString(objListFeat)))
                    {
                        objListFeat.features_name = item.features_name;
                        objListFeat.id            = item.id;
                        lstListingFeaturesControl.Add(objListFeat);
                    }
                }
                var building = objBuilding.GetBuilding(objlisting.buildingid);
                model.BuildingName  = building.Name;
                model.Features      = lstListingFeaturesControl;
                model.Address       = objlisting.address;
                model.id            = objlisting.id;
                model.Price         = Convert.ToInt32(objlisting.price);
                model.PropertyType  = objlisting.propertytype;
                model.Layout        = objlisting.layout;
                model.Bathroom      = objlisting.bathroom;
                model.Sqft          = objlisting.sqft;
                model.property_type = objlisting.property_type;
                if (objlisting.property_type == "Residential")
                {
                    model.res_type_str = objlisting.res_type;
                }
                else
                {
                    model.com_type_str = objlisting.com_type;
                }
                model.OwnershipType    = objlisting.ownershiptype;
                model.UnitNumber       = objlisting.unitnumber;
                model.FloorNumber      = objlisting.floornumber;
                model.createdAt        = (DateTime)objlisting.createddate;
                model.PetPolicyListstr = objlisting.petpolicy;
                model.Minleaseterm     = objlisting.minleaseterm;
                model.DateAvailable    = (DateTime)objlisting.dateavailable;
                ListingUploads getObjListingUpload = new ListingUploads();

                var filename = getObjListingUpload.GetListingUploadById(objlisting.id, "PHOTOS").Select(t => t.image).FirstOrDefault();
                if (!string.IsNullOrEmpty(filename))
                {
                    var filenamestr = filename.Split('\\');
                    ViewBag.PhotosList = filenamestr[6];
                }
                else
                {
                    ViewBag.PhotosList = "Desert.jpg";
                }
                ViewBag.PhotoCount = getObjListingUpload.GetListingUploadById(objlisting.id, "PHOTOS").Count.ToString();
                return(View(model));
            }
            catch (Exception ex)
            {
                //handling exception
                throw ex;
            }
        }
Ejemplo n.º 16
0
 foreach (var(feature, zoom, layerName) in featuresZoomAndLayer)
Ejemplo n.º 17
0
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                feature ds = new feature();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "BrandTableDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }