void search_Button_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { var productDbUtils1 = new ProductDbUtils(); var productDbUtils2 = new ProductDbUtils(); var productCategoryDbUtils = new ProductCategoryDbUtils(); if (productcode_Textbox.Text == "") { MessageBox.Show("Dont leave empty!"); } else { if (productDbUtils1.getProductByCode(productcode_Textbox.Text) == true) { product = new Product(); productCategory = new ProductCategory(); product = productDbUtils2.getProduct(productcode_Textbox.Text); productCategory = productCategoryDbUtils.getProductCategory(product.getProductCategoryCode()); costumer_Reciept.Text = firstname_TextBox.Text + " " + lastname_TextBox.Text; contact_Reciept.Text = contact_Textbox.Text; name_Reciept.Text = product.getProductName(); brand_Reciept.Text = product.getProductBrand(); description_Reciept.Text = productCategory.getCategoryDescription(); type_Reciept.Text = productCategory.getCategoryType(); price_Reciept.Text = product.getProductPrice().ToString(); } else { MessageBox.Show("No Product found!"); } } }
void search_Button_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (productCode_Textbox.Text == "") { MessageBox.Show("Dont leave blank"); } else { productDbUtils = new ProductDbUtils(); if (productDbUtils.getProductByCode(productCode_Textbox.Text) == false) { MessageBox.Show("Product not found!"); } else { var operationWindow = new OperationWindow(productCode_Textbox.Text); Close(); operationWindow.Show(); } } }