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; } }
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); }
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; }
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); }
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}"); }
//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}"); }
/// <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)); }