Esempio n. 1
0
  public Message InsertMessage(Message message) {
    ContentValues values = new ContentValues();
    values.put(DataBaseHelper.message_contentType, message.getContentType());
    values.put(DataBaseHelper.message_status, message.getStatus());
    values.put(DataBaseHelper.message_FK_receiverUserId, message.getFK_receiverUserId());
    values.put(DataBaseHelper.message_Content, message.getContent());
    values.put(DataBaseHelper.message_FK_senderUserId, message.getFK_senderUserId());
    values.put(DataBaseHelper.message_date, message.getDate());
    values.put(DataBaseHelper.message_type, message.getType());
    values.put(DataBaseHelper.message_messageId, message.getMessageId());
    values.put(DataBaseHelper.message_input, message.getInput());

    long insertId = database.insert(DataBaseHelper.TABLE_message, null, values);
    message.setMessageId(insertId);
    return message;
  }
Esempio n. 2
0
  public int InsertMessage(List<Message> messages) {
    ContentValues values = new ContentValues();
    int cnt = 0;
    for (Message message : messages) {

      values.put(DataBaseHelper.message_contentType, message.getContentType());
      values.put(DataBaseHelper.message_status, message.getStatus());
      values.put(DataBaseHelper.message_FK_receiverUserId, message.getFK_receiverUserId());
      values.put(DataBaseHelper.message_Content, message.getContent());
      values.put(DataBaseHelper.message_FK_senderUserId, message.getFK_senderUserId());
      values.put(DataBaseHelper.message_date, message.getDate());
      values.put(DataBaseHelper.message_type, message.getType());
      values.put(DataBaseHelper.message_messageId, message.getMessageId());
      values.put(DataBaseHelper.message_input, message.getInput());

      Long flag = database.insert(DataBaseHelper.TABLE_invoice, null, values);
      values.clear();
      if (flag > 0) cnt++;
    }
    return cnt;
  }