Пример #1
0
        private void LedgersBindingSource_PositionChanged(object sender, EventArgs e)
        {
            LedgerListModel model = GetCurrent();

            //if (model.Balance != null)
            //    balanceBindingSource.DataSource = model.Balance;
            //else
            //    balanceBindingSource.DataSource = typeof(LedgerBalance);
            if (model.IsSystem)
            {
                //grpEdit.Enabled = false;
                DisableEdit(true);
            }
            else
            {
                //grpEdit.Enabled = true;
                DisableEdit(false);
            }
            tssLabel.Text = "Ready";
        }
Пример #2
0
        private void NameText_Validated(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtName.Text))
            {
                itemErrors.SetError(txtName, $"Ledger name is required!");
                return;
            }
            else
            {
                itemErrors.SetError(txtName, null);
            }

            LedgerListModel current = GetCurrent();

            if (_repository.Exists(KeyField.Name, txtName.Text, current.Id, AppConfig.CurrentCompany.Id))
            {
                itemErrors.SetError(txtName, $"Ledger name '{txtName.Text}' already exists!");
            }
            else
            {
                itemErrors.SetError(txtName, null);
            }
        }