private void submitButton_Click(object sender, EventArgs e) { if (customerComboBox.Text == "-Select-") { MessageBox.Show("Select a customer"); return; } salesDataGridView.DataSource = null; Sales _sale = new Sales(); _sale.CustomerId = Convert.ToInt32(customerComboBox.SelectedValue); _sale.Date = salesDateTimePicker.Value; _sale.LoyalityPoint = Convert.ToInt32(loyalityPointTextBox.Text); _sale.GrandTotal = Convert.ToDouble(grandTotalTextBox.Text); _sale.Discount = Convert.ToDouble(discountTextBox.Text); _sale.DiscountAmount = Convert.ToDouble(discountAmountTextBox.Text); _sale.PayableAmount = Convert.ToDouble(payableAmountTextBox.Text); bool isSubmited = _salesManager.Submit(_sale); if (isSubmited) { MessageBox.Show("Saved"); } else { MessageBox.Show("Not Saved"); } SalesProduct salesProduct = new SalesProduct(); salesProduct.CategoryId = Convert.ToInt32(categoryComboBox.SelectedValue); salesProduct.ProductId = Convert.ToInt32(productComboBox.SelectedValue); availableQuantityTextBox.Text = _salesManager.AvailableQuantity(salesProduct).ToString(); loyalityPointTextBox.Text = Loyality(Convert.ToDouble(grandTotalTextBox.Text)).ToString(); }