예제 #1
0
 public int Update(Message message) {
   ContentValues values = new ContentValues();
   if (message.getContentType() != -1)
     values.put(DataBaseHelper.message_contentType, message.getContentType());
   if (message.getStatus() != -1) values.put(DataBaseHelper.message_status, message.getStatus());
   if (message.getFK_receiverUserId() != -1)
     values.put(DataBaseHelper.message_FK_receiverUserId, message.getFK_receiverUserId());
   if (message.getContent() != "")
     values.put(DataBaseHelper.message_Content, message.getContent());
   if (message.getFK_senderUserId() != -1)
     values.put(DataBaseHelper.message_FK_senderUserId, message.getFK_senderUserId());
   if (message.getDate() != "") values.put(DataBaseHelper.message_date, message.getDate());
   if (message.getType() != -1) values.put(DataBaseHelper.message_type, message.getType());
   if (message.getMessageId() != -1)
     values.put(DataBaseHelper.message_messageId, message.getMessageId());
   int numRowEffected =
       database.update(
           DataBaseHelper.TABLE_message,
           values,
           DataBaseHelper.message_messageId + "=?",
           new String[] {String.valueOf(message.getMessageId())});
   return numRowEffected;
 }
예제 #2
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;
  }
예제 #3
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;
  }