Ejemplo n.º 1
0
 public HashMap<String, String> getAllTermsForCompanyID(String companyCode) {
   System.out.println("TErmes : " + companyCode);
   HashMap<String, String> allTerms = new HashMap<String, String>();
   SQLiteDatabase db = this.getWritableDatabase();
   String id = ApplicationUser.getSharedInstance().getCompanyId();
   System.out.println("TErmes ID : " + companyCode);
   Cursor termCursor =
       db.query(
           TABLE, null, COMPANY_CODE + "=? ", new String[] {companyCode}, null, null, null, null);
   /*String searchSql = "SELECT * FROM "+FRSTermsDB.TABLE+" WHERE "+FRSTermsDB.COMPANY_CODE+"= '"+ApplicationUser.getSharedInstance().getCompanyId()+"'";
   Cursor termCursor = db.rawQuery(searchSql, null);*/
   if (termCursor != null) {
     if (termCursor.moveToNext()) {
       do {
         String desc = termCursor.getString(termCursor.getColumnIndex(DESCRIPTION));
         String term = termCursor.getString(termCursor.getColumnIndex(TERM));
         allTerms.put(desc, term);
       } while (termCursor.moveToNext());
     }
   }
   db.close();
   termCursor.close();
   System.out.println("TErmes End : " + System.currentTimeMillis());
   return allTerms;
 }
Ejemplo n.º 2
0
  public boolean isTermsAvailableForCompany(String compID) {
    String cmp = (compID == null) ? ApplicationUser.getSharedInstance().getCompanyId() : compID;
    SQLiteDatabase db = this.getWritableDatabase();
    /*String searchSql = "SELECT * FROM "+FRSTermsDB.TABLE+" WHERE "+FRSTermsDB.COMPANY_CODE+"= '"+cmp+"'";
    SharedMethods.logError("SQL : "+searchSql);
    Cursor termCursor = db.rawQuery(searchSql, null);
    if(termCursor != null){
    	if(termCursor.moveToNext()){
    		db.close();
    		termCursor.close();
    		return true;
    	}
    }
    db.close();
    termCursor.close();*/

    Cursor usrCursor =
        db.query(TABLE, null, COMPANY_CODE + "=?", new String[] {cmp}, null, null, null);
    if (usrCursor != null) {
      if (usrCursor.moveToNext()) {
        db.close();
        usrCursor.close();
        return true;
      }
    }
    db.close();
    usrCursor.close();
    return false;
  }
 public void searchClientDetails(String searchTerm) {
   SearchRequest searchRequest = new SearchRequest();
   ApplicationUser usr = ApplicationUser.getSharedInstance();
   searchRequest.setUserName(usr.getUserName());
   searchRequest.setCompanyId(usr.getCompanyId());
   searchRequest.setToken(usr.getToken());
   searchRequest.setMobileNumber(usr.getMobileNnumber());
   SharedMethods.logError("Search term 2:" + searchTerm);
   searchRequest.setSearchTerm(searchTerm);
   sendDataRequest(searchRequest);
 }