private void purchase_btn_Click(object sender, RoutedEventArgs e) { int n; bool isNumeric = int.TryParse(this.price.Text, out n); int n2; bool isNumeric2 = int.TryParse(this.size.Text, out n2); if (string.IsNullOrWhiteSpace(this.pid.Text)) { if (string.IsNullOrWhiteSpace(this.pid.Text)) { pid.Background = Brushes.Red; } MessageBox.Show("Validate"); return; } if ((isNumeric == false) || string.IsNullOrWhiteSpace(this.category.Text) || (isNumeric2 == false) || string.IsNullOrWhiteSpace(this.color.Text) || string.IsNullOrWhiteSpace(this.brand.Text) || string.IsNullOrWhiteSpace(this.purchaseDate.Text)) { search_btn_Click(sender, e); if (string.IsNullOrWhiteSpace(this.pid.Text)) { return; } } saleBO sale = new saleBO(); sale.Pid = this.pid.Text; sale.PurchaseDate = this.purchaseDate.Text; //MessageBox.Show(item.Pid + " " + item.Price + " " + item.Category + " " + item.Size + " " + item.Color + " " + item.Brand + " " + item.Date); saleBLL salebl = new saleBLL(); int rv = salebl.ssaleItem(sale); if (rv == 0) { MessageBox.Show("Soled"); this.pid.Text = null; this.price.Text = null; this.category.Text = null; this.size.Text = null; this.color.Text = null; this.brand.Text = null; //this.quantity.Text = null; } else if (rv == 3) { MessageBox.Show("Product Is Not Available"); this.pid.Text = null; } else { MessageBox.Show("Error"); } }
private void search_btn_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(this.pid.Text)) { if (string.IsNullOrWhiteSpace(this.pid.Text)) { pid.Background = Brushes.Red; } MessageBox.Show("Validate"); return; } ItemBO item = new ItemBO(); item.Pid = this.pid.Text; saleBLL salebl = new saleBLL(); item = salebl.searchItem(item); if (item == null) { MessageBox.Show("Product is not Available"); this.pid.Text = null; this.price.Text = null; this.category.Text = null; this.size.Text = null; this.color.Text = null; this.brand.Text = null; //this.entryDate.Text = null; //this.quantity.Text = null; } else { this.pid.Text = item.Pid; this.price.Text = item.Price.ToString(); this.category.Text = item.Category; this.size.Text = item.Size.ToString(); this.color.Text = item.Color; this.brand.Text = item.Brand; //this.entryDate.Text = item.Date; //this.quantity.Text = item.Quantity.ToString(); this.pid.IsEnabled = false; } }