void frmEntryTransaction_Load(object sender, EventArgs e) { var accountList = AccountsMasterBusinessLogic.GetAll(); cmbAccountName.DataSource = accountList; cmbAccountName.DisplayMember = "AccountName"; cmbAccountName.ValueMember = "AccountId"; if (TransactionId > 0) { var tblTransactionDTO = TransactionBusinessLogic.Get(TransactionId); dpTdate.Text = Convert.ToString(tblTransactionDTO.TDate); cmbAccountName.SelectedValue = tblTransactionDTO.AccountId; if (tblTransactionDTO.TransactionType == 1) { rbrecieved.Checked = true; } else { rbPaid.Checked = true; } txtAmount.Text = Convert.ToString(tblTransactionDTO.Amount); txtChanqueno.Text = tblTransactionDTO.ChequeNo; dpChaqurDate.Text = Convert.ToString(tblTransactionDTO.ChequeDate); txtRecievedby.Text = tblTransactionDTO.Recievedby; txtPaidby.Text = tblTransactionDTO.PaidBy; txtDescription.Text = tblTransactionDTO.Description; } cmbAccountName.Focus(); }
private void BtnSave_Click(object sender, EventArgs e) { if (ValidateData()) { tblAccountsMasterDTO tblaccountmasterdto = new tblAccountsMasterDTO(); if (AccountId > 0) { tblaccountmasterdto.AccountId = AccountId; } tblaccountmasterdto.AccountName = textaccountname.Text; if (rbBank.Checked) { tblaccountmasterdto.AccountType = "2"; } else { tblaccountmasterdto.AccountType = "1"; } tblaccountmasterdto.AccountNo = Convert.ToString(textaccountno.Text); tblaccountmasterdto.Addrees = textaddress.Text; tblaccountmasterdto.PhoneNo = textphoneno.Text; tblaccountmasterdto.OpeningBalance = Convert.ToDouble(textopeningbal.Text); tblaccountmasterdto.OpeningDate = accountdate.Value; tblaccountmasterdto.Description = textdescription.Text; var result = AccountsMasterBusinessLogic.Save(tblaccountmasterdto); if (AccountId > 0) { this.Close(); } cleandata(); } }
private void gridViewAccount_CellContentClick(object sender, DataGridViewCellEventArgs e) { string Action = this.gridViewAccount.Columns[e.ColumnIndex].HeaderText; if (Action == "Edit") { frmEntryAccount frmaccount = new frmEntryAccount(); frmaccount.AccountId = Convert.ToInt32(gridViewAccount.Rows[e.RowIndex].Cells[0].Value); frmaccount.FormClosed += frmaccount_FormClosed; frmaccount.ShowInTaskbar = false; frmaccount.Show(); } if (Action == "Delete") { try { var messageBoxResult = MessageBox.Show("Are you sure want to delete this record?", "Delete", MessageBoxButtons.YesNo); if (messageBoxResult == DialogResult.Yes) { var result = AccountsMasterBusinessLogic.Delete(Convert.ToInt32(gridViewAccount.Rows[e.RowIndex].Cells[0].Value)); MessageBox.Show("Account deleted successfully."); FillGridData(); } } catch (Exception) { MessageBox.Show("Account already used some where else can't deleted successfully."); } } }
/// <summary> /// Fill drop downs /// </summary> /// <param name="tblTransactionDTO"></param> /// <returns></returns> private tblTransactionDTO FillDropDown(tblTransactionDTO tblTransactionDTO) { var accountList = AccountsMasterBusinessLogic.GetAll(); tblTransactionDTO.Accounts = accountList; return(tblTransactionDTO); }
public JsonResult DeleteAccountsMaster(int id) { var result = AccountsMasterBusinessLogic.Delete(id); if (result) { return(Json(new { Success = true, Message = "Delete Successfully." })); } return(Json(new { Success = false, Message = "Error in transaction." })); }
public ActionResult Save(int id) { tblAccountsMasterDTO tblAccountsMasterDTO; if (id == 0) { tblAccountsMasterDTO = new tblAccountsMasterDTO(); } else { tblAccountsMasterDTO = AccountsMasterBusinessLogic.Get(id); } return(View(tblAccountsMasterDTO)); }
private void FillGridData() { var accountlist = AccountsMasterBusinessLogic.GetAll(); foreach (var item in accountlist) { if (item.AccountType == "1") { item.AccountTypeName = "Cash"; } else { item.AccountTypeName = "Bank"; } } gridViewAccount.DataSource = accountlist; }
public ActionResult Save(tblAccountsMasterDTO tblAccountsMasterDTO) { if (ModelState.IsValid) { var resultCheckDuplicateAccount = AccountsMasterBusinessLogic.CheckDuplicateAccount(tblAccountsMasterDTO.AccountName, tblAccountsMasterDTO.AccountId); if (resultCheckDuplicateAccount) { ModelState.AddModelError("AccountName", "Account name already exists."); } else { var result = AccountsMasterBusinessLogic.Save(tblAccountsMasterDTO); if (result > 0) { return(RedirectToAction("Index")); } } } return(View(tblAccountsMasterDTO)); }
private void setflag() { if (AccountId > 0) { var accountdetail = AccountsMasterBusinessLogic.Get(AccountId); textaccountname.Text = accountdetail.AccountName; textaccountno.Text = Convert.ToString(accountdetail.AccountNo); textaddress.Text = accountdetail.Addrees; textopeningbal.Text = Convert.ToString(accountdetail.OpeningBalance); if (accountdetail.AccountType == "1") { rbcash.Checked = true; } else { rbBank.Checked = true; } textphoneno.Text = accountdetail.PhoneNo; accountdate.Text = Convert.ToString(accountdetail.OpeningDate); textdescription.Text = Convert.ToString(accountdetail.Description); } }
public ActionResult _AjaxGetAccountMaster() { var AccountsMasterList = AccountsMasterBusinessLogic.GetAll(); return(View(new GridModel(AccountsMasterList))); }