void DataControl_CurrentItemChanged(object sender, DevExpress.Xpf.Grid.CurrentItemChangedEventArgs e) { BankImportMapGridClient oldselectedItem = e.OldItem as BankImportMapGridClient; if (oldselectedItem != null) { oldselectedItem.PropertyChanged -= BankImportMapGridClient_PropertyChanged; } BankImportMapGridClient selectedItem = e.NewItem as BankImportMapGridClient; if (selectedItem != null) { selectedItem.PropertyChanged += BankImportMapGridClient_PropertyChanged; if (selectedItem.accntSource == null) { SetAccountSource(selectedItem); } if (selectedItem.offsetAccntSource == null) { SetOffsetAccountSource(selectedItem); } } }
private void OffsetAccount_GotFocus(object sender, RoutedEventArgs e) { BankImportMapGridClient selectedItem = dgBankImportMapping.SelectedItem as BankImportMapGridClient; if (selectedItem != null) { SetOffsetAccountSource(selectedItem); if (prevOffsetAccount != null) { prevOffsetAccount.isValidate = false; } var editor = (CorasauGridLookupEditorClient)sender; prevOffsetAccount = editor; editor.isValidate = true; } }
private void SetOffsetAccountSource(BankImportMapGridClient rec) { SQLCache cache; switch (rec._OffsetAccountType) { case GLJournalAccountType.Finans: cache = LedgerCache; break; case GLJournalAccountType.Debtor: cache = DebtorCache; break; case GLJournalAccountType.Creditor: cache = CreditorCache; break; default: return; } rec.offsetAccntSource = cache; rec.NotifyPropertyChanged("OffsetAccountSource"); }