private void SetAccountSource(GLOffsetAccountLineGridClient rec)
        {
            SQLCache cache;

            switch (rec._AccountType)
            {
            case GLJournalAccountType.Finans:
                cache = LedgerCache;
                break;

            case GLJournalAccountType.Debtor:
                cache = DebtorCache;
                break;

            case GLJournalAccountType.Creditor:
                cache = CreditorCache;
                break;

            default: return;
            }
            if (cache != null)
            {
                int ver = cache.version + 10000 * ((int)rec._AccountType + 1);
                if (ver != rec.AccountVersion)
                {
                    rec.AccountVersion = ver;
                    rec.accntSource    = cache.GetNotNullArray;
                    rec.NotifyPropertyChanged("AccountSource");
                }
            }
        }
        private void Account_GotFocus(object sender, RoutedEventArgs e)
        {
            GLOffsetAccountLineGridClient selectedItem = dgGlOffSetAccountTplt.SelectedItem as GLOffsetAccountLineGridClient;

            if (selectedItem != null)
            {
                SetAccountSource(selectedItem);
                if (prevAccount != null)
                {
                    prevAccount.isValidate = false;
                }
                var editor = (CorasauGridLookupEditorClient)sender;
                prevAccount       = editor;
                editor.isValidate = true;
            }
        }
        private void DataControl_CurrentItemChanged(object sender, DevExpress.Xpf.Grid.CurrentItemChangedEventArgs e)
        {
            GLOffsetAccountLineGridClient oldselectedItem = e.OldItem as GLOffsetAccountLineGridClient;

            if (oldselectedItem != null)
            {
                oldselectedItem.PropertyChanged -= GLOffSetAccountTemplateGridClient_PropertyChanged;
            }

            GLOffsetAccountLineGridClient selectedItem = e.NewItem as GLOffsetAccountLineGridClient;

            if (selectedItem != null)
            {
                selectedItem.PropertyChanged += GLOffSetAccountTemplateGridClient_PropertyChanged;
                if (selectedItem.accntSource == null)
                {
                    SetAccountSource(selectedItem);
                }
            }
        }