public static TipoCuenta getInstance()
        {
            if (instance == null)
            {
                instance = new TipoCuenta();
            }

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

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

            if (row != null)
            {
                TipoCuenta tipoCuenta = TipoCuenta.getInstance();
                int        id         = Int32.Parse(row.Cells[0].Value.ToString());
                tipoCuenta.setTipoCuenta(
                    (
                        from em in entities.account_types
                        where em.id == id
                        select em
                    ).First()
                    );
                tipoCuenta.Show();
                tipoCuenta.Focus();
            }
        }
示例#3
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     TipoCuenta.getInstance().Show();
 }
 private void TipoCuenta_FormClosed(object sender, FormClosedEventArgs e)
 {
     instance = null;
 }