private void btnDisplay_ItemClick(object sender, ItemClickEventArgs e) { try { if (Customer.EditValue == null) { MessageBox.Show("You must Choose Customer", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } DataTable dt = CustomerManager.GetCustomerStatement(Customer.EditValue.ToString(), null, null, out Customer_Debit, out Customer_Credit); CustomerStatementGrid.DataSource = dt; CustomerStatementGrid.DataMember = dt.TableName; CustomerDebit.Caption = Customer_Debit.ToString(); CustomerCredit.Caption = Customer_Credit.ToString(); CustomerBalance.Caption = (Customer_Debit - Customer_Credit).ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnPeriodDisplay_ItemClick(object sender, ItemClickEventArgs e) { try { if (Customer.EditValue == null) { MessageBox.Show("You must Choose Customer", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } else if (DateFrom.EditValue == null) { MessageBox.Show("You must Choose From Date", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } else if (DateTo.EditValue == null) { MessageBox.Show("You must Choose To Date", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } else if ((DateTime)DateFrom.EditValue > (DateTime)DateTo.EditValue) { MessageBox.Show("From Date must be Less than Or Equal To Date", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } DataTable dt = CustomerManager.GetCustomerStatement(Customer.EditValue.ToString(), (DateTime)DateFrom.EditValue, (DateTime)DateTo.EditValue, out Customer_Debit, out Customer_Credit); CustomerStatementGrid.DataSource = dt; CustomerStatementGrid.DataMember = dt.TableName; CustomerDebit.Caption = Customer_Debit.ToString(); CustomerCredit.Caption = Customer_Credit.ToString(); CustomerBalance.Caption = (Customer_Debit - Customer_Credit).ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }