public string Add_New_Cust(string ID, string First_Name, string Last_Name, string Address, string Phone, string Date_of_Birth, string Email, string Password) { string result = ""; connection.Open(); OleDbCommand searchCommand = new OleDbCommand(); searchCommand.Connection = connection; searchCommand.CommandText = "select Customer_ID from Customers where Customer_ID='" + ID + "'"; OleDbDataReader reader = searchCommand.ExecuteReader(); if (reader.Read() == false) //No Matching ID { PaymentWindow payment_window = new PaymentWindow(); payment_window.ShowDialog(); if (payment_window.getStatus()) { OleDbCommand addCommand = new OleDbCommand(); addCommand.Connection = connection; addCommand.CommandText = "insert into Customers (Customer_ID, First_Name, Last_Name, Address, Phone, Date_Of_Birth, Email, [Password]) Values ('" + ID + "','" + First_Name + "','" + Last_Name + "','" + Address + "','" + Phone + "','" + Date_of_Birth + "','" + Email + "','" + Password + "');"; addCommand.ExecuteNonQuery(); } } else result = "קיים כבר מנוי בעל תעודת זהות זהה"; connection.Close(); return result; }
private void Confirm_Btn_Click(object sender, RoutedEventArgs e) { PaymentWindow payment_window = new PaymentWindow(); payment_window.ShowDialog(); if (payment_window.getStatus()) { string order_id = controller.updateAmounts(SoldItems, this.tbx_ID.Text, total); MessageBox.Show("ההזמנה בוצעה בהצלחה" + "\n" + "מספר ההזמנה: " + order_id); Cust_Window.Back_to_Main_Btn_Click(null, null); } }