private void CustomerBtn_Click(object sender, RoutedEventArgs e) { CustomerWindow customerWindow = new CustomerWindow(); customerWindow.homeBtn.IsEnabled = false; customerWindow.closeBtn.IsEnabled = true; customerWindow.ShowDialog(); }
private bool bindDataBills(bool id) { bool flag = true; if (id) { if (bill_id.ToString().Equals("") || bill_id.ToString().Equals("0")) { MessageBox.Show("BILL ID ERROR. Failed to Update..!", "Error"); flag = false; goto FUNEND; } else { try { tosentBills.bill_id = bill_id; } catch (Exception e) { MessageBox.Show("BILL_ID ERROR. Failed to Update..!", "Error"); flag = false; goto FUNEND; } } } else { tosentBills.bill_id = 0; } if (tableTxtBox.Text.Equals("")) { MessageBox.Show("Please enter the table name..!", "Error"); flag = false; goto FUNEND; } else { tosentBills.bill_table = tableTxtBox.Text; } if (PaymentComboBox.Text.ToString().Equals("")) { MessageBox.Show("Please Select a payment method..!", "Error"); flag = false; goto FUNEND; } else { tosentBills.bill_payment = PaymentComboBox.Text; } if (CustomerComboBox.Text.ToString().Equals("")) { tosentBills.bill_customer = ""; } else { try { tosentBills.bill_customer = CustomerComboBox.SelectedValue.ToString(); } catch (Exception ex) { MessageBoxResult messageBoxResult = MessageBox.Show("Customer Not found. Do you want to add?", "Customer", MessageBoxButton.YesNo); switch (messageBoxResult) { case MessageBoxResult.Yes: CustomerWindow customerWindow = new CustomerWindow(); customerWindow.homeBtn.IsEnabled = false; customerWindow.closeBtn.IsEnabled = true; customerWindow.CusNameTextBox.Text = CustomerComboBox.Text; customerWindow.isOpenedForAdd = true; customerWindow.CusNameTextBox.IsEnabled = false; customerWindow.clearBtn.IsEnabled = false; customerWindow.ShowDialog(); if (DbFun.getCustomerId(CustomerComboBox.Text.ToString()) != 0) { tosentBills.bill_customer = DbFun.getCustomerId(CustomerComboBox.Text.ToString()).ToString(); } else { tosentBills.bill_customer = ""; } break; case MessageBoxResult.No: tosentBills.bill_customer = ""; break; } } } FUNEND : {} return(flag); }