private void btnCountablesAccounts_Click(object sender, EventArgs e) { MnjCuentaContable mnjCuentaContable = MnjCuentaContable.getInstance(); mnjCuentaContable.ShowDialog(this); mnjCuentaContable.Focus(); }
public static MnjCuentaContable getInstance() { if (instance == null) { instance = new MnjCuentaContable(); } return(instance); }
private void btnSave_Click(object sender, EventArgs e) { bool saved = false; if (countableAccount == null) { countables_accounts newCountableAccount = new countables_accounts { description = txtDescription.Text, account_type = ((account_types)cbType.SelectedItem).id, allow_transaction = chkbAllowTransactions.Checked, level = (int)cbLevel.SelectedItem, balance = 0, state = rbActive.Checked }; if (newCountableAccount.level != 1) { newCountableAccount.account_major = ((countables_accounts)cbMajorAccount.SelectedItem).id; } saved = MnjCuentaContable.getInstance().saveAccountCountable(newCountableAccount, true); } else { countableAccount.description = txtDescription.Text; countableAccount.account_type = ((account_types)cbType.SelectedItem).id; countableAccount.allow_transaction = chkbAllowTransactions.Checked; countableAccount.level = (int)cbLevel.SelectedItem; countableAccount.state = rbActive.Checked; if (countableAccount.level != 1) { countableAccount.account_major = ((countables_accounts)cbMajorAccount.SelectedItem).id; } saved = MnjCuentaContable.getInstance().saveAccountCountable(countableAccount, false); } if (saved) { this.Close(); } }
private void MnjCuentaContable_FormClosed(object sender, FormClosedEventArgs e) { instance = null; }