Пример #1
0
 public ProductTypeRowModel(ProductType type)
 {
     this.Id = type.Id;
     this.Name = type.Name;
     this.SkuAlias = type.SkuAlias;
     this.IsEnabled = type.IsEnabled;
 }
Пример #2
0
 private void LoadCB()
 {
     ProductType product = new ProductType();
     typeCB.DataSource = product.GetAllProductTypeQuery();
     typeCB.DisplayMember = "Name";
     typeCB.ValueMember = "ID";
 }
Пример #3
0
        private ProductType CreateProductType()
        {
            ProductType p = new ProductType();
            p.TName = txtbox_TName.Text;

            return p;
        }
Пример #4
0
    /// <summary>
    /// Submit button click event
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        ProductTypeAdmin prodTypeAdmin = new ProductTypeAdmin();
        ProductType prodType = new ProductType();
        prodType.ProductTypeId = ItemId;
        prodType.PortalId  = ZNodeConfigManager.SiteConfig.PortalID ;
        prodType.Name = Name.Text;
        prodType.Description = Description.Text;
        prodType.DisplayOrder = Convert.ToInt32(DisplayOrder.Text);

        bool check = false;

        if (ItemId > 0)
        {

            check = prodTypeAdmin.Update(prodType);
        }
        else
        {
            check = prodTypeAdmin.Add(prodType);
        }

        if (check)
        {
            //redirect to main page
            Response.Redirect("list.aspx");
        }
        else
        {
            //display error message
            lblError.Text = "An error occurred while updating. Please try again.";
        }
    }
 private ProductType createProductType()
 {
     //access productType db
     ProductType p = new ProductType();
     p.TypeDescreption = TextBoxProductDesc.Text;
     return p;
 }
Пример #6
0
        public int CreateUpdateProductTypeServices(ProductType ud)
        {
            int ProductTypeID = 0;
            using (FDBEntities db = new FDBEntities())
            {
                if (ud.ProductTypeID > 0)
                {
                    ProductType temp = db.ProductTypes.Where(u => u.ProductTypeID == ud.ProductTypeID).FirstOrDefault();

                    if (temp != null)
                    {
                        temp.Description = ud.Description;
                    }
                }
                else
                {
                    db.ProductTypes.Add(ud);
                }

                int x = db.SaveChanges();
                if (x > 0)
                {
                    ProductTypeID = ud.ProductTypeID;
                }
            }

            return ProductTypeID;
        }
        public static Product FindProduct(ProductType type, string product, string version, string revision)
        {
            var products = type == ProductType.Standalone ? ProductManager.StandaloneProducts : ProductManager.Modules;
              if (!string.IsNullOrEmpty(product))
              {
            products = products.Where(x => x.Name.Equals(product, StringComparison.OrdinalIgnoreCase));
              }

              if (!string.IsNullOrEmpty(version))
              {
            products = products.Where(x => x.Version == version);
              }
              else
              {
            products = products.OrderByDescending(x => x.Version);
              }

              if (!string.IsNullOrEmpty(revision))
              {
            products = products.Where(x => x.Revision == revision);
              }
              else
              {
            products = products.OrderByDescending(x => x.Revision);
              }

              var distributive = products.FirstOrDefault();
              return distributive;
        }
Пример #8
0
        /// <summary>
        /// Creates a new LineItem
        /// </summary>
        /// <param name="title">A title describing the product </param>
        /// <param name="price">The product price in the currency matching the one used in the whole order and set in the "Currency" field</param>
        /// <param name="quantityPurchased">Quantity purchased of the item</param>
        /// <param name="productId">The Product ID number (optional)</param>
        /// <param name="sku">The stock keeping unit of the product (optional)</param>
        public LineItem(string title,
            double price,
            int quantityPurchased,
            //optional
            string productId = null,
            string sku = null,
            string condition = null,
            bool? requiresShipping = null,
            Seller seller = null,
            DeliveredToType? deliveredTo = null,
            DateTime? delivered_at = null,
            ProductType? productType = null,
            string brand = null,
            string category = null,
            string subCategory = null)
        {
            Title = title;
            Price = price;
            QuantityPurchased = quantityPurchased;

            // optional
            ProductId = productId;
            Sku = sku;
            Condition = condition;
            RequiresShipping = requiresShipping;
            Seller = seller;
            DeliveredTo = deliveredTo;
            ProductType = productType;
            Category = category;
            SubCategory = subCategory;
            DeliveredAt = delivered_at;
            Brand = brand;
        }
Пример #9
0
        private ProductType CreateProductType()
        {
            ProductType item = new ProductType();
            item.Name = CategoryName.Text;

            return item;
        }
Пример #10
0
 // Dependency to ensure product have necessary values.
 public Product(string code, string name, ProductType type, float price)
 {
     Code = code;
     Name = name;
     Type = type;
     Price = price;
 }
 public InappProductStrings(string pdtId, ProductType pdtType, string shortName)
 {
     DefaultProductId = pdtId;
     DefaultProductType = pdtType;
     DefaultProductShortName = shortName;
     //OverrideIdsByStore = new Dictionary<string, List<string>>();
 }
Пример #12
0
        public static Product Create(ProductType productType)
        {
            Product product = null;

            switch (productType)
            {
                case ProductType.Apple:
                    {
                        product = new AppleProduct();
                        break;
                    }
                case ProductType.Berry:
                    {
                        product = new BerryProduct();
                        break;
                    }
                case ProductType.Cherry:
                    {
                        product = new CherryProduct();
                        break;
                    }
            }

            return product;
        }
    private ProductType createProductType() {
        ProductType p = new ProductType();

        p.Name = txtName.Text;

        return p;
    }
Пример #14
0
 public Product(string productCode, string productName, string quotaType, ProductType productType, int quantity)
 {
     this.ProductName = productName;
     this.Quantity = quantity;
     this.ProductCode = productCode;
     this.QuotaType = quotaType;
     this.ProdType = productType;
 }
Пример #15
0
 public void CalcSalesTaxTest()
 {
     ProductType productType = new ProductType(); // TODO: Initialize to an appropriate value
     Decimal expected = 110.0m;
     Decimal actual;
     actual = Class1.CalcSalesTax(productType);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Пример #16
0
 protected FarmUnit(string id, int health, int productionQuantity, 
     ProductType productType, int healthEffect)
     : base(id)
 {
     this.Health = health;
     this.ProductionQuantity = productionQuantity;
     this.ProductType = productType;
     this.healthEffect = healthEffect;
 }
Пример #17
0
        public List<ImportErrorMessage> InsertImportPriceListRecord(CanonDataContext db)
        {
            List<ImportErrorMessage> warnings = new List<ImportErrorMessage>();

            // CanonDataContext db = Cdb.Instance;

            // Create Product Group if it doesn't exist yet
            ProductGroup productGroup = db.ProductGroups.FirstOrDefault(pg => pg.Code == this.ProductCategory);
            if (productGroup == null)
            {
                productGroup = new ProductGroup();
                productGroup.Code = this.ProductCategory;
                productGroup.FileAs = "Nová_" + this.ProductCategory;

                db.ProductGroups.InsertOnSubmit(productGroup);
            }

            // create Product type if it doesn't exist in DB yet
            ProductType pType = db.ProductTypes.FirstOrDefault(pt => pt.Type == this.ProductType);
            if (pType == null)
            {
                pType = new ProductType();
                pType.Type = this.ProductType;

                db.ProductTypes.InsertOnSubmit(pType);
            }

            // update product
            Product product = db.Products.FirstOrDefault(p => p.ProductCode == this.ProductCode);
            if (product == null)
            {
                product = new Product();
                product.IsActive = true;

                db.Products.InsertOnSubmit(product);
            }

            product.ProductCode = this.ProductCode;
            product.ProductName = this.ProductName;
            product.ProductGroup = productGroup;
            product.CurrentPrice = this.ListPrice;
            product.ProductType = pType;

            // insert ImportPriceListRecord
            ImportPriceListRecord record = new ImportPriceListRecord();
            record.IDImportPriceList = this.ImportPriceList.ID;
            record.ListPrice = this.ListPrice;
            record.ProductCode = this.ProductCode;
            record.ProductName = this.ProductName;
            record.ProductCategory = this.ProductCategory;
            record.ProductType = this.ProductType;

            db.ImportPriceListRecords.InsertOnSubmit(record);
            db.SubmitChanges();

            return warnings;
        }
        public void Update(ProductType productType)
        {
            //Fetch object from db
            ProductType p = db.ProductTypes.Find(productType.ID);

            p.Name = productType.Name;

            db.SaveChanges();
        }
Пример #19
0
 public BuyCommand(Guid id, Guid tradingDayId, Tso tso, ProductType productType, DateTime begin, decimal volume)
 {
     Id = id;
     TradingDayId = tradingDayId;
     Tso = tso;
     ProductType = productType;
     Begin = begin;
     Volume = volume;
 }
Пример #20
0
 protected FarmUnit(string id, int health, int productionQuantity, ProductType productType)
     : base(id)
 {
     this.productId = id + "Product";
     this.Health = health;
     this.ProductionQuantity = productionQuantity;
     this.productType = productType;
     this.isAlive = true;
 }
Пример #21
0
        public ProductVariantModel CreateDefaultVariantModel(ProductType productType)
        {
            var variant = new ProductVariantModel();
            foreach (var fieldDef in productType.VariantFieldDefinitions)
            {
                variant.VariantFields.Add(fieldDef.Name, null);
            }

            return variant;
        }
Пример #22
0
 public ModisSourceProduct(string name, string baseUrl, SatelliteType sateType, 
                             ProductType prodType, ProjectType projType, int days)
 {
     productName = name;
     baseFtpUrl = baseUrl;
     satellite = sateType;
     productType = prodType;
     projectType = projType;
     observeInterval = days;
 }
Пример #23
0
 public IAPProduct(string name, string description, string item_id, int amount, int price, ProductType payingCurrency, ProductType productItemTye)
 {
     this.name = name;
     this.description = description;
     this.item_id = item_id;
     this.amount = amount;
     this.price = price;
     this.payingCurrency = payingCurrency;
     this.productItemTye = productItemTye;
 }
 public Strategy_Product_Code_Count_Datum(
     StrategyType st, 
     ProductType pt, 
     String code, 
     long count)
 {
     this._StrategyType = st;
     this._ProductType = pt;
     this.Code = code;
     this.Count = count;
 }
 public void AddNewAccessories(ProductType type, String productName, int productPrice)
 {
     if (type == ProductType.Bags)
     {
         AddNewVivienneBags(productName, productPrice);
     }
     else if (type == ProductType.Shoes)
     {
         AddNewVivienneShoes(productName, productPrice);
     }
 }
Пример #26
0
 public Product CreateProduct(ProductType productType) {
     Product product = default(Product);
     switch (productType) { 
         case ProductType.ProductA:
             product = new ConcreateProductA();
             break;
         case ProductType.ProductB:
             product = new ConcreateProductB();
             break;
     }
     return product;
 }
 public virtual BaseAccessories CreateNewAccessory(ProductType type, String productName, int productPrice)
 {
     if (type == ProductType.Bags)
     {
         return new SimpleFactoryVivienneBags(productName, productPrice);
     }
     else if(type == ProductType.Shoes)
     {
         return new SimpleFactoryVivienneShoes(productName, productPrice);
     }
     return null;
 }
Пример #28
0
        private ViewResult GetProductSearchResult(ProductType type)
        {
            List<Product> searchResult = new List<Product> ();
            searchResult.AddRange (ApplicationContext.ProductService.GetProductsByType (type));

            ProductsPageModel model = new ProductsPageModel
            {
                Products = searchResult
            };

            return View ("SearchResult", model);
        }
 protected void AddProductType(ProductType value)
 {
     if (QueryParameters.ContainsKey(Constants.ProductTypesKey))
     {
         QueryParameters[Constants.ProductTypesKey] = value == ProductType.None
             ? value
             : (ProductType) QueryParameters[Constants.ProductTypesKey] | value;
     }
     else
     {
         QueryParameters.Add(Constants.ProductTypesKey, value);
     }
 }
Пример #30
0
 public bool CheckDataIfExists(ProductType entity)
 {
     var parameter = new Dictionary<string, object>();
     parameter.Add("Code", entity.Code);
     parameter.Add("Name", entity.Name);
     parameter.Add("Active", entity.Active);
     List<ProductType> process = _productTypeRepository.CheckIfDataExists(parameter);
     if (process.Count() > 0)
     {
         return true;
     }
     return false;
 }
Пример #31
0
 public void Add(ProductType productType)
 {
     _productTypeDal.Add(productType);
 }
Пример #32
0
 public static ProductTypeViewModel FromModel(ProductType pt) => new ProductTypeViewModel
 {
     Id    = pt.Id,
     Name  = pt.Name,
     Image = pt.Image
 };
Пример #33
0
        // Method.

        // Instance Constructor.
        public Product(string pnaam, ProductType ptype, List <string> pingredienten)
        {
            naam         = pnaam;
            type         = ptype;
            ingredienten = pingredienten;
        }
Пример #34
0
        public static void HubspotPost(string fname, string lname, string email, string company, string phone, string promo, string seats, string source, string utkCookie, ProductType version)
        {
            Dictionary <string, string> dictFormValues = new Dictionary <string, string>();

            dictFormValues.Add("firstname", fname);
            dictFormValues.Add("lastname", lname);
            dictFormValues.Add("email", email);
            dictFormValues.Add("phone", phone);
            dictFormValues.Add("company", company);
            dictFormValues.Add("campaign", promo);
            dictFormValues.Add("marketingsource", source);
            dictFormValues.Add("lifecyclestage", "salesqualifiedlead");
            dictFormValues.Add("type_of_sql", "Trial");
            int numSeats = 0;

            int.TryParse(seats, out numSeats);
            dictFormValues.Add("no_of_users", numSeats.ToString());


            //dictFormValues.Add("recent_conversion_event_name", "TS Trial Sign Up");
            dictFormValues.Add("product_edition", GetProductVersionName(version));
            //dictFormValues.Add("hubspot_owner_id", GetSalesGuyHubSpotID(salesGuy));

            int    intPortalID = 448936;
            string strFormGUID = "0ddd21dd-ed3a-4282-afc8-26707a31d04e";

            // Tracking Code Variables
            string strHubSpotUTK = utkCookie;
            string strIpAddress  = System.Web.HttpContext.Current.Request.UserHostAddress;

            // Page Variables
            string strPageTitle = "TS";
            string strPageURL   = System.Web.HttpContext.Current.Request.Url.AbsoluteUri;

            // Do the post, returns true/false
            string strError = "";
            bool   blnRet   = Do_Post_To_HubSpot_FormsAPI(intPortalID, strFormGUID, dictFormValues, strHubSpotUTK, strIpAddress, strPageTitle, strPageURL, ref strError);

            if (!blnRet)
            {
                ExceptionLogs.LogException(LoginUser.Anonymous, new Exception("Error Posting To HUB SPOT"), "HUB SPOT", dictFormValues.ToDebugString());
            }
        }
Пример #35
0
        public static string PreparePrice(this Product product, IWorkContext workContext, IStoreContext storeContext, IProductService productService, IPriceCalculationService priceCalculationService, IPriceFormatter priceFormatter, IPermissionService permissionService, ILocalizationService localizationService, ITaxService taxService, ICurrencyService currencyService)
        {
            decimal taxRate = new decimal();
            //decimal taxRate = new decimal();
            string str;
            bool   flag;

            if (product == null)
            {
                throw new ArgumentNullException("product");
            }
            string      price       = "0";
            ProductType productType = product.ProductType;

            if (productType != ProductType.SimpleProduct)
            {
                if (productType != ProductType.GroupedProduct)
                {
                    // goto Label2;
                }
                IList <Product> associatedProducts = productService.GetAssociatedProducts(product.Id, storeContext.CurrentStore.Id, 0, false);
                if (associatedProducts.Count == 0)
                {
                    price = "0";
                }
                else if (!permissionService.Authorize(StandardPermissionProvider.DisplayPrices))
                {
                    price = "0";
                }
                else
                {
                    decimal?minPossiblePrice = null;
                    Product minPriceProduct  = null;
                    foreach (Product associatedProduct in associatedProducts)
                    {
                        decimal tmpPrice = priceCalculationService.GetFinalPrice(associatedProduct, workContext.CurrentCustomer, decimal.Zero, true, 2147483647);
                        if ((!minPossiblePrice.HasValue ? true : tmpPrice < minPossiblePrice.Value))
                        {
                            minPriceProduct  = associatedProduct;
                            minPossiblePrice = new decimal?(tmpPrice);
                        }
                    }
                    if ((minPriceProduct == null ? false : !minPriceProduct.CustomerEntersPrice))
                    {
                        if (minPriceProduct.CallForPrice)
                        {
                            price = "0";
                        }
                        else if (!minPossiblePrice.HasValue)
                        {
                            Debug.WriteLine("Cannot calculate minPrice for product #{0}", new object[] { product.Id });
                        }
                        else
                        {
                            decimal finalPriceBase = taxService.GetProductPrice(minPriceProduct, minPossiblePrice.Value, out taxRate);
                            decimal finalPrice     = currencyService.ConvertFromPrimaryStoreCurrency(finalPriceBase, workContext.WorkingCurrency);
                            price = string.Concat(finalPrice);
                        }
                    }
                }
                str = price;
                return(str);
            }
            if (!permissionService.Authorize(StandardPermissionProvider.DisplayPrices))
            {
                price = "0";
            }
            else if (!product.CustomerEntersPrice)
            {
                if (!product.CallForPrice)
                {
                    decimal minPossiblePrice = priceCalculationService.GetFinalPrice(product, workContext.CurrentCustomer, decimal.Zero, true, 2147483647);
                    decimal oldPriceBase     = taxService.GetProductPrice(product, product.OldPrice, out taxRate);
                    decimal finalPriceBase   = taxService.GetProductPrice(product, minPossiblePrice, out taxRate);
                    currencyService.ConvertFromPrimaryStoreCurrency(oldPriceBase, workContext.WorkingCurrency);
                    decimal          finalPrice = currencyService.ConvertFromPrimaryStoreCurrency(finalPriceBase, workContext.WorkingCurrency);
                    List <TierPrice> tierPrices = new List <TierPrice>();
                    if (product.HasTierPrices)
                    {
                        tierPrices.AddRange(TierPriceExtensions.RemoveDuplicatedQuantities(TierPriceExtensions.FilterForCustomer(TierPriceExtensions.FilterByStore((
                                                                                                                                                                       from tp in product.TierPrices
                                                                                                                                                                       orderby tp.Quantity
                                                                                                                                                                       select tp).ToList <TierPrice>(), storeContext.CurrentStore.Id), workContext.CurrentCustomer)));
                    }
                    if (tierPrices.Count <= 0)
                    {
                        flag = false;
                    }
                    else
                    {
                        flag = (tierPrices.Count != 1 ? true : tierPrices[0].Quantity > 1);
                    }
                    if (!flag)
                    {
                        price = ((finalPriceBase == oldPriceBase ? true : oldPriceBase == decimal.Zero) ? string.Concat(finalPrice) : string.Concat(finalPrice));
                    }
                    else
                    {
                        price = string.Concat(finalPrice);
                    }
                }
                else
                {
                    price = "0";
                }
            }
            str = price;
            return(str);
        }
Пример #36
0
 public void Update(ProductType productType)
 {
     _productTypeDal.Update(productType);
 }
Пример #37
0
 public UpgradePrototype(int multiplier, string description, ProductType productType, Money price)
 {
     upgrade = new Upgrade(multiplier, description, productType, price);
 }
Пример #38
0
        public void Init()
        {
            _client = new Client(Helper.GetConfiguration());

            Task <Response <Project.Project> > projectTask = _client.Project().GetProjectAsync();

            projectTask.Wait();
            Assert.IsTrue(projectTask.Result.Success);
            _project = projectTask.Result.Result;

            _testCustomers = new List <Customer>();

            for (int i = 0; i < 5; i++)
            {
                CustomerDraft customerDraft = Helper.GetTestCustomerDraft();
                Task <Response <CustomerCreatedMessage> > customerTask = _client.Customers().CreateCustomerAsync(customerDraft);
                customerTask.Wait();
                Assert.IsTrue(customerTask.Result.Success);

                CustomerCreatedMessage customerCreatedMessage = customerTask.Result.Result;
                Assert.NotNull(customerCreatedMessage.Customer);
                Assert.NotNull(customerCreatedMessage.Customer.Id);

                _testCustomers.Add(customerCreatedMessage.Customer);
            }

            _testCarts = new List <Cart>();
            Task <Response <Cart> > cartTask;

            for (int i = 0; i < 5; i++)
            {
                CartDraft cartDraft = Helper.GetTestCartDraft(_project, _testCustomers[i].Id);
                cartTask = _client.Carts().CreateCartAsync(cartDraft);
                cartTask.Wait();
                Assert.IsTrue(cartTask.Result.Success);

                Cart cart = cartTask.Result.Result;
                Assert.NotNull(cart.Id);

                _testCarts.Add(cart);
            }

            ProductTypeDraft productTypeDraft = Helper.GetTestProductTypeDraft();
            Task <Response <ProductType> > productTypeTask = _client.ProductTypes().CreateProductTypeAsync(productTypeDraft);

            productTypeTask.Wait();
            Assert.IsTrue(productTypeTask.Result.Success);

            _testProductType = productTypeTask.Result.Result;
            Assert.NotNull(_testProductType.Id);

            TaxCategoryDraft taxCategoryDraft = Helper.GetTestTaxCategoryDraft(_project);
            Task <Response <TaxCategory> > taxCategoryTask = _client.TaxCategories().CreateTaxCategoryAsync(taxCategoryDraft);

            taxCategoryTask.Wait();
            Assert.IsTrue(taxCategoryTask.Result.Success);

            _testTaxCategory = taxCategoryTask.Result.Result;
            Assert.NotNull(_testTaxCategory.Id);

            Task <Response <ZoneQueryResult> > zoneQueryResultTask = _client.Zones().QueryZonesAsync();

            zoneQueryResultTask.Wait();

            if (zoneQueryResultTask.Result.Success && zoneQueryResultTask.Result.Result.Results.Count > 0)
            {
                _testZone        = zoneQueryResultTask.Result.Result.Results[0];
                _createdTestZone = false;
            }
            else
            {
                ZoneDraft zoneDraft = Helper.GetTestZoneDraft();
                Task <Response <Zone> > zoneTask = _client.Zones().CreateZoneAsync(zoneDraft);
                zoneTask.Wait();
                Assert.IsTrue(zoneTask.Result.Success);

                _testZone        = zoneTask.Result.Result;
                _createdTestZone = true;
            }

            Assert.NotNull(_testZone.Id);

            ShippingMethodDraft shippingMethodDraft = Helper.GetTestShippingMethodDraft(_project, _testTaxCategory, _testZone);
            Task <Response <ShippingMethod> > shippingMethodTask = _client.ShippingMethods().CreateShippingMethodAsync(shippingMethodDraft);

            shippingMethodTask.Wait();
            Assert.IsTrue(shippingMethodTask.Result.Success);

            _testShippingMethod = shippingMethodTask.Result.Result;
            Assert.NotNull(_testShippingMethod.Id);

            ProductDraft productDraft = Helper.GetTestProductDraft(_project, _testProductType.Id, _testTaxCategory.Id);
            Task <Response <Product> > productTask = _client.Products().CreateProductAsync(productDraft);

            productTask.Wait();
            Assert.IsTrue(productTask.Result.Success);

            _testProduct = productTask.Result.Result;
            Assert.NotNull(_testProduct.Id);

            int quantity = 1;
            AddLineItemAction addLineItemAction = new AddLineItemAction(_testProduct.Id, _testProduct.MasterData.Current.MasterVariant.Id);

            addLineItemAction.Quantity = quantity;
            cartTask = _client.Carts().UpdateCartAsync(_testCarts[0], addLineItemAction);
            cartTask.Wait();
            Assert.IsTrue(cartTask.Result.Success);

            _testCarts[0] = cartTask.Result.Result;
            Assert.NotNull(_testCarts[0].Id);
            Assert.NotNull(_testCarts[0].LineItems);
            Assert.AreEqual(_testCarts[0].LineItems.Count, 1);
            Assert.AreEqual(_testCarts[0].LineItems[0].ProductId, _testProduct.Id);
            Assert.AreEqual(_testCarts[0].LineItems[0].Variant.Id, _testProduct.MasterData.Current.MasterVariant.Id);
            Assert.AreEqual(_testCarts[0].LineItems[0].Quantity, quantity);

            OrderFromCartDraft       orderFromCartDraft = Helper.GetTestOrderFromCartDraft(_testCarts[0]);
            Task <Response <Order> > orderTask          = _client.Orders().CreateOrderFromCartAsync(orderFromCartDraft);

            orderTask.Wait();
            Assert.IsTrue(orderTask.Result.Success);

            _testOrder = orderTask.Result.Result;
            Assert.NotNull(_testOrder.Id);

            cartTask = _client.Carts().GetCartByIdAsync(_testCarts[0].Id);
            cartTask.Wait();
            Assert.IsTrue(cartTask.Result.Success);

            _testCarts[0] = cartTask.Result.Result;
            Assert.NotNull(_testCarts[0].Id);
        }
Пример #39
0
 /// <summary>
 /// Construct from a platform ID, version and product type
 /// </summary>
 public OSPlatform(PlatformID platform, Version version, ProductType product)
     : this(platform, version)
 {
     _product = product;
 }
        /// <summary>
        /// Initializes an instance of the ConsumerSearchIHIClient.
        /// </summary>
        /// <param name="endpointConfigurationName">Endpoint configuration name for the ConsumerSearchIHI endpoint.</param>
        /// <param name="product">PCIN (generated by Medicare) and platform name values.</param>
        /// <param name="user">Identifier for the application that is calling the service.</param>
        /// <param name="signingCert">Certificate to sign the soap message with.</param>
        /// <param name="tlsCert">Certificate for establishing TLS connection to the HI service.</param>
        public ConsumerSearchIHIClient(string endpointConfigurationName, ProductType product, QualifiedId user, QualifiedId hpio, X509Certificate2 signingCert, X509Certificate2 tlsCert)
        {
            Validation.ValidateArgumentRequired("endpointConfigurationName", endpointConfigurationName);

            InitializeClient(null, endpointConfigurationName, signingCert, tlsCert, product, user, hpio);
        }
        /// <summary>
        /// Initializes an instance of the ConsumerSearchIHIClient.
        /// </summary>
        /// <param name="endpointUri">Web service endpoint for Medicare's consumer IHI search service.</param>
        /// <param name="product">PCIN (generated by Medicare) and platform name values.</param>
        /// <param name="user">Identifier for the application that is calling the service.</param>
        /// <param name="signingCert">Certificate to sign the soap message with.</param>
        /// <param name="tlsCert">Certificate for establishing TLS connection to the HI service.</param>
        public ConsumerSearchIHIClient(Uri endpointUri, ProductType product, QualifiedId user, QualifiedId hpio, X509Certificate2 signingCert, X509Certificate2 tlsCert)
        {
            Validation.ValidateArgumentRequired("endpointUri", endpointUri);

            InitializeClient(endpointUri.ToString(), null, signingCert, tlsCert, product, user, hpio);
        }
        /// <summary>
        /// Initializes an instance of the ConsumerSearchIHIClient.
        /// </summary>
        /// <param name="endpointUrl">Web service endpoint for Medicare's consumer IHI search service.</param>
        /// <param name="endpointConfigurationName">Endpoint configuration name for the ConsumerSearchIHI endpoint.</param>
        /// <param name="signingCert">Certificate to sign the soap message with.</param>
        /// <param name="tlsCert">Certificate for establishing TLS connection to the HI service.</param>
        /// <param name="product">PCIN (generated by Medicare) and platform name values.</param>
        /// <param name="user">Identifier for the application that is calling the service.</param>
        /// <param name="hpio">Identifier for the organisation</param>
        private void InitializeClient(string endpointUrl, string endpointConfigurationName, X509Certificate2 signingCert, X509Certificate2 tlsCert, ProductType product, QualifiedId user, QualifiedId hpio)
        {
            Validation.ValidateArgumentRequired("product", product);
            Validation.ValidateArgumentRequired("user", user);
            Validation.ValidateArgumentRequired("signingCert", signingCert);
            Validation.ValidateArgumentRequired("tlsCert", tlsCert);

            this.product = product;
            this.user    = user;
            this.hpio    = hpio;

            SoapMessages = new HIEndpointProcessor.SoapMessages();

            ConsumerSearchIHIPortTypeClient client = null;

            if (!string.IsNullOrEmpty(endpointUrl))
            {
                EndpointAddress address    = new EndpointAddress(endpointUrl);
                CustomBinding   tlsBinding = GetBinding();

                client = new ConsumerSearchIHIPortTypeClient(tlsBinding, address);
            }
            else if (!string.IsNullOrEmpty(endpointConfigurationName))
            {
                client = new ConsumerSearchIHIPortTypeClient(endpointConfigurationName);
            }

            if (client != null)
            {
                HIEndpointProcessor.ProcessEndpoint(client.Endpoint, signingCert, SoapMessages);

                if (tlsCert != null)
                {
                    client.ClientCredentials.ClientCertificate.Certificate = tlsCert;
                }

                searchIhiClient = client;
            }
        }
Пример #43
0
 public ProductDefine(string id, ProductType productType)
 {
     this.id          = id;
     this.productType = productType;
 }
Пример #44
0
 public Task <OrderResponse> PutMarketOrder(SideType side, ProductType productType, decimal amount, Guid?clientId)
 {
     return(Task.FromResult <OrderResponse>(null));
 }
Пример #45
0
 public void AddType(ProductType type)
 {
     db.ProductTypes.Add(type);
 }
Пример #46
0
 public void Delete(ProductType productType)
 {
     _productTypeDal.Delete(productType);
 }
Пример #47
0
 // TODO Check hooks
 public static bool canHaul(this EngineType e, ProductType p)
 {
     return(e.era() >= p.era());
 }
Пример #48
0
 /// <summary>
 /// Searches for product by given symbol and product type. By default searches on SMART exchange and in USD currency.
 /// </summary>
 /// <param name="symbol">Name of the product</param>
 /// <param name="productType">Type of the product (stock, CFD)</param>
 /// <returns>Instance of the product</returns>
 /// <exception cref="InvalidOperationException">Thrown when no such product or more products are found.</exception>
 public Product FindProduct(string symbol, ProductType productType)
 {
     return(FindProduct(symbol, productType, "SMART"));
 }
Пример #49
0
        /// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="user">The AdWords user.</param>
        /// <param name="campaignId">The campaign id to add product scope.</param>
        public void Run(AdWordsUser user, long campaignId)
        {
            // Get the CampaignCriterionService.
            CampaignCriterionService campaignCriterionService =
                (CampaignCriterionService)user.GetService(
                    AdWordsService.v201603.CampaignCriterionService);

            ProductScope productScope = new ProductScope();
            // This set of dimensions is for demonstration purposes only. It would be
            // extremely unlikely that you want to include so many dimensions in your
            // product scope.
            ProductBrand nexusBrand = new ProductBrand();

            nexusBrand.value = "Nexus";

            ProductCanonicalCondition newProducts = new ProductCanonicalCondition();

            newProducts.condition = ProductCanonicalConditionCondition.NEW;

            ProductCustomAttribute customAttribute = new ProductCustomAttribute();

            customAttribute.type  = ProductDimensionType.CUSTOM_ATTRIBUTE_0;
            customAttribute.value = "my attribute value";

            ProductOfferId bookOffer = new ProductOfferId();

            bookOffer.value = "book1";

            ProductType mediaProducts = new ProductType();

            mediaProducts.type  = ProductDimensionType.PRODUCT_TYPE_L1;
            mediaProducts.value = "Media";

            ProductType bookProducts = new ProductType();

            bookProducts.type  = ProductDimensionType.PRODUCT_TYPE_L2;
            bookProducts.value = "Books";

            // The value for the bidding category is a fixed ID for the
            // 'Luggage & Bags' category. You can retrieve IDs for categories from
            // the ConstantDataService. See the 'GetProductCategoryTaxonomy' example
            // for more details.
            ProductBiddingCategory luggageBiddingCategory = new ProductBiddingCategory();

            luggageBiddingCategory.type  = ProductDimensionType.BIDDING_CATEGORY_L1;
            luggageBiddingCategory.value = -5914235892932915235;

            productScope.dimensions = new ProductDimension[] { nexusBrand, newProducts, bookOffer,
                                                               mediaProducts, luggageBiddingCategory };

            CampaignCriterion campaignCriterion = new CampaignCriterion();

            campaignCriterion.campaignId = campaignId;
            campaignCriterion.criterion  = productScope;

            // Create operation.
            CampaignCriterionOperation operation = new CampaignCriterionOperation();

            operation.operand   = campaignCriterion;
            operation.@operator = Operator.ADD;

            try {
                // Make the mutate request.
                CampaignCriterionReturnValue result = campaignCriterionService.mutate(
                    new CampaignCriterionOperation[] { operation });

                Console.WriteLine("Created a ProductScope criterion with ID '{0}'",
                                  result.value[0].criterion.id);
            } catch (Exception e) {
                throw new System.ApplicationException("Failed to set shopping product scope.", e);
            }
        }
Пример #50
0
 /// <summary>
 /// Looks up specified product in USD currency.
 /// </summary>
 /// <param name="symbol">Name of the product</param>
 /// <param name="productType">Type of the product (stock, CFD)</param>
 /// <param name="exchange">Name of the exchange where the product should be traded.</param>
 /// <returns>Instance of the product</returns>
 /// <exception cref="InvalidOperationException">Thrown when no such product or more products are found.</exception>
 public Product FindProduct(string symbol, ProductType productType, string exchange)
 {
     return(FindProduct(symbol, productType, exchange, "USD"));
 }
Пример #51
0
 /// <summary>
 /// Looks up specified product.
 /// </summary>
 /// <param name="symbol">Name of the product</param>
 /// <param name="productType">Type of the product (stock, CFD)</param>
 /// <param name="exchange">Name of the exchange where the product should be traded.</param>
 /// <param name="currency">Name of the product's currency. Usually USD.</param>
 /// <returns>Instance of the product</returns>
 /// <exception cref="InvalidOperationException">Thrown when no such product or more products are found.</exception>
 public Product FindProduct(string symbol, ProductType productType, string exchange, string currency)
 {
     return(IBWrapper.FindProduct(symbol, productType, exchange, currency));
 }
Пример #52
0
 public abstract void Sell(ProductType productType, Channel channel);
Пример #53
0
 public Product(string pnaam, ProductType ptype)
 {
     naam = pnaam;
     type = ptype;
 }
Пример #54
0
 public Product(ProductType productType, int amount = 0, int price = 1)
 {
     Type   = productType;
     Amount = amount;
     Price  = price;
 }
        public void Sample()
        {
            // ------------------------------------------------------------------------------
            // Set up
            // ------------------------------------------------------------------------------

            // Obtain the certificate by serial number
            X509Certificate2 tlsCert = X509CertificateUtil.GetCertificate(
                "Serial Number",
                X509FindType.FindBySerialNumber,
                StoreName.My,
                StoreLocation.CurrentUser,
                true
                );

            // The same certificate is used for signing the request.
            // This certificate will be different to TLS cert for some operations.
            X509Certificate2 signingCert = tlsCert;

            // Set up client product information (PCIN)
            // Values below should be provided by Medicare
            ProductType product = new ProductType()
            {
                platform       = "Your system platform (Eg. Windows XP SP3)", // Can be any value
                productName    = "Product Name",                              // Provided by Medicare
                productVersion = "Product Version",                           // Provided by Medicare
                vendor         = new QualifiedId()
                {
                    id        = "Vendor Id",       // Provided by Medicare
                    qualifier = "Vendor Qualifier" // Provided by Medicare
                }
            };

            // Set up user identifier details
            QualifiedId user = new QualifiedId()
            {
                id        = "User Id", // User ID internal to your system
                qualifier = "http://<anything>/id/<anything>/userid/1.0"
                                       // Eg: http://ns.yourcompany.com.au/id/yoursoftware/userid/1.0
            };

            // Set up user identifier details
            QualifiedId hpio = new QualifiedId()
            {
                id        = "HPIO", // HPIO internal to your system
                qualifier = "http://<anything>/id/<anything>/hpio/1.0"
                                    // Eg: http://ns.yourcompany.com.au/id/yoursoftware/userid/1.0
            };

            // ------------------------------------------------------------------------------
            // Client instantiation and invocation
            // ------------------------------------------------------------------------------

            // Instantiate the client
            var client = new ProviderBatchAsyncSearchForProviderOrganisationClient(
                new Uri("https://HIServiceEndpoint"),
                product,
                user,
                hpio,
                signingCert,
                tlsCert);

            // Create the search request
            var search1 = new BatchSearchForProviderOrganisationCriteriaType()
            {
                requestIdentifier             = Guid.NewGuid().ToString(),
                searchForProviderOrganisation = new searchForProviderOrganisation()
                {
                    hpioNumber = HIQualifiers.HPIOQualifier + "HPIO TO SEARCH",
                }
            };

            // Submit the batch search request
            var submitResponse =
                client.BatchSubmitProviderOrganisations(new BatchSearchForProviderOrganisationCriteriaType[]
            {
                search1
            });

            // Retrieve the batch result
            var retrieveResponse = client.BatchRetrieveProviderOrganisations(new retrieveSearchForProviderOrganisation()
            {
                batchIdentifier = submitResponse.submitSearchForProviderOrganisationResult.batchIdentifier
            });
        }
Пример #56
0
 public Product(string name, ProductType type, double price)
 {
     this.name  = name;
     this.type  = type;
     this.price = price;
 }
 public ProductType UpdateProductType(ProductType productType)
 {
     return(Channel.UpdateProductType(productType));
 }
Пример #58
0
 public Product(string name, ProductType pt)
 {
     Name = name;
     Type = pt;
 }
Пример #59
0
        /// <summary>
        /// 保存航班最低价
        /// </summary>
        /// <param name="departure">出发地</param>
        /// <param name="arrival">到达地</param>
        /// <param name="flightDate">航班日期</param>
        /// <param name="fare">价格</param>
        /// <param name="discount">折扣</param>
        /// <param name="product">产品类型</param>
        public static void SaveFlightLowerFare(string departure, string arrival, DateTime flightDate, decimal fare, decimal discount, ProductType product)
        {
            if (string.IsNullOrWhiteSpace(departure))
            {
                throw new ArgumentNullException("departure");
            }
            if (string.IsNullOrWhiteSpace(arrival))
            {
                throw new ArgumentNullException("arrival");
            }
            if (fare <= 0)
            {
                throw new InvalidOperationException("fare");
            }
            if (discount <= 0)
            {
                throw new InvalidOperationException("discount");
            }
            var model = new Recommend.Domain.FareInfo(departure, arrival, flightDate, fare, discount, product);

            Recommend.Domain.FareDataCenter.Instance.Save(model);
        }
Пример #60
0
        public void Sample()
        {
            // ------------------------------------------------------------------------------
            // Set up
            // ------------------------------------------------------------------------------

            // Obtain the certificate by serial number
            X509Certificate2 tlsCert = X509CertificateUtil.GetCertificate(
                "Serial Number",
                X509FindType.FindBySerialNumber,
                StoreName.My,
                StoreLocation.CurrentUser,
                true
                );

            // The same certificate is used for signing the request.
            // This certificate will be different to TLS cert for some operations.
            X509Certificate2 signingCert = tlsCert;

            // Set up client product information (PCIN)
            // Values below should be provided by Medicare
            ProductType product = new ProductType()
            {
                platform       = "Your system platform (Eg. Windows XP SP3)", // Can be any value
                productName    = "Product Name",                              // Provided by Medicare
                productVersion = "Product Version",                           // Provided by Medicare
                vendor         = new QualifiedId()
                {
                    id        = "Vendor Id",                                // Provided by Medicare
                    qualifier = "Vendor Qualifier"                          // Provided by Medicare
                }
            };

            // Set up user identifier details
            QualifiedId user = new QualifiedId()
            {
                id        = "User Id",                                      // User ID internal to your system
                qualifier = "http://<anything>/id/<anything>/userid/1.0"    // Eg: http://ns.yourcompany.com.au/id/yoursoftware/userid/1.0
            };

            // Set up user identifier details
            QualifiedId hpio = new QualifiedId()
            {
                id        = "HPIO",                                       // HPIO internal to your system
                qualifier = "http://<anything>/id/<anything>/hpio/1.0"    // Eg: http://ns.yourcompany.com.au/id/yoursoftware/userid/1.0
            };

            // ------------------------------------------------------------------------------
            // Client instantiation and invocation
            // ------------------------------------------------------------------------------

            // Instantiate the client
            ConsumerSearchIHIClient client = new ConsumerSearchIHIClient(
                new Uri("https://HIServiceEndpoint"),
                product,
                user,
                hpio,
                signingCert,
                tlsCert);

            // Set up the request
            searchIHI request = new searchIHI();

            request.ihiNumber   = "http://ns.electronichealth.net.au/id/hi/ihi/1.0/8003601240022579";
            request.dateOfBirth = DateTime.Parse("12 Dec 2002");
            request.givenName   = "Jessica";
            request.familyName  = "Wood";
            request.sex         = SexType.F;

            try
            {
                // Invokes a basic search
                searchIHIResponse ihiResponse = client.BasicSearch(request);
            }
            catch (Exception ex)
            {
                // If an error is encountered, client.LastSoapResponse often provides a more
                // detailed description of the error.
                string soapResponse = client.SoapMessages.SoapResponse;
            }
        }