コード例 #1
0
  /** insert new personal data */
  public long createPersonalData(
      com.example.pascal.salaryapplication.db.object.PersonalData personalData) {
    long id;
    ContentValues values = new ContentValues();
    values.put(SalaryContract.PersonalData.KEY_NAME, personalData.getName());
    values.put(SalaryContract.PersonalData.KEY_LASTNAME, personalData.getLastname());
    values.put(SalaryContract.PersonalData.KEY_ADDRESS, personalData.getAddress());
    values.put(SalaryContract.PersonalData.KEY_BIRTHDATE, personalData.getBirthdate());
    values.put(SalaryContract.PersonalData.KEY_CIVILSTATUS, personalData.getCivilStatus());
    values.put(SalaryContract.PersonalData.KEY_NBCHILDREN, personalData.getNbChildren());
    values.put(SalaryContract.PersonalData.KEY_NATIONALITY, personalData.getNationality());
    values.put(SalaryContract.PersonalData.KEY_PERMIT, personalData.getPermit());
    values.put(SalaryContract.PersonalData.KEY_BANK, personalData.getBank());
    values.put(SalaryContract.PersonalData.KEY_PASSWORD, personalData.getPassword());
    values.put(SalaryContract.PersonalData.KEY_POSTID, personalData.getPostId());
    values.put(SalaryContract.PersonalData.KEY_CONTRACT_BEGIN, personalData.getContractBegin());
    values.put(SalaryContract.PersonalData.KEY_PERCENTAGE, personalData.getPercentage());
    values.put(SalaryContract.PersonalData.KEY_HOLLIDAY_LEFT, personalData.getHollidayLeft());
    id = this.db.insert(SalaryContract.PersonalData.TABLE_PERSONALDATA, null, values);

    return id;
  }
コード例 #2
0
  /** update personal data */
  public int updatePersonalData(PersonalData personalData) {
    ContentValues values = new ContentValues();
    values.put(SalaryContract.PersonalData.KEY_NAME, personalData.getName());
    values.put(SalaryContract.PersonalData.KEY_LASTNAME, personalData.getLastname());
    values.put(SalaryContract.PersonalData.KEY_ADDRESS, personalData.getAddress());
    values.put(SalaryContract.PersonalData.KEY_BIRTHDATE, personalData.getBirthdate());
    values.put(SalaryContract.PersonalData.KEY_CIVILSTATUS, personalData.getCivilStatus());
    values.put(SalaryContract.PersonalData.KEY_NBCHILDREN, personalData.getNbChildren());
    values.put(SalaryContract.PersonalData.KEY_NATIONALITY, personalData.getNationality());
    values.put(SalaryContract.PersonalData.KEY_PERMIT, personalData.getPermit());
    values.put(SalaryContract.PersonalData.KEY_BANK, personalData.getBank());
    values.put(SalaryContract.PersonalData.KEY_PASSWORD, personalData.getPassword());
    values.put(SalaryContract.PersonalData.KEY_POSTID, personalData.getPostId());
    values.put(SalaryContract.PersonalData.KEY_CONTRACT_BEGIN, personalData.getContractBegin());
    values.put(SalaryContract.PersonalData.KEY_PERCENTAGE, personalData.getPercentage());
    values.put(SalaryContract.PersonalData.KEY_HOLLIDAY_LEFT, personalData.getHollidayLeft());

    return this.db.update(
        SalaryContract.PersonalData.TABLE_PERSONALDATA,
        values,
        SalaryContract.PersonalData.KEY_ID + " = ?",
        new String[] {String.valueOf(personalData.getId())});
  }