Esempio n. 1
0
        /// <summary>
        /// Inserts a new product
        /// </summary>
        /// <param name="product"></param>
        /// <returns></returns>
        public int addNewProduct(BLProduct product)
        {
            string cs = ConfigurationManager.ConnectionStrings["JerseySure"].ConnectionString;
            int    rows;

            using (SqlConnection connection = new SqlConnection(cs))
            {
                SqlCommand command = new SqlCommand("usp_addProduct", connection);

                command.CommandType = CommandType.StoredProcedure;

                command.Parameters.AddWithValue("@playFirst", product.playFirstName);
                command.Parameters.AddWithValue("@playLast", product.playLastName);
                command.Parameters.AddWithValue("@jerNumber", product.jerNumber);
                command.Parameters.AddWithValue("@teamID", product.teamID);
                command.Parameters.AddWithValue("@prodDescription", product.prodDescription);
                command.Parameters.AddWithValue("@prodPrice", product.prodPrice);
                command.Parameters.AddWithValue("@imgFront", product.image[0]);
                command.Parameters.AddWithValue("@imgBack", product.image[1]);
                command.Parameters.AddWithValue("@stkSmall", product.stock[0]);
                command.Parameters.AddWithValue("@stkMedium", product.stock[1]);
                command.Parameters.AddWithValue("@stkLarge", product.stock[2]);
                command.Parameters.AddWithValue("@stkXLge", product.stock[3]);
                command.Parameters.AddWithValue("@stkXXL", product.stock[4]);

                connection.Open();

                rows = command.ExecuteNonQuery();
            }
            return(rows);
        }
Esempio n. 2
0
 private void LoadProduct(int productId)
 {
     product = BLProduct.RetrieveFromDB(connectionString, productId);
     if (product == null)
     {
         throw new HttpException(404, $"Product.aspx?productId={productId} doesn't exist.");
     }
     productImage.Src       = $"ImgHandler.ashx?productId={productId}";
     productTitle.InnerText = product.Name;
     if (product.Discount > 0)
     {
         originalProductPrice.InnerText = "£" + product.Price;
         originalProductPrice.Visible   = true;
         double newPrice = product.Price * (1 - product.Discount / 100);
         productPrice.Visible           = false;
         discountProductPrice.Visible   = true;
         discountProductPrice.InnerText = "£" + newPrice;
     }
     else
     {
         productPrice.InnerText = "£" + product.Price;
     }
     productDescription.InnerText = product.Description;
     if (product.TrailerUrl != null)
     {
         linkViewTrailer.Visible = true;
         linkViewTrailer.HRef    = product.TrailerUrl;
     }
 }
Esempio n. 3
0
        public string DownloadPSParametersExcelTemplate()
        {
            //try
            //{
            //    DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload();
            //    DataControl.Abstraction.IFileProvider objProvider = new DataControl.Impl.FileSystemProvider();
            //    string error = string.Empty;
            //    CurrentInfo objCurInfo = new CurrentInfo();
            //    DataControl.BLProduct objProduct = new BLProduct();
            //    string fileName = objProduct.GetPrimarySalesParametersExcelData(objCurInfo.GetCompanyCode());
            //    string blobURL = objProvider.GetConfigValue("EXCELTEMPLATES") + fileName;
            //    objFileDownload.DownloadFile(blobURL, fileName, out error);
            //}
            //catch (Exception ex)
            //{
            //    Dictionary<string, string> dicObj = new Dictionary<string, string>();
            //    DataControl.Impl.ExceptionHandler.WriteLog(ex: ex, dic: dicObj);
            //}

            DataControl.BLProduct _objBLProduct = new BLProduct();
            string      _fileNameString         = string.Empty;
            CurrentInfo objCurInfo = new CurrentInfo();

            _fileNameString = _objBLProduct.GetPrimarySalesParametersExcelData(objCurInfo.GetCompanyCode());
            return(_fileNameString);
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Session["user"] = new BlShopManager("12345678");

            if (!(Session["user"] is BlShopManager))
            {
                Response.Redirect("HomePage.aspx");
            }

            BlShopManager manager = (BlShopManager)Session["user"];

            if (!Page.IsPostBack)
            {
                //set data source

                productOrder.DataSource = OrderByArr;
                //// Bind the data to the control.
                productOrder.DataBind();

                // Set the default selected item, if desired.
                productOrder.SelectedIndex = 0;

                //set data source
                List <BLProduct> products = BLProduct.GetAllProductsByShopId(manager.ShopId, "");
                Session["products"] = null;
                UpdateData(products);
            }
        }
Esempio n. 5
0
        public void CreateProductVariationErrorTest()
        {
            List <string> errors         = new List <string>(); // TODO: Initialize to an appropriate value
            List <string> errorsExpected = new List <string>(); // TODO: Initialize to an appropriate value

            BLProductVariation.CreatePV(null, ref errors);
            AsynchLog.LogNow(errors);

            Assert.AreEqual(1, errors.Count);

            errors = new List <string>(); // TODO: Initialize to an appropriate value
            int    invalid_pv_id              = BLProductVariation.ReadAllPV(ref errors).Count + 1;
            int    invalid_product_id         = BLProduct.ReadAllProduct(ref errors).Count + 1;
            int    invalid_brand_id           = BLBrand.ReadAllBrand(ref errors).Count + 1;
            int    invalid_product_color_id   = BLProductColor.ReadAllProductColor(ref errors).Count + 1;
            int    invalid_product_cutting_id = BLProductCutting.ReadAllProductCutting(ref errors).Count + 1;
            char   invalid_sex             = 'Q';
            string invalid_size            = "huge";
            int    invalid_stock           = -1;
            int    invalid_price           = -1;
            char   invalid_condition       = 'f';
            int    invalid_product_type_id = BLProductType.ReadAllProductType(ref errors).Count + 1;

            ProductVariationInfo ipv = new ProductVariationInfo(invalid_pv_id, invalid_product_id, invalid_brand_id, invalid_product_cutting_id, invalid_product_color_id,
                                                                invalid_product_type_id, invalid_sex, invalid_size, invalid_stock, invalid_price, invalid_condition);


            BLProductVariation.CreatePV(ipv, ref errors);
            Assert.AreEqual(8, errors.Count);
            AsynchLog.LogNow(errors);
        }
        protected void checkStock(object sender, ServerValidateEventArgs args)
        {
            BLProduct productData = Session["Product"] as BLProduct;

            int remaining = 0;

            switch (rblSizeOption.SelectedValue)
            {
            case "S":
                args.IsValid = productData.stock[0] >= Convert.ToInt32(tbxQuantity.Text) && productData.stock[0] > 0;
                remaining    = productData.stock[0];
                break;

            case "M":
                args.IsValid = productData.stock[1] >= Convert.ToInt32(tbxQuantity.Text) && productData.stock[1] > 0;
                remaining    = productData.stock[1];
                break;

            case "L":
                args.IsValid = productData.stock[2] >= Convert.ToInt32(tbxQuantity.Text) && productData.stock[2] > 0;
                remaining    = productData.stock[2];
                break;

            case "XL":
                args.IsValid = productData.stock[3] >= Convert.ToInt32(tbxQuantity.Text) && productData.stock[3] > 0;
                remaining    = productData.stock[3];
                break;

            case "XXL":
                args.IsValid = productData.stock[4] >= Convert.ToInt32(tbxQuantity.Text) && productData.stock[4] > 0;
                remaining    = productData.stock[4];
                break;
            }
            csvQuantity.ErrorMessage = "Only " + remaining + " left";
        }
        // Handles update of the selected product
        protected void UpdateProductButton_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                BLProduct currentProduct = Session["Product"] as BLProduct;

                currentProduct.prodDescription = tbxDescription.Text;
                if (fuImgFront.HasFile)
                {
                    currentProduct.image[0] = fuImgFront.FileName;
                }
                if (fuImgBack.HasFile)
                {
                    currentProduct.image[1] = fuImgBack.FileName;
                }
                currentProduct.prodPrice = Convert.ToDouble(tbxPrice.Text);
                currentProduct.stock[0]  = Convert.ToInt32(tbxSmall.Text);
                currentProduct.stock[1]  = Convert.ToInt32(tbxMedium.Text);
                currentProduct.stock[2]  = Convert.ToInt32(tbxLarge.Text);
                currentProduct.stock[3]  = Convert.ToInt32(tbxXLge.Text);
                currentProduct.stock[4]  = Convert.ToInt32(tbxXXL.Text);

                Session["Product"] = currentProduct;

                BLProduct.updateProduct(currentProduct);

                Session.Remove("Product");

                Response.Redirect("~/UL/AdminItemManagement");
            }
        }
        // Adds current product to cart; gets shopping cart model from session and updates (then writes back to session).
        protected void btnAddToCart_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                BLProduct productData = Session["Product"] as BLProduct;

                BLShoppingCart cart = HttpContext.Current.Session["Cart"] as BLShoppingCart;

                bool existingItem = false;

                foreach (BLCartItem item in cart.Items)
                {
                    if (item.Product.prodNumber == productData.prodNumber &&
                        item.Size == rblSizeOption.SelectedItem.Value)
                    {
                        item.Quantity += Convert.ToInt32(tbxQuantity.Text);
                        existingItem   = true;
                        break;
                    }
                }

                if (!existingItem)
                {
                    cart.AddCartItem(new BLCartItem(productData, rblSizeOption.SelectedItem.Value, Convert.ToInt32(tbxQuantity.Text)));
                }

                Response.Redirect("~/UL/Cart");
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.IsSecureConnection)
     {
         // Page only accessible by admin
         if (Session["LoginStatus"].Equals("Admin"))
         {
             if (!IsPostBack)
             {
                 ddlTeam.DataSource = BLProduct.getTeams();
                 ddlTeam.DataBind();
             }
         }
         else
         {
             Response.Redirect("~/UL/ErrorPage/5");
         }
     }
     else
     {
         // Make connection secure if it isn't already
         string url = ConfigurationManager.AppSettings["SecurePath"] + "AdminItemManagementInsert";
         Response.Redirect(url);
     }
 }
Esempio n. 10
0
        // get all Sale Products
        public JsonResult GetAllSaleProducts()
        {
            BLProduct objProduct = new BLProduct();
            List <MVCModels.HiDoctor_Master.ProductModel> lstProd = new List <MVCModels.HiDoctor_Master.ProductModel>();

            lstProd = objProduct.GetAllSaleProducts(_objcurrentInfo.GetCompanyCode());
            return(Json(lstProd, JsonRequestBehavior.AllowGet));
        }
Esempio n. 11
0
 /// <summary>
 /// Delete a product from the list
 /// </summary>
 /// <param name="product">the product with this pruduct`s id will be deleted</param>
 /// <exception cref="ValidateException">Thrown if parameter was null</exception>
 public void DeleteProduct(BLProduct product)
 {
     if (product is null)
     {
         throw new ValidateException("The product cannot be null");
     }
     DB.Products.Delete(product.Id);
 }
Esempio n. 12
0
 private void DisplayDiscountResults()
 {
     resultBLProducts            = BLProduct.RetrieveDiscountedProductsFromDB(connectionString);
     ResultTitle.InnerText       = "Sales";
     ResultImage.Src             = "/Images/sales2016promo.jpg";
     ResultDescription.InnerText = " Dont miss out of this great sale of among our great products with up to 30 % discount. This sale only applies to the products in our current stock. Dont miss out!! First come, first served!";
     DisplayProducts();
 }
Esempio n. 13
0
        protected void OrderNow_OnClick(object sender, EventArgs e)
        {
            List <BLProduct> productsCart = (List <BLProduct>)Session["productsCart"];
            BLProduct        product      = productsCart[0];
            int shopId = BLProduct.GetShopIdByProductId(product.Id);

            Response.Redirect("OrderNow.aspx?shopId=" + shopId);
        }
Esempio n. 14
0
        private void ShowOrderProducts()
        {
            double vatTotal = 0;
            double sumTotal = 0;

            foreach (var cartProduct in order.CartProducts)
            {
                BLProduct product = BLProduct.RetrieveFromDB(connectionString, cartProduct.Id);

                TableCell titleCell = new TableCell {
                    Text = product.Name
                };
                TableCell priceCell = new TableCell {
                    Text = "£" + product.Price * (1 - product.Discount / 100)
                };
                TableCell amountCell = new TableCell {
                    Text = cartProduct.Quantity.ToString()
                };
                double sum = cartProduct.Quantity * product.Price * (1 - product.Discount / 100);
                sumTotal += sum;
                double vat = (product.VAT * sum / (100 + product.VAT));
                vatTotal += vat;
                TableCell vatCell = new TableCell {
                    Text = "£" + vat
                };
                TableCell sumCell = new TableCell {
                    Text = "£" + sum
                };

                TableRow row = new TableRow();
                row.Controls.Add(titleCell);
                row.Controls.Add(priceCell);
                row.Controls.Add(amountCell);
                row.Controls.Add(vatCell);
                row.Controls.Add(sumCell);

                productTable.Controls.Add(row);
            }
            TableCell titleFoot  = new TableCell();
            TableCell priceFoot  = new TableCell();
            TableCell amountFoot = new TableCell();
            TableCell vatFoot    = new TableCell {
                Text = "£" + vatTotal
            };
            TableCell sumFoot = new TableCell {
                Text = "£" + sumTotal
            };

            TableRow footRow = new TableRow();

            footRow.Controls.Add(titleFoot);
            footRow.Controls.Add(priceFoot);
            footRow.Controls.Add(amountFoot);
            footRow.Controls.Add(vatFoot);
            footRow.Controls.Add(sumFoot);

            productTable.Controls.Add(footRow);
        }
        // Redirect to appropriate update page
        protected void gvProducts_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow row = gvProducts.SelectedRow;

            BLProduct product = new BLProduct();

            Session["Product"] = product.selectProduct(row.Cells[0].Text);
            Response.Redirect("~/UL/AdminUpdateSelectedItem");
        }
Esempio n. 16
0
        protected void Shops_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            ChangeShop.Visible    = true;
            searchPanel.Visible   = true;
            Products.Visible      = true;
            shopSelectDiv.Visible = false;
            List <BLProduct> productsCart = (List <BLProduct>)Session["productsCart"];
            bool             toChangeShop = true;

            if (productsCart != null && productsCart.Count > 0)
            {
                //massage to delete all products in cart
                /* bool ToDelete= */
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "Confirm()", true);
                string isConfirmString = isConfirm.Value;

                if (isConfirmString == "1")
                {
                    Session["productsCart"] = null;
                    toChangeShop            = false;
                }
                isConfirm.Value = "0";
                //DialogResult dialogResult = MessageBox.Show("Sure", "Some Title", MessageBoxButtons.YesNo);
                //if (dialogResult == DialogResult.Yes)
                //{
                //    //do something
                //}
                //else if (dialogResult == DialogResult.No)
                //{
                //    //do something else
                //}
            }

            if (toChangeShop)
            {
                int shopId = int.Parse(Shops.SelectedValue);//get shop id
                if (shopId == -1)
                {
                    Products.ProductsCollections = BLProduct.GetAllProducts("");
                }
                else
                {
                    shopName.Text = BlShop.GetShopById(shopId).ShopName;
                    //set data source
                    List <BLProduct> products = BLProduct.GetAllProductsByShopId(shopId, "");
                    if (products != null && products.Count > 0)
                    {
                        Products.ProductsCollections = products;
                    }
                    else
                    {
                        Products.ProductsCollections = null;
                    }
                }
            }
        }
Esempio n. 17
0
        public void CreateProductNullErrorTest()
        {
            List <string> errors         = new List <string>(); // TODO: Initialize to an appropriate value
            List <string> errorsExpected = new List <string>(); // TODO: Initialize to an appropriate value

            BLProduct.CreateProduct(null, ref errors);
            AsynchLog.LogNow(errors);

            Assert.AreEqual(1, errors.Count);
        }
Esempio n. 18
0
        public void UpdateSumCart(List <BLProduct> productsCart)
        {
            int[] productAmounts = (int[])Session["productAmount"];
            int   numOfProducts  = BLProduct.SumArr(productAmounts);

            NumOfProducts.Text = "Num Of Products-" + numOfProducts;
            double totalPrice = BLProduct.TotalPrice(productsCart, productAmounts);

            TotalPrice.Text = "Total Price-" + totalPrice;
        }
Esempio n. 19
0
        public void ProductReadErrorTest()
        {
            List <string> errors             = new List <string>(); // TODO: Initialize to an appropriate value
            int           invalid_Product_id = BLProduct.ReadAllProduct(ref errors).Count + 1;

            BLProduct.ReadProduct(invalid_Product_id, ref errors);
            AsynchLog.LogNow(errors);
            BLProduct.ReadProduct(-1, ref errors);
            AsynchLog.LogNow(errors);
            Assert.AreEqual(2, errors.Count);
        }
Esempio n. 20
0
 /// <summary>
 /// Creates a product and adds
 /// to the list of product
 /// </summary>
 /// <param name="product">The product that will be added</param>
 /// <exception cref="ValidateException">Thrown if parameter was null</exception>
 public void CreateProduct(BLProduct product)
 {
     if (product is null)
     {
         throw new ValidateException("The product cannot be null");
     }
     DB.Products.Create(new Product()
     {
         Id = DB.Products.GetAll().Count() + 1, Category = product.Category, Description = product.Description, Name = product.Name, Price = product.Price
     });
 }
Esempio n. 21
0
        private void RetrieveRandomDiscountedProducts()
        {
            List <BLProduct> discountedProducts = BLProduct.RetrieveDiscountedProductsFromDB(connectionString);

            Random randomProduct = new Random();
            int    ad1           = randomProduct.Next(0, discountedProducts.Count - 2);
            int    ad2           = randomProduct.Next(ad1 + 1, discountedProducts.Count - 1);

            adProductList.Add(discountedProducts[ad1]);
            adProductList.Add(discountedProducts[ad2]);
            Session["adProductList"] = adProductList;
        }
Esempio n. 22
0
        protected void SearchProductB_OnClick(object sender, EventArgs e)
        {
            string searchValue = serchedValue.Text;//get search value

            if (searchValue != "")
            {
                //set values and take care of unexpected value or null error
                int orderBy, shopId;
                try
                {
                    orderBy = int.Parse(productOrder.SelectedValue);
                }
                catch
                {
                    orderBy = 4;
                }
                try
                {
                    shopId = ((BlShopManager)Session["user"]).ShopId;
                }
                catch
                {
                    shopId = -1;
                }
                try
                {
                    string ch           = SearchBy.Items[SearchBy.SelectedIndex].ToString();//get by what to search
                    bool   IsSearchName = (ch == "Product name");
                    if (!IsSearchName && !double.TryParse(searchValue, out double result))
                    {
                        //if searching by price and search val is not a value error msg
                        MSG.Text = "please a valid price '" + searchValue + "' is not a number";
                    }
                    else
                    {
                        //get the list by the parameters
                        List <BLProduct> products = BLProduct.Search(searchValue, shopId, IsSearchName, orderBy);
                        UpdateData(products); //set data source

                        MSG.Text = "";        //set text to no error
                    }
                }
                catch (Exception exception)
                {
                    MSG.Text = "please select by what you want to search " + exception.Message;// error massage
                }
            }
            else
            {
                MSG.Text = "please type the value you want to search";// error massage
            }
        }
Esempio n. 23
0
        public void ChangeProduct_Test()
        {
            BLAdmin admin = new BLAdmin()
            {
                Id = 12, Email = "qwerty@", FirstName = "Name", LastName = "LastName", NumberofCard = 1234567890, Pasword = "qwerty1234"
            };
            BLProduct product = productService.GetProduct(3);

            userService.AddUser(admin);
            productService.EditProduct(product.Id, 123);

            Assert.That(productService.GetProduct(3).Price == 123);
        }
Esempio n. 24
0
        public void AddToBasket_TestForAdmin()
        {
            BLAdmin admin = new BLAdmin()
            {
                Id = 12, Email = "qwerty@", FirstName = "Name", LastName = "LastName", NumberofCard = 1234567890, Pasword = "qwerty1234"
            };
            BLProduct product = productService.GetProduct(3);

            userService.AddUser(admin);
            productService.AddToBasket(admin, product.Id);

            Assert.AreEqual(product.Name, productService.GetBasket(admin).Last().Name);
        }
Esempio n. 25
0
 protected void ProductsList_OnItemCommand(object source, DataListCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         List <BLProduct> products = (List <BLProduct>)Session["products"];
         BLProduct        product  = products[e.Item.ItemIndex];
         //remove from list
         products.Remove(product);
         //remove from DB
         product.RemoveProduct();
         UpdateData(products);
     }
 }
Esempio n. 26
0
        public IHttpActionResult GetProduct(int ProductID)
        {
            Product P = BLProduct.GetProduct(ProductID);

            if (P != null)
            {
                return(Ok(P));
            }
            else //Supplierid not found
            {
                return(NotFound());
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.IsSecureConnection)
            {
                // Page only accessible by admin
                if (Session["LoginStatus"].Equals("Admin"))
                {
                    if (!IsPostBack)
                    {
                        ddlTeam.DataSource = BLProduct.getTeams();
                        ddlTeam.DataBind();

                        BLProduct product = Session["Product"] as BLProduct;
                        tbxFirstName.Text     = product.playFirstName;
                        tbxLastName.Text      = product.playLastName;
                        tbxDescription.Text   = product.prodDescription;
                        ddlTeam.SelectedValue = product.teamID;
                        imgFront.ImageUrl     = "~/UL/Images/jerseys/" + product.image[0];
                        imgBack.ImageUrl      = "~/UL/Images/jerseys/" + product.image[1];
                        tbxJerNumber.Text     = product.jerNumber.ToString();
                        tbxPrice.Text         = string.Format("{0:F2}", product.prodPrice);
                        tbxSmall.Text         = product.stock[0].ToString();
                        tbxMedium.Text        = product.stock[1].ToString();
                        tbxLarge.Text         = product.stock[2].ToString();
                        tbxXLge.Text          = product.stock[3].ToString();
                        tbxXXL.Text           = product.stock[4].ToString();
                        if (product.prodActive)
                        {
                            RemoveProductButton.CssClass = "btn btn-danger";
                            RemoveProductButton.Text     = "Active";
                        }
                        else
                        {
                            RemoveProductButton.CssClass = "btn btn-outline-danger";
                            RemoveProductButton.Text     = "Inactive";
                        }
                    }
                }
                else
                {
                    Response.Redirect("~/UL/ErrorPage/5");
                }
            }
            else
            {
                // Make connection secure if it isn't already
                string url = ConfigurationManager.AppSettings["SecurePath"] + "AdminUpdateSelectedItem";
                Response.Redirect(url);
            }
        }
Esempio n. 28
0
        private void ShowVariants()
        {
            List <BLProduct> variantList = BLProduct.RetrieveVariantsOfProductFromDB(connectionString, product.Id);

            DropDownVariants.Items.Clear();
            ListItem selectedProduct = new ListItem(productTitle.InnerText, product.Id.ToString());

            DropDownVariants.Items.Add(selectedProduct);
            foreach (BLProduct variant in variantList)
            {
                ListItem item = new ListItem(variant.Name, variant.Id.ToString());
                DropDownVariants.Items.Add(item);
            }
        }
Esempio n. 29
0
 protected void OrderNow_OnClick(object sender, EventArgs e)
 {
     if (IsGoodAmount())
     {
         List <BLOrderDetailsDB> orderDetails = (List <BLOrderDetailsDB>)Session["orderDetails"];
         BLProduct product = BLProduct.GetProductById(orderDetails[0].productId);
         int       shopId  = BLProduct.GetShopIdByProductId(product.Id); //get shop id
         Response.Redirect("OrderNow.aspx?shopId=" + shopId);            //pass shop id in qwaery string
     }
     else
     {
         //msg!!!!!!!!!!!!!!!!!!!!
     }
 }
Esempio n. 30
0
        private void ShowPopularProducts()
        {
            popularProductList = BLProduct.RetrieveTopNPopularProductsFromDB(connectionString, numberOfProducts: 3);

            LinkPop1.NavigateUrl = "Product.aspx?productId=" + popularProductList[0].Id;
            ImagePop1.ImageUrl   = "ImgHandler.ashx?productId=" + popularProductList[0].Id;
            TitlePop1.Text       = popularProductList[0].Name;
            if (popularProductList[0].Discount > 0)
            {
                OriginalPricePop1.Text = "<strike>£" + popularProductList[0].Price +
                                         "</strike>";
                DiscountPricePop1.Text = "£" +
                                         (popularProductList[0].Price * (1 - popularProductList[0].Discount / 100));
            }
            else
            {
                OriginalPricePop1.Text = "Price: £" + popularProductList[0].Price;
            }

            LinkPop2.NavigateUrl = "Product.aspx?productId=" + popularProductList[1].Id;
            ImagePop2.ImageUrl   = "ImgHandler.ashx?productId=" + popularProductList[1].Id;
            TitlePop2.Text       = popularProductList[1].Name;
            if (popularProductList[1].Discount > 0)
            {
                OriginalPricePop2.Text = "<strike>£" + popularProductList[1].Price +
                                         "</strike>";
                DiscountPricePop2.Text = "£" +
                                         (popularProductList[1].Price * (1 - popularProductList[1].Discount / 100));
            }
            else
            {
                OriginalPricePop2.Text = "Price: £" + popularProductList[1].Price;
            }

            LinkPop3.NavigateUrl = "Product.aspx?productId=" + popularProductList[2].Id;
            ImagePop3.ImageUrl   = "ImgHandler.ashx?productId=" + popularProductList[2].Id;
            TitlePop3.Text       = popularProductList[2].Name;
            if (popularProductList[2].Discount > 0)
            {
                OriginalPricePop3.Text = "<strike>£" + popularProductList[2].Price +
                                         "</strike>";
                DiscountPricePop3.Text = "£" +
                                         (popularProductList[2].Price * (1 - popularProductList[2].Discount / 100));
            }
            else
            {
                OriginalPricePop3.Text = "Price: £" + popularProductList[2].Price;
            }
        }
Esempio n. 31
0
    public bool AddProductStockCheck(int productID, int quantity, bool personalize)
    {
        BLProduct product = new BLProduct();
            product.ID = productID;
            product.Retrieve();

            DataRow[] rows = this.Products.Tables[0].Select("ProductID=" + productID.ToString());
            int prdQuantityAtCart = ( rows.Length > 0 ) ? (int)(rows[0]["Quantity"]) : 0;

            if( quantity + prdQuantityAtCart > product.Inventory )
                return false;
            else
                DALCShoppingCart.Add(productID, this.customerID, quantity, personalize);

            return true;
    }
Esempio n. 32
0
    public bool SetQuantityStockCheck(int ProductID, int Quantity)
    {
        BLProduct product = new BLProduct();
            product.ID = ProductID;
            product.Retrieve();

            if( Quantity > product.Inventory )
                return false;
            else
                DALCShoppingCart.SetQuantity(ProductID, this.customerID, Quantity);

            return true;
    }