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

            return(instance);
        }
示例#2
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (entities.account_types.Count(em => em.state == true) > 0)
     {
         CuentaContable cuentaContable = CuentaContable.getInstance();
         cuentaContable.ShowDialog(this);
         cuentaContable.Focus();
     }
     else
     {
         MessageBox.Show(
             "No se puede agregar cuentas. \nNo hay tipos de cuentas disponibles",
             "Error",
             MessageBoxButtons.OK,
             MessageBoxIcon.Error
             );
     }
 }
示例#3
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = null;

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

            if (row != null)
            {
                int                 id               = Int32.Parse(row.Cells[0].Value.ToString());
                CuentaContable      cuentaContable   = CuentaContable.getInstance();
                countables_accounts countableAccount =
                    (from em in entities.countables_accounts
                     where em.id == id
                     select em).First();

                cuentaContable.setCuentaContable(countableAccount);
                cuentaContable.ShowDialog(this);
                cuentaContable.Focus();
            }
        }
 private void CuentaContable_FormClosed(object sender, FormClosedEventArgs e)
 {
     instance = null;
 }