private void btnBank_Click(object sender, RoutedEventArgs e) { frmBankSetup frm = new frmBankSetup("HOME"); userPrevilage = new UserPrevilage(this.btnBank.Tag.ToString()); if (userPrevilage.Show == true) { frm.btnSave.IsEnabled = Convert.ToBoolean(userPrevilage.AddNew); frm.btnDelete.IsEnabled = Convert.ToBoolean(userPrevilage.Remove); frm.bIsEdit = Convert.ToBoolean(userPrevilage.Edit); this.Close(); frm.ShowDialog(); } }
private void btnSetBank_Click(object sender, RoutedEventArgs e) { try { frmBankSetup frm = new frmBankSetup(); frm.ShowDialog(); cmbBankCode.ItemsSource = db.MASTERBANKs.ToList(); cmbBankCode.SelectedValuePath = "BANK_CODE"; cmbBankCode.DisplayMemberPath = "BANK_USERCODE"; cmbBankName.ItemsSource = db.MASTERBANKs.ToList(); cmbBankName.SelectedValuePath = "BANK_CODE"; cmbBankName.DisplayMemberPath = "BANK_NAME"; decimal dBankCode = Convert.ToDecimal(cmbBankCode.SelectedValue); if (dBankCode != 0) { var mBnk = db.MASTERBANKs.Where(x => x.BANK_CODE == dBankCode).FirstOrDefault(); cmbBankName.SelectedValue = mBnk.BANK_CODE; var mbr = db.MASTERBANKBRANCHes.Where(x => x.BANK_CODE == dBankCode).ToList(); cmbBranchCode.ItemsSource = mbr; cmbBranchCode.SelectedValuePath = "BANKBRANCH_CODE"; cmbBranchCode.DisplayMemberPath = "BANKBRANCH_USERCODE"; cmbBranchName.ItemsSource = mbr; cmbBranchName.SelectedValuePath = "BANKBRANCH_CODE"; cmbBranchName.DisplayMemberPath = "BANKBRANCH_NAME"; } } catch (Exception ex) { ExceptionLogging.SendErrorToText(ex); } }