private void btnCurrenciesTypes_Click(object sender, EventArgs e) { MnjTipoMoneda mnjTipoMoneda = MnjTipoMoneda.getInstance(); mnjTipoMoneda.ShowDialog(this); mnjTipoMoneda.Focus(); }
public static MnjTipoMoneda getInstance() { if (instance == null) { instance = new MnjTipoMoneda(); } return(instance); }
private void btnSave_Click(object sender, EventArgs e) { bool saved = false; if (currencyType == null) { Decimal exchangeRate = 0; Decimal.TryParse(txtExchangeRate.Text, out exchangeRate); currencies_types newCurrencyType = new currencies_types { description = txtDescription.Text, exchange_rate = exchangeRate, state = rbActive.Checked }; saved = MnjTipoMoneda.getInstance().saveCurrencyType(newCurrencyType, true); } else { Decimal exchangeRate = 0; Decimal.TryParse(txtExchangeRate.Text, out exchangeRate); currencyType.description = txtDescription.Text; currencyType.exchange_rate = exchangeRate; currencyType.state = rbActive.Checked; saved = MnjTipoMoneda.getInstance().saveCurrencyType(currencyType, false); } if (saved) { MessageBox.Show( "Datos almacenados con éxito", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information ); this.Close(); } }
private void MnjTipoMoneda_FormClosed(object sender, FormClosedEventArgs e) { instance = null; }