Example #1
0
 public Product(int productId, string productName, string productDescription) : this()
 {
     this.ProductName        = productName;
     this.ProductDescription = productDescription;
     this.ProductId          = productId;
     if (ProductName.StartsWith("Bulk"))
     {
         this.MinimumPrice = 9.99m;
     }
 }
Example #2
0
 public Product(int productId, string productName, string description) : this()
 {
     this.ProductId   = productId;
     this.ProductName = productName;
     this.Description = description;
     if (ProductName.StartsWith("Bulk"))
     {
         this.MinimumPrice = 9.99m;
     }
     Console.WriteLine("Product instance has a name: " + ProductName);
 }
Example #3
0
        private void btn_Search_Click(object sender, RoutedEventArgs e)
        {
            var CustomerFiltered = from product in DB.SelectAllProducts()
                                   let ProductName = product.Name
                                                     where
                                                     ProductName.StartsWith(TextBox_Search.Text.ToLower()) ||
                                                     ProductName.StartsWith(TextBox_Search.Text.ToUpper()) ||
                                                     ProductName.Contains(TextBox_Search.Text)
                                                     select product;

            ListBox_Products.ItemsSource = CustomerFiltered;
        }
Example #4
0
        public Product(int productID, string productName, string productDescription)
        {
            this.ProductID          = productID;
            this.ProductName        = productName;
            this.ProductDescription = productDescription;
            if (ProductName.StartsWith("Bulk"))
            {
                this.MinimumPrice = 9.99m;
            }

            Console.WriteLine("No. " + ProductID + " called: " + ProductName + " is a " + ProductDescription);
        }
Example #5
0
        public Product(int productId, string productName, string description) : this()
        {
            this.ProductId   = productId;
            this.ProductName = productName;
            this.Description = description;
            if (ProductName.StartsWith("Bulk"))
            {
                this.MinimumPrice = 9.99m;
            }


            Console.WriteLine($"Product instance is intantiated and has name {ProductName}");
        }
Example #6
0
        //ctor initializing properties
        public Product(string productName,
                       int productId,
                       string description) : this()
            //setting passed values to properties
        {
            this.ProductName = productName;
            this.ProductId   = productId;
            this.Description = description;
            if (ProductName.StartsWith("Bulk"))
            {
                this.MinimumPrice = 9.99m;
            }

            Console.WriteLine($"Product instance has a name: {ProductName}");
        }
Example #7
0
 /// <summary>
 /// Function called to search the model
 /// for availability of the specified string.
 /// </summary>
 /// <param name="str">The search string</param>
 /// <returns>True, if the string is contained in the model, else false</returns>
 public override bool Contains(string str)
 {
     return(ProductName != null && ProductName.StartsWith(str, StringComparison.CurrentCultureIgnoreCase));
 }