private void btnDone_Click(object sender, EventArgs e) { try { string Id = string.Empty; if (chkCash.Checked) { Customer customer = new Customer(); DataTable dtCustomer = customer.SelectCustomerByCode("CASH"); if (dtCustomer != null && dtCustomer.Rows.Count > 0) { Id = Convert.ToString(dtCustomer.Rows[0]["CustomerId"]); string balance = Convert.ToString(dtCustomer.Rows[0]["CustomerBalance"]); customer.InsertUpdateCustomer(Id, "CASH", txtCashName.Text, string.Empty, txtCashAddress.Text, balance, "1", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty); } else { Id = "0"; if (customer.InsertUpdateCustomer(Id, "CASH", txtCashName.Text, string.Empty, txtCashAddress.Text, "0.00", "1", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty)) { dtCustomer = customer.SelectCustomerByCode("CASH"); Id = Convert.ToString(dtCustomer.Rows[0]["CustomerId"]); } } } else if (cbCustomer.Text.ToLower() == "cash") { MessageBox.Show("To make a cash sale, CASH checkbox must be checked."); chkCash.Checked = true; return; } Save(Id); } catch (Exception ex) { ExceptionLog.LogException(Modules.POS, "Save", ex, "POS Exception"); } }