private void btnSearch_Click(object sender, EventArgs e) { CashTransactionBL bl = new CashTransactionBL(); string searchText = ddlTranType.Text; var lstCashTran = new List <CashTransactionDTO>(); if (ddlTranType.Text == "BOTH") { lstCashTran = bl.GetCashTransaction().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(); dgCashTran.DataSource = lstCashTran; } else { lstCashTran = bl.GetCashTransaction().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(); dgCashTran.DataSource = lstCashTran; } if (ddlType.Text != "" && ddlType.Text != "BOTH") { lstCashTran = lstCashTran.Where(efu => efu.Type.ToUpper().Contains(ddlType.Text.ToUpper())).ToList(); dgCashTran.DataSource = lstCashTran; } if (ddlStatus.Text != "") { lstCashTran = lstCashTran.Where(efu => efu.Status.ToUpper().Contains(ddlStatus.Text.ToUpper())).ToList(); dgCashTran.DataSource = lstCashTran; } }
private void btnDelete_Click(object sender, EventArgs e) { var cashTranID = Convert.ToInt32(dgCashTran.CurrentRow.Cells["CashTransactionID"].Value.ToString()); if (cashTranID == 0) { MyMessageBox.ShowBox("Please select a value from the Cash Transaction!!!"); } else { var retStr = MyMessageBoxYesorNo.ShowBox("Are you Sure You want to Delete??"); if (retStr == "1") { CashTransactionBL obj = new CashTransactionBL(); var flag = obj.DeleteCashAccountTransaction(cashTranID); LoadDefaultValues(); if (flag) { MyMessageBox.ShowBox("Cash Transaction Deleted"); } else { MyMessageBox.ShowBox("Cash Transaction Failed to Delete."); } } } }
private void LoadDefaultValues() { CashTransactionBL bl = new CashTransactionBL(); var lstCashTran = bl.GetCashTransaction().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(); dgCashTran.DataSource = lstCashTran; }
private void PopulateValues() { CashTransactionBL bl = new CashTransactionBL(); var etr = bl.GetCashTransaction().FirstOrDefault(et => et.CashTransactionID == _CashTransactionID); 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; ddlStatus.SelectedText = etr.Status; }
private void btnSave_Click(object sender, EventArgs e) { if (validate()) { var Amount = txtAmount.Text; var Comments = txtComments.Text; CashTransactionDTO bDTO = new CashTransactionDTO(); 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; bDTO.Status = ddlStatus.Text; CashTransactionBL obj = new CashTransactionBL(); bool result = false; if (_mode == "EDIT") { bDTO.CashTransactionID = _CashTransactionID; result = obj.UpdateCashTransaction(bDTO); } else { result = obj.AddCashTransaction(bDTO); } if (result) { MyMessageBox.ShowBox("Cash Account Transaction Saved!!!"); } else { MyMessageBox.ShowBox("Cash Account Failed !!!"); } } else { MyMessageBox.ShowBox("Please enter all mandatory fields!!!"); } this.Clear(); }