Beispiel #1
0
        public static void Hotline_SearchOfGoods_UsingSortbyPriceButton_ShouldOpenPageWithMinimalPrice()
        {
            Home           home;
            SearchResult   searchResult;
            CurrentProduct currentProduct;
            Prices         prices;
            SomeShop       someShop;
            bool           condition          = false;
            string         searchWord         = "MacBook";
            string         homeTitleSubstring = "Hotline";

            home = new Home(Driver);
            home.DoSearchByWord(searchWord);
            searchResult = new SearchResult(Driver);
            searchResult.ClickButtonToCompare();
            currentProduct = new CurrentProduct(Driver);
            currentProduct.ClickButtonOfPropositions();
            prices = new Prices(Driver);
            prices.ClickSortByPriceButton();
            prices.GoToTheShop();
            someShop  = new SomeShop(Driver);
            condition = someShop.ThisPagesTitleNotContains(homeTitleSubstring);

            Assert.True(condition);
        }
Beispiel #2
0
    private void PopulateControls()
    {
        ProductImage details;

        IList <Product> productList = new List <Product>();

        productList.Add(CurrentProduct);

        uxList.DataSource = productList;
        uxList.DataBind();

        if (String.IsNullOrEmpty(CurrentProductImageID))
        {
            details = CurrentProduct.GetPrimaryProductImage();
            CurrentProductImageID = details.ProductImageID;
        }
        else
        {
            details = CurrentProduct.GetProductImage(CurrentProductImageID);
        }

        uxProductHidden.Value = CurrentProduct.ProductID;

        string smallImage = details.RegularImage;
        string altTag     = string.Empty;
        string titleTag   = string.Empty;

        GetInfoTextFromImage(smallImage, ref altTag, ref titleTag);

        PopulateThumbnail();

        uxImageHidden.Value = "";
    }
        // GET: CurrentProducts/Delete/5
        public IActionResult Delete(int?id)
        {
            CurrentProduct cp1 = fetchproductbyid(id);


            return(View(cp1));
        }
Beispiel #4
0
 private void InfoSelected(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
 {
     if (ExistingNames.SelectedItem is CurrentProduct P)
     {
         pCopy = P;
     }
 }
        // GET: CurrentProducts/AddorEdit/
        public IActionResult AddorEdit(int?id)
        {
            CurrentProduct cp = new CurrentProduct();

            if (id > 0)
            {
                cp = fetchproductbyid(id);
            }
            return(View(cp));
        }
        private void listBoxSupplies_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (listBoxSupplies.SelectedItem is CurrentProduct p)
            {
                textBlockName.Text = $"{p.Name}";
                textBoxAmount.Text = $"{p.Amount}";
                textBoxPrice.Text  = $"{p.Price}";
                Delete.IsEnabled   = true;

                pcopy = p;
            }
        }
        public DetailProductViewModel(string productId)
        {
            CurrentProduct.Find(productId);

            //danh sách số lượng và size sản phẩm
            SizeQuantify = getListObject.Get_SizeProduct(productId);

            //danh sách các hình của sản phẩm
            ImagesCarousel = getListObject.Get_ImageProduct(productId);

            //ảnh đại diện sản phẩm
            ImageSelectChange = ImagesCarousel.Count > 0 ? ImagesCarousel.ElementAt(0).ImageUri : string.Empty;
        }
 public void UpdateCurrentProduct(Product newProduct)
 {
     //print("Updating current product");
     if (currentProduct != null)
     {
         currentProduct.HighlightOff();
         if (currentProduct.currentPlaceholder != null)
         {
             currentProduct.currentPlaceholder.indicator.ForceOff();
             Destroy(currentProduct.currentPlaceholder.gameObject);
         }
     }
     currentProduct = new CurrentProduct(this, newProduct);
 }
Beispiel #9
0
        /// <summary>
        /// 设置当前产品,若不重复则更新
        /// </summary>
        /// <param name="product"></param>
        public AbstractProcessService <TProduct, TMaterial> SetProduct(TProduct product)
        {
            if (product == null)
            {
                return(this);
            }

            if (null == CurrentProduct || !CurrentProduct.Equals(product))
            {
                this.PrevProduct    = this.CurrentProduct;
                this.CurrentProduct = product;
            }
            return(this);
        }
Beispiel #10
0
        public virtual bool RunTest(string TestName)
        {
            MonsterDebug.Log("Attempting to run test " + TestName + " on a standalone copy of the game.");

            Environment.SetEnvironmentVariable(MonsterTestCore.MonsterStarterTestNameEnvVariable, TestName);

            string AppPath = "";

            if (IgorJobConfig.IsStringParamSet(MonsterTestCore.ExplicitAppPathFlag))
            {
                AppPath = IgorJobConfig.GetStringParam(MonsterTestCore.ExplicitAppPathFlag);
            }
            else
            {
                foreach (string CurrentProduct in IgorCore.GetModuleProducts())
                {
                    if (CurrentProduct.Contains(".app"))
                    {
                        AppPath = CurrentProduct.Substring(0, CurrentProduct.IndexOf(".app") + 4);
                    }
                    else if (CurrentProduct.EndsWith(".exe"))
                    {
                        AppPath = CurrentProduct;
                    }
                }
            }

            if (AppPath.EndsWith(".app"))
            {
                AppPath = Path.Combine(AppPath, Path.Combine("Contents", Path.Combine("MacOS", AppPath.Substring(AppPath.LastIndexOf('/') + 1, AppPath.Length - AppPath.LastIndexOf('/') - 5))));

                IgorRuntimeUtils.SetFileExecutable(AppPath);
            }

            string AppOutput = "";
            string AppError  = "";

            int RunAppRC = IgorRuntimeUtils.RunProcessCrossPlatform(AppPath, AppPath, "", Path.GetFullPath("."), ref AppOutput, ref AppError);

            if (RunAppRC != 0)
            {
                MonsterDebug.LogError("Failed to run test.  App retruned RC " + RunAppRC + "!\n\nOutput:\n" + AppOutput + "\n\nError:\n" + AppError);

                return(true);
            }

            MonsterDebug.Log("Test ran successfully!\n\nOutput:\n" + AppOutput + "\n\nError:\n" + AppError);

            return(true);
        }
 public IActionResult AddorEdit(int id, [Bind("PId,ProductName,Price,availability")] CurrentProduct currentProduct)
 {
     Console.WriteLine(currentProduct.PId);
     if (ModelState.IsValid)
     {
         using (SqlConnection con = new SqlConnection(_configuration.GetConnectionString("DevConnection")))
         {
             con.Open();
             SqlCommand sqlcmd = new SqlCommand("AddEditProducts", con);
             sqlcmd.CommandType = CommandType.StoredProcedure;
             sqlcmd.Parameters.AddWithValue("PId", currentProduct.PId);
             sqlcmd.Parameters.AddWithValue("ProductName", currentProduct.ProductName);
             sqlcmd.Parameters.AddWithValue("Price", currentProduct.Price);
             sqlcmd.Parameters.AddWithValue("availability", currentProduct.availability);
             sqlcmd.ExecuteNonQuery();
         }
         return(RedirectToAction(nameof(Index)));
     }
     return(View(currentProduct));
 }
        public CurrentProduct fetchproductbyid(int?id)
        {
            CurrentProduct currentproduct = new CurrentProduct();
            {
                using (SqlConnection con = new SqlConnection(_configuration.GetConnectionString("DevConnection")))
                {
                    DataTable dtbl = new DataTable();
                    con.Open();
                    SqlDataAdapter da = new SqlDataAdapter("ProductviewbyID", con);
                    da.SelectCommand.CommandType = CommandType.StoredProcedure;
                    da.SelectCommand.Parameters.AddWithValue("PId", id);

                    da.Fill(dtbl);
                    if (dtbl.Rows.Count == 1)
                    {
                        currentproduct.PId         = Convert.ToInt32(dtbl.Rows[0]["PId"].ToString());
                        currentproduct.ProductName = dtbl.Rows[0]["ProductName"].ToString();
                        currentproduct.Price       = Convert.ToInt32(dtbl.Rows[0]["Price"].ToString());
                    }
                    return(currentproduct);
                }
            }
        }
Beispiel #13
0
    protected string CheckValidStock()
    {
        int numberItemInSession = StoreContext.ShoppingCart.GetNumberOfItems(ProductID) +
                                  PromotionSelectedItem.FindSubProductAmountInPromotion(StoreContext.ShoppingCart, ProductID);
        int currentStock = 0;

        currentStock = CurrentProduct.GetStockForQuickReview() - numberItemInSession;

        bool isOutStock = CatalogUtilities.IsOutOfStock(Convert.ToInt32(currentStock), CurrentProduct.UseInventory);

        if (CurrentProduct.isProductOptionStock())
        {
            return("");
        }

        if (isOutStock)
        {
            return(GetLanguageText("OutStock"));
        }
        else
        {
            return(GetLanguageText("InStock") + " (" + RemainingStock(currentStock) + ")");
        }
    }
Beispiel #14
0
        private void SetProductData <TProductIm>(ComboBox comboBox, SingleUpDown sizeSingleUpDown, Label sizeLabel, Label priceLabel, List <TProductIm> products, CurrentProduct currentProduct)
            where TProductIm : ProductIm
        {
            comboBox.ItemsSource   = products.Select(im => im.Name);
            comboBox.SelectedIndex = comboBox.Items.IndexOf(currentProduct.Name);

            if (priceLabel != null)
            {
                priceLabel.Content = currentProduct.Price;
            }

            if (sizeLabel == null && sizeSingleUpDown == null)
            {
                return;
            }

            if (sizeSingleUpDown == null)
            {
                sizeLabel.Content = currentProduct.Count;
            }
            else
            {
                sizeSingleUpDown.Value = (float)currentProduct.Count;
            }
        }
Beispiel #15
0
        private void SetAdditionalCrossProfileData(ComboBox comboBox, SingleUpDown sizeSingleUpDown, Label sizeLabel,
                                                   Label priceLabel, List <CrossProfileIm> products, CurrentProduct currentProduct, CheckBox checkBox)
        {
            checkBox.IsChecked = data.ExtraCrossProfileEnabled;

            if (!data.ExtraCrossProfileAllowed)
            {
                comboBox.IsEnabled = false;
                checkBox.IsEnabled = false;
                checkBox.IsChecked = false;
            }
            else
            {
                comboBox.IsEnabled = true;
                checkBox.IsEnabled = true;
            }

            SetProductData(comboBox, sizeSingleUpDown, sizeLabel, priceLabel, products, currentProduct);
        }
Beispiel #16
0
        private void SetAdditionalCrossProfileWithGrooveData(ComboBox comboBox, SingleUpDown sizeSingleUpDown, Label sizeLabel,
                                                             Label priceLabel, List <CrossProfileIm> products, CurrentProduct currentProduct, CheckBox checkBox)
        {
            checkBox.IsChecked = data.ExtraCrossProfileWithGrooveEnabled;

            if (!data.ExtraCrossProfileWithGrooveAllowed)
            {
                comboBox.IsEnabled = false;
                checkBox.IsEnabled = false;
                checkBox.IsChecked = false;
            }
            else
            {
                comboBox.IsEnabled = true;
                checkBox.IsEnabled = true;
            }

            DivideCrossProfileForTwoLabel.Visibility = checkBox.IsChecked.Value ? Visibility.Visible : Visibility.Hidden;

            SetProductData(comboBox, sizeSingleUpDown, sizeLabel, priceLabel, products, currentProduct);
        }
 private void OnAddCurrentItem(IShoppingItem item)
 {
     ProductList.Add(item);
     CurrentProduct.Clear(clearCode: true);
     ShoppingActions.OnAddedItem(item);
 }
    public bool AddItemToShoppingCart(bool isSubscriptionable, out string errMsg)
    {
        errMsg = String.Empty;

        if (!VerifyValidInput(out errMsg))
        {
            DisplayErrorMessage(errMsg);
            return(false);
        }

        if (!IsMatchQuantity())
        {
            return(false);
        }

        OptionItemValueCollection selectedOptions = uxProductOptionGroupDetails.GetSelectedOptions();
        CartItemGiftDetails       giftDetails     = CreateGiftDetails();

        Currency currency   = DataAccessContext.CurrencyRepository.GetOne(CurrencyCode);
        decimal  enterPrice = ConvertUtilities.ToDecimal(currency.FormatPriceWithOutSymbolInvert(ConvertUtilities.ToDecimal(uxEnterAmountText.Text)));

        if (enterPrice == CurrentProduct.GetProductPrice(StoreID).Price)
        {
            enterPrice = 0;
        }

        decimal customPrice = 0;

        if (CurrentProduct.IsCustomPrice)
        {
            customPrice = ConvertUtilities.ToDecimal(currency.FormatPriceWithOutSymbolInvert(ConvertUtilities.ToDecimal(uxEnterAmountText.Text)));
        }


        CartAddItemService addToCartService = new CartAddItemService(
            StoreContext.Culture, StoreContext.ShoppingCart);

        int    currentStock;
        string errorOptionName;
        bool   stockOK = addToCartService.AddToCartByAdmin(
            CurrentProduct,
            selectedOptions,
            ConvertUtilities.ToInt32(uxQuantityText.Text),
            giftDetails,
            customPrice,
            enterPrice,
            StoreID,
            out errorOptionName,
            out currentStock,
            isSubscriptionable);


        if (stockOK)
        {
            return(true);
        }
        else
        {
            errMsg = DisplayOutOfStockError(currentStock, errorOptionName);
            uxMessage.DisplayError(errMsg);
            return(false);
        }
    }
 public void Delete()
 {
     CurrentProduct.Delete();
     ShowHome();
 }
Beispiel #20
0
 public override string ToString()
 {
     return(CurrentProduct.ToString());
 }
    public GameObject CreatePlaceholder(CurrentProduct needsPlaceholder)
    {
        Product product     = needsPlaceholder.currentProduct;
        Color   toUse       = Color.white;
        bool    assignColor = false;

        if (product != null)
        {
            GameObject toInstantiate = null;
            try
            {
                toInstantiate = product.productGO;
                if (toInstantiate == null)
                { // product go was null, throw exception
                    throw new System.NullReferenceException();
                }
            }
            catch (System.NullReferenceException)
            {
                if (product.productType == Product.type_.packagedBud)
                {
                    if (needsPlaceholder.currentContainer == null)
                    {
                        StoreObjectReference budPlaceholder = dm.database.GetProduct("Bud Placeholder");
                        toInstantiate = budPlaceholder.gameObject_;
                    }
                    else
                    {
                        toInstantiate = needsPlaceholder.currentContainer.gameObject_;
                    }
                }
                if (product.productType == Product.type_.packagedProduct)
                {
                    Box.PackagedProduct packagedProduct = (Box.PackagedProduct)product;
                    if (packagedProduct != null)
                    {
                        toInstantiate = packagedProduct.productReference.gameObject_;
                        toUse         = product.productReference.color.GetColor_PackagedProduct();
                        assignColor   = true;
                    }
                }
            }
            if (product.IsBox())
            {
                StorageBox storageBox = (StorageBox)product;
                Box        box        = storageBox.box.GetComponent <Box>();
                if (box.parentBoxStack != null)
                {
                    Box boxToMove = box.parentBoxStack.StartRemovingBox(needsPlaceholder, box.product.uniqueID);
                    if (boxToMove.GetComponent <Placeholder>() == null)
                    {
                        boxToMove.gameObject.AddComponent <Placeholder>();
                    }
                    storageBox.box    = boxToMove.gameObject;
                    boxToMove.product = storageBox;
                    return(boxToMove.gameObject);
                }
                else if (storageBox != null)
                {
                    Box         placeholderBox = Instantiate(storageBox.box.GetComponent <Box>());
                    BoxCollider collider       = placeholderBox.GetComponent <BoxCollider>();
                    collider.enabled = false;
                    StorageBox newStorageBox = new StorageBox(storageBox.productReference, placeholderBox.gameObject);
                    newStorageBox.uniqueID = storageBox.uniqueID;
                    placeholderBox.product = newStorageBox;
                    if (placeholderBox.GetComponent <Placeholder>() == null)
                    {
                        placeholderBox.gameObject.AddComponent <Placeholder>();
                    }
                    return(placeholderBox.gameObject);
                }
                else
                {
                    //print("Falling through");
                }
            }
            if (toInstantiate != null)
            {
                //print("Something exists to be instantiated");
                GameObject newPlaceholderGO = Instantiate(toInstantiate);
                //print("1");
                if (newPlaceholderGO.GetComponent <Placeholder>() == null)
                {
                    newPlaceholderGO.AddComponent <Placeholder>();
                }
                Placeholder newPlaceholder = newPlaceholderGO.GetComponent <Placeholder>();
                newPlaceholder.parentProduct      = needsPlaceholder;
                currentProduct.currentPlaceholder = newPlaceholder;
                if (product.productType == Product.type_.packagedBud)
                {
                    /*if (needsPlaceholder.currentContainer == null)
                     * {
                     *  newPlaceholder.NoContainerToggle();
                     * }
                     * else
                     * {
                     *  newPlaceholder.HasContainerToggle();
                     * }
                     */
                }

                // Apply product color
                if (assignColor)
                {
                    newPlaceholderGO = ApplyColor(newPlaceholderGO, toUse);
                }

                /*ProductGO productGO = currentProduct.GetComponent<ProductGO>();
                 * if (productGO != null)
                 * {
                 *  if (productGO.product != null)
                 *  {
                 *      if (productGO.product.productReference != null)
                 *      {
                 *          StoreObjectReference reference = productGO.product.productReference;
                 *          if (reference != null)
                 *          {
                 *              if (reference.color.colorIsAssigned)
                 *              {
                 *                  try
                 *                  {
                 *                      newPlaceholderGO = ApplyColor(newPlaceholderGO, reference.color.GetColor());
                 *                  }
                 *                  catch (System.ArgumentException)
                 *                  {
                 *                      print("Color was marked as being assigned, but wasnt there");
                 *                  }
                 *              }
                 *          }
                 *      }
                 *  }
                 * }*/

                return(newPlaceholderGO); // needsPlaceholder.currentPlaceholder = newPlaceholder.GetComponent<Placeholder>();
            }
            else
            {
                print("The object to instantiate is null: " + product.GetName());
                return(null);
            }
        }
        else
        {
            print("Returning null");
            return(null);
        }
    }
 void DeleteExecute(object obj)
 {
     CurrentProduct.DeleteProduct();
     ListProduct.Remove(CurrentProduct);
 }
Beispiel #23
0
    protected string GetFormattedPrice()
    {
        decimal price = CurrentProduct.GetDisplayedPrice(StoreContext.WholesaleStatus);

        return(StoreContext.Currency.FormatPrice(price));
    }