private void btnBranch_Click(object sender, RoutedEventArgs e) { frmBranchSetup frm = new frmBranchSetup("HOME"); userPrevilage = new UserPrevilage(this.btnBranch.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 btnSetBranch_Click(object sender, RoutedEventArgs e) { try { frmBranchSetup frm = new frmBranchSetup(""); 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); } }