private void btnDelete_Click(object sender, EventArgs e) { var bankActTranID = Convert.ToInt32(dgBankTran.CurrentRow.Cells["BankAccountTransactionID"].Value.ToString()); if (bankActTranID == 0) { MyMessageBox.ShowBox("Please select a value from the Bank Transaction!!!"); } else { var retStr = MyMessageBoxYesorNo.ShowBox("Are you Sure You want to Delete??"); if (retStr == "1") { BankTransactionBL obj = new BankTransactionBL(); var flag = obj.DeleteBankAccountTransaction(bankActTranID); LoadDefaultValues(); if (flag) { MyMessageBox.ShowBox("Bank Transaction Deleted"); } else { MyMessageBox.ShowBox("Bank Transaction Failed to Delete."); } } } }
private void LoadDefaultValues() { BankTransactionBL bl = new BankTransactionBL(); 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); } }
private void btnSave_Click(object sender, EventArgs e) { if (validate()) { //Populate ExpenseTransactionDTO var bnk = (ComboboxItem)ddlBankAccount.SelectedItem; var Amount = txtAmount.Text; var Comments = txtComments.Text; BankAccountTransactionDTO bDTO = new BankAccountTransactionDTO(); bDTO.BankAccountTypeID = Convert.ToInt32(bnk.Value); bDTO.Description = Comments; bDTO.Amount = Convert.ToInt32(Amount); bDTO.TransactionType = ddlTranType.Text; bDTO.TransactionDate = Convert.ToDateTime(dtTranDate.Text); bDTO.CreatedBy = GlobalSetup.Userid; bDTO.CreatedDate = DateTime.Now; bDTO.ModifiedDate = null; bDTO.ModifiedBy = null; bDTO.Type = ddlType.Text; BankTransactionBL obj = new BankTransactionBL(); bool result = false; if (_mode == "EDIT") { bDTO.BankAccountTransactionID = _bankTransactionID; result = obj.UpdateBankAccountTransaction(bDTO); } else { result = obj.AddBankAccountTransaction(bDTO); } if (result) { MyMessageBox.ShowBox("Bank Account Transaction Saved!!!"); } else { MyMessageBox.ShowBox("Bank Account Failed !!!"); } } else { MyMessageBox.ShowBox("Please enter all mandatory fields!!!"); } this.Clear(); }
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); } }
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; } }