Exemple #1
0
 public static void Delete_Event_MySQL(String Event_ID) {
   // Delete event.
   sqlHelper.delete(
       Table_Events.Table_Name,
       new String[] {Table_Events.Event_ID},
       new String[] {Event_ID},
       new int[] {1});
   // Delete event_user.
   sqlHelper.delete(
       Table_Events_Users.Table_Name,
       new String[] {Table_Events_Users.Event_ID},
       new String[] {Event_ID},
       null);
   // Delete tasks.
   sqlHelper.delete(
       Table_Tasks.Table_Name, new String[] {Table_Tasks.Event_ID}, new String[] {Event_ID}, null);
   // Delete chat.
   sqlHelper.Delete_Table(Table_Chat.Table_Name + Helper.Clean_Event_ID(Event_ID));
   // Delete vote_date.
   sqlHelper.delete(
       Table_Vote_Date.Table_Name,
       new String[] {Table_Vote_Date.Event_ID},
       new String[] {Event_ID},
       null);
   // Delete vote_location.
   sqlHelper.delete(
       Table_Vote_Location.Table_Name,
       new String[] {Table_Vote_Location.Event_ID},
       new String[] {Event_ID},
       null);
 }
Exemple #2
0
 public static void Delete_Event_ServerSQL(Context context, String Event_ID) {
   // Delete event.
   new Event_AsyncTask_delete(context).execute(Event_ID);
   // Delete event_user.
   new EventUser_AsyncTask_delete_by_event(context).execute(Event_ID);
   // Delete tasks.
   new Task_AsyncTask_deleteByEvent(context).execute(Event_ID);
   // Delete chat.
   String Chat_ID = Table_Chat.Table_Name + Helper.Clean_Event_ID(Event_ID);
   new Chat_AsyncTask_deleteByEvent(context).execute(Chat_ID);
   // Delete vote_date.
   new Vote_Date_AsyncTask_deleteByEvent(context).execute(Event_ID);
   // Delete vote_location.
   new Vote_Location_AsyncTask_deleteByEvent(context).execute(Event_ID);
 }
Exemple #3
0
 // ----------------------------------------------My SQL
 // Functions------------------------------------------------
 private static void Create_Event_MySQL() {
   // create event.
   sqlHelper.insert(Table_Events.Table_Name, Event_Helper.details);
   // Add My user.
   sqlHelper.insert(
       Table_Events_Users.Table_Name,
       new String[] {
         Event_Helper.details[Table_Events.Event_ID_num],
         Constants.MY_User_ID,
         Constants.Yes,
         Constants.Owner
       });
   // Add all friends.
   for (String User_ID : Event_Helper.friends.keySet()) {
     Friend_Helper friend_helper = Event_Helper.friends.get(User_ID);
     add_newFriend_MySQL(friend_helper, User_ID);
   }
   // Add tasks.
   for (int task_id : Event_Helper.task.keySet()) {
     Task_Helper task_helper = Event_Helper.task.get(task_id);
     add_newTask_MySQL(task_helper, task_id, 0);
     // Add all subTasks.
     for (int subTask_id : task_helper.getSubTasks().keySet()) {
       add_newTask_MySQL(task_helper, task_id, subTask_id);
     }
   }
   // Create Chat table.
   String Chat_ID =
       Table_Chat.Table_Name
           + Helper.Clean_Event_ID(Event_Helper.details[Table_Events.Event_ID_num]);
   sqlHelper.Create_Table(Chat_ID, Table_Chat.getAllFields(), Table_Chat.getAllSqlParams());
   // Add vote_date.
   for (int vote_id : Event_Helper.vote_date.keySet()) {
     Vote_Date_Helper vote_date_helper = Event_Helper.vote_date.get(vote_id);
     add_newVote_Date_Option_MySQL(vote_date_helper, vote_id);
   }
   // Add vote_location.
   for (int vote_id : Event_Helper.vote_location.keySet()) {
     Vote_Location_Helper vote_location_helper = Event_Helper.vote_location.get(vote_id);
     add_newVote_Location_Option_MySQL(vote_location_helper, vote_id);
   }
 }
Exemple #4
0
  // ----------------------------------------------Server SQL
  // Functions----------------------------------------------
  public static void Create_Event_ServerSQL(Context context) {
    // new Event_AsyncTask_insert(context).execute(Event_ID, Name, Location, Start_Date, Start_Time,
    // End_Date, End_Time, Description, ImagePath, Update_Time);

    // create event.
    new Event_AsyncTask_insert(context).execute(Event_Helper.details);
    // Add My user.
    new EventUser_AsyncTask_insert(context)
        .execute(
            Event_Helper.details[Table_Events.Event_ID_num],
            Constants.MY_User_ID,
            Constants.Yes,
            Constants.Owner);
    // Add all friends.
    for (String User_ID : Event_Helper.friends.keySet()) {
      Friend_Helper friend_helper = Event_Helper.friends.get(User_ID);
      new EventUser_AsyncTask_insert(context)
          .execute(
              Event_Helper.details[Table_Events.Event_ID_num],
              User_ID,
              friend_helper.getAttending(),
              friend_helper.getPermission());
    }
    // Add tasks
    for (int task_id : Event_Helper.task.keySet()) {
      Task_Helper task_helper = Event_Helper.task.get(task_id);
      new Task_AsyncTask_insert(context)
          .execute(
              Event_Helper.details[Table_Events.Event_ID_num],
              task_id + "",
              0 + "",
              task_helper.getType(),
              task_helper.getDescription(),
              task_helper.getUser_ID());
      // Add all subTasks.
      for (int subTask_id : task_helper.getSubTasks().keySet()) {
        new Task_AsyncTask_insert(context)
            .execute(
                Event_Helper.details[Table_Events.Event_ID_num],
                task_id + "",
                subTask_id + "",
                task_helper.getType(),
                task_helper.getSubTasks().get(subTask_id)[0],
                task_helper.getUser_ID());
      }
    }
    // Create Chat table.
    String Chat_ID =
        Table_Chat.Table_Name
            + Helper.Clean_Event_ID(Event_Helper.details[Table_Events.Event_ID_num]);
    new Chat_AsyncTask_CreateByEvent(context).execute(Chat_ID);
    // Add vote_dates.
    for (int vote_id : Event_Helper.vote_date.keySet()) {
      Vote_Date_Helper vote_date_helper = Event_Helper.vote_date.get(vote_id);
      new Vote_Date_AsyncTask_insert(context)
          .execute(
              Event_Helper.details[Table_Events.Event_ID_num],
              vote_id + "",
              vote_date_helper.getStart_Date(),
              vote_date_helper.getEnd_Date(),
              vote_date_helper.getAll_Day(),
              vote_date_helper.getStart_Time(),
              vote_date_helper.getEnd_Time(),
              Constants.UnCheck);
    }
    // Add vote_dates.
    for (int vote_id : Event_Helper.vote_location.keySet()) {
      Vote_Location_Helper vote_location_helper = Event_Helper.vote_location.get(vote_id);
      new Vote_Location_AsyncTask_insert(context)
          .execute(
              Event_Helper.details[Table_Events.Event_ID_num],
              vote_id + "",
              vote_location_helper.getDescription(),
              Constants.UnCheck);
    }
  }