Beispiel #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            TipoMoneda tipoMoneda = TipoMoneda.getInstance();

            tipoMoneda.Show();
            tipoMoneda.Focus();
        }
        public static TipoMoneda getInstance()
        {
            if (instance == null)
            {
                instance = new TipoMoneda();
            }

            return(instance);
        }
Beispiel #3
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = null;

            if (dgvCurrenciesTypes.SelectedRows.Count == 1)
            {
                row = dgvCurrenciesTypes.SelectedRows[0];
            }
            else if (dgvCurrenciesTypes.SelectedCells.Count == 1)
            {
                int i = dgvCurrenciesTypes.SelectedCells[0].RowIndex;
                row = dgvCurrenciesTypes.Rows[i];
            }
            else
            {
                MessageBox.Show(
                    "Debes seleccionar solo 1 tipo de moneda a modificar",
                    "Información",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information
                    );
            }

            if (row != null)
            {
                int id = Int32.Parse(row.Cells[0].Value.ToString());
                currencies_types currencyType = (from em in entities.currencies_types
                                                 where em.id == id
                                                 select em).First();

                if (currencyType == null)
                {
                    MessageBox.Show(
                        "El Tipo de Moneda seleccionado no existe",
                        "Error",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error
                        );
                    loadCurrenciesTypes("");
                }
                else
                {
                    TipoMoneda tipoMoneda = TipoMoneda.getInstance();
                    tipoMoneda.setCurrencyType(currencyType);
                    tipoMoneda.Show();
                    tipoMoneda.Focus();
                }
            }
        }
 private void TipoMoneda_FormClosed(object sender, FormClosedEventArgs e)
 {
     instance = null;
 }