public ProductComponents(int id) { this.Id = id; ProductController product_obj = new ProductController(); DataTable dt = product_obj.GetDetailByID(id); if (dt.Rows.Count > 0) { this.NetPrice = Convert.ToDecimal(dt.Rows[0]["NetPrice"].ToString()); this.GrossPrice = Convert.ToDecimal(dt.Rows[0]["GrossPrice"].ToString()); this.Tax = Convert.ToDecimal(dt.Rows[0]["TaxRate"].ToString()); this.Discount = Convert.ToDecimal(dt.Rows[0]["DiscountRate"].ToString()); this.Description = dt.Rows[0]["ShortDescription"].ToString(); this.Name = dt.Rows[0]["Product_Name"].ToString(); this.Image = dt.Rows[0]["PhotoFileName"].ToString(); this.AvailableQuantity = Convert.ToInt32(dt.Rows[0]["UnitsInStock"].ToString()) - Convert.ToInt32(dt.Rows[0]["UnitsOnOrder"].ToString()); this.VendorId = Convert.ToInt32(dt.Rows[0]["Vendor_Id"].ToString()); this.Weight = Convert.ToInt32(dt.Rows[0]["Weight"].ToString()); } }
/// <summary> /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToProducts(ProductController product) { base.AddObject("Products", product); }
/// <summary> /// Create a new Product object. /// </summary> /// <param name="product_Id">Initial value of the Product_Id property.</param> /// <param name="product_No">Initial value of the Product_No property.</param> /// <param name="category_Code">Initial value of the Category_Code property.</param> /// <param name="alias">Initial value of the Alias property.</param> public static ProductController CreateProduct(global::System.Int32 product_Id, global::System.Guid product_No, global::System.String category_Code, global::System.String alias) { ProductController product = new ProductController(); product.Product_Id = product_Id; product.Product_No = product_No; product.Category_Code = category_Code; product.Alias = alias; return product; }