//not final private void recoveryData() { try { bool hasEnable = false; double total = 0; double isdiscount = 0; dataGridTransaction.Rows.Clear(); MySqlDataReader reader = pos.displayRecoveryData(); while (reader.Read()) { Transactionlbl.Text = reader["transactionNo"].ToString(); total += Convert.ToDouble(reader["total"].ToString()); isdiscount += Convert.ToDouble(reader["discount"].ToString()); cart_qty = int.Parse(reader["quantity"].ToString()); dataGridTransaction.Rows.Add(reader["transaction_id"].ToString(), reader["products_id"].ToString(), reader["description"].ToString(), reader["price"].ToString(), reader["quantity"].ToString(), reader["discount"].ToString(), reader["total"].ToString()); hasEnable = true; } total_sales.Text = total.ToString("#,##0.00"); txtdiscount.Text = isdiscount.ToString("#,##0.00"); getTotal(); if (hasEnable == true) { settlePayment.Enabled = true; addDiscount.Enabled = true; } else { settlePayment.Enabled = false; addDiscount.Enabled = false; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }