Exemplo n.º 1
0
        /// <summary>
        /// Purpose: Update an existing product
        /// Accepts: Nothing
        /// Returns: Boolean
        /// </summary>
        public bool UpdateProduct()
        {
            bool isSuccess = false;
            try
            {
                Hashtable hsh = new Hashtable();
                hsh["productcode"] = ProductCode;
                hsh["name"] = Name;
                hsh["brand"] = Brand;
                hsh["description"] = Description;
                hsh["categoryid"] = CategoryID;
                hsh["msrp"] = Msrp;
                hsh["isfreeshipping"] = IsFreeShipping;
                hsh["istaxfree"] = IsTaxFree;
                hsh["quantityinstock"] = QuantityInStock;
                hsh["isquantityunlimited"] = IsQuantityUnlimited;
                hsh["created"] = Created;
                hsh["isactive"] = IsActive;

                ProductData prodData = new ProductData();
                isSuccess = prodData.UpdateProduct(hsh);
            }
            catch (Exception ex)
            {
                ErrorRoutine(ex, "Product", "UpdateProduct()");
            }

            return isSuccess;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Purpose: Grabs all products for a given category id
        /// Accepts: Integer, Boolean
        /// Returns: List<Product>
        /// </summary>
        public List<Product> GetAllProductsByCategoryID(int catid, bool onlyActive)
        {
            List<Product> products = new List<Product>();
            try
            {
                ProductData data = new ProductData();
                List<QSRDataObjects.Product> dataProducts = data.GetAllProductsByCategoryID(catid, onlyActive);

                foreach (QSRDataObjects.Product p in dataProducts)
                {
                    Product prod = new Product();
                    prod.ProductCode = p.ProductCode;
                    prod.Name = p.Name;
                    prod.Brand = p.Brand;
                    prod.Description = p.Description;
                    prod.CategoryID = Convert.ToInt32(p.CategoryID);
                    prod.Msrp = Convert.ToDouble(p.MSRP);
                    prod.IsFreeShipping = p.isFreeShipping;
                    prod.IsTaxFree = p.isTaxFree;
                    prod.QuantityInStock = Convert.ToInt32(p.QuantityInStock);
                    prod.IsQuantityUnlimited = p.IsQuantityUnlimited;
                    prod.Created = p.Created;
                    prod.Modified = p.Modified;
                    prod.IsActive = p.isActive;
                    products.Add(prod);
                }
            }
            catch (Exception ex)
            {
                ErrorRoutine(ex, "Product", "GetAllProducts");
            }
            return products;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Purpose: Grabs product information based on product code
        /// Accepts: String
        /// Returns: Nothing
        /// </summary>
        public void GetProductByCode(string code)
        {
            try
            {
                ProductData data = new ProductData();
                Hashtable hsh = new Hashtable();

                hsh = data.GetProductByCode(code);

                ProductCode = code;
                Name = hsh["name"];
                Brand = hsh["brand"];
                Description = hsh["description"];
                CategoryID = Convert.ToInt32(hsh["categoryid"]);
                Msrp = Convert.ToDouble(hsh["msrp"]);
                IsFreeShipping = hsh["isfreeshipping"];
                IsTaxFree = hsh["istaxfree"];
                QuantityInStock = Convert.ToInt32(hsh["quantityinstock"]);
                IsQuantityUnlimited = hsh["isquantityunlimited"];
                Created = hsh["created"];
                Modified = hsh["modified"];
                IsActive = hsh["isactive"];
            }
            catch (Exception ex)
            {
                ErrorRoutine(ex, "Product", "GetProductByCode");
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Purpose: Add a new product
        /// Accepts: Nothing
        /// Returns: String (Product Code)
        /// </summary>
        public string AddProduct()
        {
            //The product code that was added to database
            string retProdcd = "";

            try
            {
                Hashtable hsh = new Hashtable();
                hsh["productcode"] = ProductCode;
                hsh["name"] = Name;
                hsh["brand"] = Brand;
                hsh["description"] = Description;
                hsh["categoryid"] = CategoryID;
                hsh["msrp"] = Msrp;
                hsh["isfreeshipping"] = IsFreeShipping;
                hsh["istaxfree"] = IsTaxFree;
                hsh["quantityinstock"] = QuantityInStock;
                hsh["isquantityunlimited"] = IsQuantityUnlimited;
                hsh["created"] = Created;
                hsh["modified"] = Modified;
                hsh["isactive"] = IsActive;

                ProductData prodData = new ProductData();
                retProdcd = prodData.AddProduct(hsh);
            }
            catch (Exception ex)
            {
                ErrorRoutine(ex, "Product", "AddProduct()");
            }

            return retProdcd;
        }