Beispiel #1
0
 private void deleteButton_Click(object sender, EventArgs e)//deletes the customer from the system. OR shows error if the open balance is not 0
 {
     if (!(customerNumberUpDown.Text == "0"))
     {
         if (Customer.CheckBalance(customerNumberUpDown.Text))
         {
             Customer.DeleteCustomer(customerNumberUpDown.Text);
             using (StreamWriter log = File.AppendText(path))
             {
                 log.WriteLine("" + DateTime.Now + " : Customer delete: CustomerNumber = " +
                               customerNumberUpDown.Text + ";");
                 this.Close();
             }
         }
         else
         {
             MessageBox.Show("The balance has to be 0 before deleting a customer");
         }
     }
     else
     {
         MessageBox.Show("Please choose a Customer!");
     }
 }