private void btnSearch_Click(object sender, EventArgs e) { BankTransactionBL bl = new BankTransactionBL(); string searchText = ddlTranType.Text; if (ddlTranType.Text == "BOTH") { var lstBankTran = bl.GetBankAccountTransaction().Where(et => Convert.ToDateTime(Convert.ToDateTime(et.TransactionDate).ToShortDateString()) >= Convert.ToDateTime(dtStartDate.Text) && Convert.ToDateTime(Convert.ToDateTime(et.TransactionDate).ToShortDateString()) <= Convert.ToDateTime(dtEndDate.Text)).ToList(); dgBankTran.DataSource = lstBankTran; } else { var lstBankTran = bl.GetBankAccountTransaction().Where(et => Convert.ToDateTime(Convert.ToDateTime(et.TransactionDate).ToShortDateString()) >= Convert.ToDateTime(dtStartDate.Text) && Convert.ToDateTime(Convert.ToDateTime(et.TransactionDate).ToShortDateString()) <= Convert.ToDateTime(dtEndDate.Text)).ToList() .Where( efu => efu.TransactionType.ToUpper().Contains(ddlTranType.Text.ToUpper()) ).ToList(); dgBankTran.DataSource = lstBankTran; } if (dgBankTran.RowCount > 0) { btnDownload.Visible = true; } }
private void PopulateValues() { BankTransactionBL bl = new BankTransactionBL(); var etr = bl.GetBankAccountTransaction().FirstOrDefault(et => et.BankAccountTransactionID == _bankTransactionID); var bt = bl.GetBankAccountType().FirstOrDefault(x => x.BankAccountTypeID == etr.BankAccountTypeID); ComboboxItem item = new ComboboxItem(); item.Text = bt.BankAccountTypeDescription; item.Value = bt.BankAccountTypeID; ddlBankAccount.Text = item.Text; ddlTranType.Text = ""; ddlTranType.SelectedText = etr.TransactionType; txtAmount.Text = etr.Amount.ToString(); txtComments.Text = etr.Description;; dtTranDate.Text = etr.TransactionDate.ToShortDateString(); ddlType.Text = ""; ddlType.SelectedText = etr.Type; }
private void LoadDefaultValues() { BankTransactionBL bl = new BankTransactionBL(); var lstExpenseTran = bl.GetBankAccountTransaction().Where(et => Convert.ToDateTime(Convert.ToDateTime(et.TransactionDate).ToShortDateString()) >= Convert.ToDateTime(dtStartDate.Text) && Convert.ToDateTime(Convert.ToDateTime(et.TransactionDate).ToShortDateString()) <= Convert.ToDateTime(dtEndDate.Text)).ToList(); dgBankTran.DataSource = lstExpenseTran; if (dgBankTran.RowCount > 0) { btnDownload.Visible = true; } //Load BankAccounType ddlBankAccount.Items.Clear(); var bankTypelst = bl.GetBankAccountType(); foreach (var bt in bankTypelst) { ComboboxItem item = new ComboboxItem(); item.Text = bt.BankAccountTypeDescription; item.Value = bt.BankAccountTypeID; ddlBankAccount.Items.Add(item); } }