private void btnReportSales_Click(object sender, EventArgs e) { try { AllSalesReport.CheckItemReport(combItemName.Text, dateTimeFrom.Value); AllSalesReport.InsertReport(combItemName.Text, dateTimeFrom.Value); MessageBox.Show("Report completed Successfully", "Sales Report", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "Report Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnReportSales_Click(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(combItemName.Text)) { AllSalesReport.CheckItemReport(combItemName.Text, DateTime.Today); AllSalesReport.InsertReport(combItemName.Text, DateTime.Today); MessageBox.Show("Report completed Successfully", "Sales Report", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { throw new Exception("No Item is selected for report"); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Report Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } }