private void btnRefresh_Click(object sender, EventArgs e) { try { int supplierId = 0; if (luSuppliers.Text.Trim() != String.Empty) { if (!int.TryParse(luSuppliers.SelectedValue.ToString(), out supplierId)) { throw new Exception("SupplierId is not a valid Integer type!"); } } String supplierTypeCode = luSupplierTypes.Text.Trim(); String bankAccountCode = luBankAccount.Text.Trim(); DateTime fromDate = dtDateFrom.Value.Date; DateTime toDate = dtDateTo.Value.Date.AddDays(1); String username = luUsers.Text.Trim(); List <Data_Payment> payments = Data_Payment.GetPayments(username, supplierId, supplierTypeCode, bankAccountCode, fromDate, toDate); if (payments != null) { bsRecords.DataSource = payments; lblTotalAmount.Text = String.Format("Total Amount: {0: 0.00}", payments.Sum(a => a.Amount)); } } catch (Exception ex) { Utils.ShowException(ex); } }
private void btnViewBankAccount_Click(object sender, EventArgs e) { try { Data_Payment payment = Utils.GetCurrentRecord <Data_Payment>(bsRecords); if (payment != null) { Data_BankAccount bankAccount = Data_BankAccount.GetBankAccount(payment.BankAccountCode); if (bankAccount != null) { BankAccountDialogFrm frm = new BankAccountDialogFrm(Common.FormMode.View, bankAccount); frm.ShowDialog(); } } } catch (Exception ex) { Utils.ShowException(ex); } }
private void btnViewSupplier_Click(object sender, EventArgs e) { try { Data_Payment payment = Utils.GetCurrentRecord <Data_Payment>(bsRecords); if (payment != null) { Data_Supplier supplier = Data_Supplier.GetSupplier(payment.SupplierID); if (supplier != null) { SupplierDialogFrm frm = new SupplierDialogFrm(Common.FormMode.View, supplier); frm.ShowDialog(); } } } catch (Exception ex) { Utils.ShowException(ex); } }