{"action":"created","comment":{"url":"https://api.github.com/repos/at-android/2016-k2-training/pulls/comments/91471780","pull_request_review_id":11973636,"id":91471780,"diff_hunk":"@@ -0,0 +1,121 @@\n+package vn.asiantech.training.databases;\n+\n+import android.content.Context;\n+import android.database.Cursor;\n+import android.database.SQLException;\n+import android.database.sqlite.SQLiteDatabase;\n+import android.database.sqlite.SQLiteOpenHelper;\n+import android.util.Log;\n+\n+\n+import java.util.ArrayList;\n+\n+import vn.asiantech.training.models.Alarm;\n+\n+/**\n+ * Created by phuong on 07/12/2016.\n+ */\n+\n+public class DatabaseAlarm {\n+    public static final String COLUMN_ID = \"_id\";\n+    public static final String COLUMN_HOUR = \"hour\";\n+    public static final String COLUMN_MIN = \"mins\";\n+    public static final String COLUMN_DAYS = \"days\";\n+    public static final String COLUMN_DAYS_CHAR = \"daysChar\";\n+    public static final String COLUMN_STATUS = \"status\";\n+    private static final String DATABASE_NAME = \"DB_ALARM\";\n+    private static final int DATABASE_VERSION = 1;\n+    private static final String TABLE_NAME = \"ALARM\";\n+    private static Context context;\n+    ArrayList<Alarm> arrInfo = null;\n+    Alarm alarm = null;\n+    private SQLiteDatabase db;\n+    private OpenHelper openHelper;\n+\n+    public DatabaseAlarm(Context c) {\n+        context = c;\n+    }\n+\n+    public DatabaseAlarm open() throws SQLException {\n+        openHelper = new OpenHelper(context);\n+        db = openHelper.getWritableDatabase();\n+        return this;\n+    }\n+\n+    public void close() {\n+        openHelper.close();\n+    }\n+\n+    public void createData(String hour, String min, String days, String daysChar, String status) {\n+        String query = \"Insert into \" + TABLE_NAME + \" (\" + COLUMN_HOUR + \", \" + COLUMN_MIN + \", \" + COLUMN_DAYS + \", \" + COLUMN_DAYS_CHAR + \" , \" + COLUMN_STATUS + \") values('\" + hour + \"','\" + min + \"',' \" + days + \"','\" + daysChar + \"','\" + status + \"')\";\n+        db.execSQL(query);\n+    }\n+\n+    public void editData(int id, String hour, String min, String days, String daysChar, String status) {\n+        String query = \"Update \" + TABLE_NAME + \" SET \" + COLUMN_HOUR + \" = '\" + hour + \"' , \" + COLUMN_MIN + \" = '\" + min + \"',\" + COLUMN_DAYS + \"= '\" + days + \"',\" + COLUMN_DAYS_CHAR + \"='\" + daysChar + \"',\" + COLUMN_STATUS + \" = '\" + status + \"' where \" + COLUMN_ID + \"=\" + id;\n+        Log.d(\"queryEdit\", query);\n+        db.execSQL(query);\n+    }\n+\n+    public void deleteData(int id) {\n+        String query = \"DELETE FROM \" + TABLE_NAME + \" WHERE \" + COLUMN_ID + \" = \" + id;\n+        Log.d(\"queryDelete\", query);\n+        db.execSQL(query);\n+    }\n+\n+    public ArrayList<Alarm> getData() {\n+        String[] columns = new String[]{COLUMN_ID, COLUMN_HOUR, COLUMN_MIN, COLUMN_DAYS, COLUMN_STATUS};\n+        Cursor c = db.query(TABLE_NAME, null, null, null, null, null, null);\n+        int iRow = c.getColumnIndex(COLUMN_ID);\n+        int iHour = c.getColumnIndex(COLUMN_HOUR);\n+        int iMin = c.getColumnIndex(COLUMN_MIN);\n+        int iDays = c.getColumnIndex(COLUMN_DAYS);\n+        int iDayChar = c.getColumnIndex(COLUMN_DAYS_CHAR);\n+        int iStatus = c.getColumnIndex(COLUMN_STATUS);\n+\n+        arrInfo = new ArrayList<Alarm>();","path":"app/src/main/java/vn/asiantech/training/databases/DatabaseAlarm.java","position":76,"original_position":76,"commit_id":"86db3f585850a4631c9a1006e6dec419a31a5dc3","original_commit_id":"86db3f585850a4631c9a1006e6dec419a31a5dc3","user":{"login":"at-binc","id":16132112,"avatar_url":"https://avatars.githubusercontent.com/u/16132112?v=3","gravatar_id":"","url":"https://api.github.com/users/at-binc","html_url":"https://github.com/at-binc","followers_url":"https://api.github.com/users/at-binc/followers","following_url":"https://api.github.com/users/at-binc/following{/other_user}","gists_url":"https://api.github.com/users/at-binc/gists{/gist_id}","starred_url":"https://api.github.com/users/at-binc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-binc/subscriptions","organizations_url":"https://api.github.com/users/at-binc/orgs","repos_url":"https://api.github.com/users/at-binc/repos","events_url":"https://api.github.com/users/at-binc/events{/privacy}","received_events_url":"https://api.github.com/users/at-binc/received_events","type":"User","site_admin":false},"body":"thieu s","created_at":"2016-12-08T09:05:21Z","updated_at":"2016-12-08T09:08:26Z","html_url":"https://github.com/at-android/2016-k2-training/pull/43#discussion_r91471780","pull_request_url":"https://api.github.com/repos/at-android/2016-k2-training/pulls/43","_links":{"self":{"href":"https://api.github.com/repos/at-android/2016-k2-training/pulls/comments/91471780"},"html":{"href":"https://github.com/at-android/2016-k2-training/pull/43#discussion_r91471780"},"pull_request":{"href":"https://api.github.com/repos/at-android/2016-k2-training/pulls/43"}}},"pull_request":{"url":"https://api.github.com/repos/at-android/2016-k2-training/pulls/43","id":97078377,"html_url":"https://github.com/at-android/2016-k2-training/pull/43","diff_url":"https://github.com/at-android/2016-k2-training/pull/43.diff","patch_url":"https://github.com/at-android/2016-k2-training/pull/43.patch","issue_url":"https://api.github.com/repos/at-android/2016-k2-training/issues/43","number":43,"state":"open","locked":false,"title":"make alarm using alarm manager","user":{"login":"phuongpham149","id":17922634,"avatar_url":"https://avatars.githubusercontent.com/u/17922634?v=3","gravatar_id":"","url":"https://api.github.com/users/phuongpham149","html_url":"https://github.com/phuongpham149","followers_url":"https://api.github.com/users/phuongpham149/followers","following_url":"https://api.github.com/users/phuongpham149/following{/other_user}","gists_url":"https://api.github.com/users/phuongpham149/gists{/gist_id}","starred_url":"https://api.github.com/users/phuongpham149/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phuongpham149/subscriptions","organizations_url":"https://api.github.com/users/phuongpham149/orgs","repos_url":"https://api.github.com/users/phuongpham149/repos","events_url":"https://api.github.com/users/phuongpham149/events{/privacy}","received_events_url":"https://api.github.com/users/phuongpham149/received_events","type":"User","site_admin":false},"body":"using alarm manager to make alarm app","created_at":"2016-12-08T08:30:50Z","updated_at":"2016-12-08T09:08:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1273bc05d046a219da20503dddde816c0c1183c3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/at-android/2016-k2-training/pulls/43/commits","review_comments_url":"https://api.github.com/repos/at-android/2016-k2-training/pulls/43/comments","review_comment_url":"https://api.github.com/repos/at-android/2016-k2-training/pulls/comments{/number}","comments_url":"https://api.github.com/repos/at-android/2016-k2-training/issues/43/comments","statuses_url":"https://api.github.com/repos/at-android/2016-k2-training/statuses/86db3f585850a4631c9a1006e6dec419a31a5dc3","head":{"label":"at-android:new-PhuongPT-2016/12/7-AlarmManagerPractise","ref":"new-PhuongPT-2016/12/7-AlarmManagerPractise","sha":"86db3f585850a4631c9a1006e6dec419a31a5dc3","user":{"login":"at-android","id":23370381,"avatar_url":"https://avatars.githubusercontent.com/u/23370381?v=3","gravatar_id":"","url":"https://api.github.com/users/at-android","html_url":"https://github.com/at-android","followers_url":"https://api.github.com/users/at-android/followers","following_url":"https://api.github.com/users/at-android/following{/other_user}","gists_url":"https://api.github.com/users/at-android/gists{/gist_id}","starred_url":"https://api.github.com/users/at-android/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-android/subscriptions","organizations_url":"https://api.github.com/users/at-android/orgs","repos_url":"https://api.github.com/users/at-android/repos","events_url":"https://api.github.com/users/at-android/events{/privacy}","received_events_url":"https://api.github.com/users/at-android/received_events","type":"User","site_admin":false},"repo":{"id":73338924,"name":"2016-k2-training","full_name":"at-android/2016-k2-training","owner":{"login":"at-android","id":23370381,"avatar_url":"https://avatars.githubusercontent.com/u/23370381?v=3","gravatar_id":"","url":"https://api.github.com/users/at-android","html_url":"https://github.com/at-android","followers_url":"https://api.github.com/users/at-android/followers","following_url":"https://api.github.com/users/at-android/following{/other_user}","gists_url":"https://api.github.com/users/at-android/gists{/gist_id}","starred_url":"https://api.github.com/users/at-android/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-android/subscriptions","organizations_url":"https://api.github.com/users/at-android/orgs","repos_url":"https://api.github.com/users/at-android/repos","events_url":"https://api.github.com/users/at-android/events{/privacy}","received_events_url":"https://api.github.com/users/at-android/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/at-android/2016-k2-training","description":null,"fork":false,"url":"https://api.github.com/repos/at-android/2016-k2-training","forks_url":"https://api.github.com/repos/at-android/2016-k2-training/forks","keys_url":"https://api.github.com/repos/at-android/2016-k2-training/keys{/key_id}","collaborators_url":"https://api.github.com/repos/at-android/2016-k2-training/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/at-android/2016-k2-training/teams","hooks_url":"https://api.github.com/repos/at-android/2016-k2-training/hooks","issue_events_url":"https://api.github.com/repos/at-android/2016-k2-training/issues/events{/number}","events_url":"https://api.github.com/repos/at-android/2016-k2-training/events","assignees_url":"https://api.github.com/repos/at-android/2016-k2-training/assignees{/user}","branches_url":"https://api.github.com/repos/at-android/2016-k2-training/branches{/branch}","tags_url":"https://api.github.com/repos/at-android/2016-k2-training/tags","blobs_url":"https://api.github.com/repos/at-android/2016-k2-training/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/at-android/2016-k2-training/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/at-android/2016-k2-training/git/refs{/sha}","trees_url":"https://api.github.com/repos/at-android/2016-k2-training/git/trees{/sha}","statuses_url":"https://api.github.com/repos/at-android/2016-k2-training/statuses/{sha}","languages_url":"https://api.github.com/repos/at-android/2016-k2-training/languages","stargazers_url":"https://api.github.com/repos/at-android/2016-k2-training/stargazers","contributors_url":"https://api.github.com/repos/at-android/2016-k2-training/contributors","subscribers_url":"https://api.github.com/repos/at-android/2016-k2-training/subscribers","subscription_url":"https://api.github.com/repos/at-android/2016-k2-training/subscription","commits_url":"https://api.github.com/repos/at-android/2016-k2-training/commits{/sha}","git_commits_url":"https://api.github.com/repos/at-android/2016-k2-training/git/commits{/sha}","comments_url":"https://api.github.com/repos/at-android/2016-k2-training/comments{/number}","issue_comment_url":"https://api.github.com/repos/at-android/2016-k2-training/issues/comments{/number}","contents_url":"https://api.github.com/repos/at-android/2016-k2-training/contents/{+path}","compare_url":"https://api.github.com/repos/at-android/2016-k2-training/compare/{base}...{head}","merges_url":"https://api.github.com/repos/at-android/2016-k2-training/merges","archive_url":"https://api.github.com/repos/at-android/2016-k2-training/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/at-android/2016-k2-training/downloads","issues_url":"https://api.github.com/repos/at-android/2016-k2-training/issues{/number}","pulls_url":"https://api.github.com/repos/at-android/2016-k2-training/pulls{/number}","milestones_url":"https://api.github.com/repos/at-android/2016-k2-training/milestones{/number}","notifications_url":"https://api.github.com/repos/at-android/2016-k2-training/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/at-android/2016-k2-training/labels{/name}","releases_url":"https://api.github.com/repos/at-android/2016-k2-training/releases{/id}","deployments_url":"https://api.github.com/repos/at-android/2016-k2-training/deployments","created_at":"2016-11-10T02:12:11Z","updated_at":"2016-11-10T03:43:58Z","pushed_at":"2016-12-08T08:30:50Z","git_url":"git://github.com/at-android/2016-k2-training.git","ssh_url":"git@github.com:at-android/2016-k2-training.git","clone_url":"https://github.com/at-android/2016-k2-training.git","svn_url":"https://github.com/at-android/2016-k2-training","homepage":null,"size":5631,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":0,"default_branch":"master"}},"base":{"label":"at-android:master","ref":"master","sha":"1403801b38a558fb0542d059145022ebee87d4e6","user":{"login":"at-android","id":23370381,"avatar_url":"https://avatars.githubusercontent.com/u/23370381?v=3","gravatar_id":"","url":"https://api.github.com/users/at-android","html_url":"https://github.com/at-android","followers_url":"https://api.github.com/users/at-android/followers","following_url":"https://api.github.com/users/at-android/following{/other_user}","gists_url":"https://api.github.com/users/at-android/gists{/gist_id}","starred_url":"https://api.github.com/users/at-android/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-android/subscriptions","organizations_url":"https://api.github.com/users/at-android/orgs","repos_url":"https://api.github.com/users/at-android/repos","events_url":"https://api.github.com/users/at-android/events{/privacy}","received_events_url":"https://api.github.com/users/at-android/received_events","type":"User","site_admin":false},"repo":{"id":73338924,"name":"2016-k2-training","full_name":"at-android/2016-k2-training","owner":{"login":"at-android","id":23370381,"avatar_url":"https://avatars.githubusercontent.com/u/23370381?v=3","gravatar_id":"","url":"https://api.github.com/users/at-android","html_url":"https://github.com/at-android","followers_url":"https://api.github.com/users/at-android/followers","following_url":"https://api.github.com/users/at-android/following{/other_user}","gists_url":"https://api.github.com/users/at-android/gists{/gist_id}","starred_url":"https://api.github.com/users/at-android/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-android/subscriptions","organizations_url":"https://api.github.com/users/at-android/orgs","repos_url":"https://api.github.com/users/at-android/repos","events_url":"https://api.github.com/users/at-android/events{/privacy}","received_events_url":"https://api.github.com/users/at-android/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/at-android/2016-k2-training","description":null,"fork":false,"url":"https://api.github.com/repos/at-android/2016-k2-training","forks_url":"https://api.github.com/repos/at-android/2016-k2-training/forks","keys_url":"https://api.github.com/repos/at-android/2016-k2-training/keys{/key_id}","collaborators_url":"https://api.github.com/repos/at-android/2016-k2-training/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/at-android/2016-k2-training/teams","hooks_url":"https://api.github.com/repos/at-android/2016-k2-training/hooks","issue_events_url":"https://api.github.com/repos/at-android/2016-k2-training/issues/events{/number}","events_url":"https://api.github.com/repos/at-android/2016-k2-training/events","assignees_url":"https://api.github.com/repos/at-android/2016-k2-training/assignees{/user}","branches_url":"https://api.github.com/repos/at-android/2016-k2-training/branches{/branch}","tags_url":"https://api.github.com/repos/at-android/2016-k2-training/tags","blobs_url":"https://api.github.com/repos/at-android/2016-k2-training/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/at-android/2016-k2-training/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/at-android/2016-k2-training/git/refs{/sha}","trees_url":"https://api.github.com/repos/at-android/2016-k2-training/git/trees{/sha}","statuses_url":"https://api.github.com/repos/at-android/2016-k2-training/statuses/{sha}","languages_url":"https://api.github.com/repos/at-android/2016-k2-training/languages","stargazers_url":"https://api.github.com/repos/at-android/2016-k2-training/stargazers","contributors_url":"https://api.github.com/repos/at-android/2016-k2-training/contributors","subscribers_url":"https://api.github.com/repos/at-android/2016-k2-training/subscribers","subscription_url":"https://api.github.com/repos/at-android/2016-k2-training/subscription","commits_url":"https://api.github.com/repos/at-android/2016-k2-training/commits{/sha}","git_commits_url":"https://api.github.com/repos/at-android/2016-k2-training/git/commits{/sha}","comments_url":"https://api.github.com/repos/at-android/2016-k2-training/comments{/number}","issue_comment_url":"https://api.github.com/repos/at-android/2016-k2-training/issues/comments{/number}","contents_url":"https://api.github.com/repos/at-android/2016-k2-training/contents/{+path}","compare_url":"https://api.github.com/repos/at-android/2016-k2-training/compare/{base}...{head}","merges_url":"https://api.github.com/repos/at-android/2016-k2-training/merges","archive_url":"https://api.github.com/repos/at-android/2016-k2-training/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/at-android/2016-k2-training/downloads","issues_url":"https://api.github.com/repos/at-android/2016-k2-training/issues{/number}","pulls_url":"https://api.github.com/repos/at-android/2016-k2-training/pulls{/number}","milestones_url":"https://api.github.com/repos/at-android/2016-k2-training/milestones{/number}","notifications_url":"https://api.github.com/repos/at-android/2016-k2-training/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/at-android/2016-k2-training/labels{/name}","releases_url":"https://api.github.com/repos/at-android/2016-k2-training/releases{/id}","deployments_url":"https://api.github.com/repos/at-android/2016-k2-training/deployments","created_at":"2016-11-10T02:12:11Z","updated_at":"2016-11-10T03:43:58Z","pushed_at":"2016-12-08T08:30:50Z","git_url":"git://github.com/at-android/2016-k2-training.git","ssh_url":"git@github.com:at-android/2016-k2-training.git","clone_url":"https://github.com/at-android/2016-k2-training.git","svn_url":"https://github.com/at-android/2016-k2-training","homepage":null,"size":5631,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/at-android/2016-k2-training/pulls/43"},"html":{"href":"https://github.com/at-android/2016-k2-training/pull/43"},"issue":{"href":"https://api.github.com/repos/at-android/2016-k2-training/issues/43"},"comments":{"href":"https://api.github.com/repos/at-android/2016-k2-training/issues/43/comments"},"review_comments":{"href":"https://api.github.com/repos/at-android/2016-k2-training/pulls/43/comments"},"review_comment":{"href":"https://api.github.com/repos/at-android/2016-k2-training/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/at-android/2016-k2-training/pulls/43/commits"},"statuses":{"href":"https://api.github.com/repos/at-android/2016-k2-training/statuses/86db3f585850a4631c9a1006e6dec419a31a5dc3"}}}}
{"actor":{"display_login":"at-binc"}}