예제 #1
0
  void acctSelected(ServiceAcctInfo info) {
    Account acct = new Account();
    acct.name = info.desc;
    acct.service = info;

    DialogInterface.OnClickListener emptyClickListener =
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {}
        };

    AcctTables db = new AcctTables(this);
    try {
      db.openWritable();

      try {
        db.pushAccount(acct);
      } catch (SQLiteException e) {
        AlertDialog dlg =
            Utilities.buildAlert(
                this, e, "Unable to add account", "Internal Error", emptyClickListener);
        dlg.show();
        return;
      }
    } finally {
      db.close();
    }

    Intent i = getIntent();
    i.putExtra("acct_id", acct.ID);
    setResult(RESULT_OK, i);
    finish();
  }
예제 #2
0
  public void establishAccount(ServiceAcctInfo acct) {
    String[] args = {Integer.toString(acct.ID)};
    Cursor cur = db.query("acct", AC_COLS, "service_id=?", args, null, null, null);
    try {
      if (cur.moveToNext()) return;
    } finally {
      cur.close();
    }

    Account newAcct = new Account();
    newAcct.serviceId = acct.ID;
    newAcct.name = acct.desc;
    addAccount(newAcct);
  }
예제 #3
0
 public Account getAccountFromCursor(Cursor cur) {
   Account acct = new Account();
   acct.ID = cur.getInt(0);
   acct.serviceId = cur.getInt(1);
   acct.name = cur.getString(2);
   String iAge = cur.getString(3);
   acct.lastUpdate = (iAge != null) ? new Date(Long.parseLong(iAge)) : null;
   acct.curBalAmt = cur.getDouble(4);
   iAge = cur.getString(5);
   acct.curBalDate = (iAge != null) ? new Date(Long.parseLong(iAge)) : null;
   acct.availBalAmt = cur.getDouble(6);
   iAge = cur.getString(7);
   acct.availBalDate = (iAge != null) ? new Date(Long.parseLong(iAge)) : null;
   iAge = cur.getString(8);
   acct.lastTrans = (iAge != null) ? new Date(Long.parseLong(iAge)) : null;
   return acct;
 }