public void PayBill(String customer_id, double customer_balance, double bill_amount, int bill_id, String type) { int j; try { connection.openConnection(); double updated_balance = customer_balance - bill_amount; MySqlCommand command = new MySqlCommand("DELETE FROM bill WHERE Bill_ID =@Id ", connection.mysqlconnect); command.Parameters.AddWithValue("@Id", bill_id); int i = command.ExecuteNonQuery(); CustomerDal customerDal = new CustomerDal(); if (type == "loan") { double debt = customerDal.getCustomerCreditDebt(customer_id); double updated_debt = debt - bill_amount; MySqlCommand command2 = new MySqlCommand("Update customer set creditDebt=@updated_debt where customer_id=@Id", connection.mysqlconnect); command2.Parameters.AddWithValue("@Id", customer_id); command2.Parameters.AddWithValue("@updated_debt", updated_debt); j = command2.ExecuteNonQuery(); int k = customerDal.updateBalance(customer_id, updated_balance); } else { j = customerDal.updateBalance(customer_id, updated_balance); } if (i > 0 && j > 00) { MessageBox.Show("Bill was paid succesfully"); } else { MessageBox.Show("Operation could not complete please try again"); } } catch (Exception e) { MessageBox.Show(e.Message); } connection.closeConnection(); }