//DB 입력 부분 public void inputDB() { TextView txt_input_url = FindViewById <TextView>(Resource.Id.txt_input_url); URL_Log log = new URL_Log() { Url = txt_input_url.Text, Result = fcnt + " / " + total }; db.InsertIntoTableURL_Log(log); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.History); var tolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetActionBar(tolbar); ActionBar.Title = "과거 내역"; ActionBar.SetDisplayHomeAsUpEnabled(true); ActionBar.SetHomeButtonEnabled(true); //db 생성 db = new Database(); db.createDataBase(); string folder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); Log.Info("DB_PATH", folder); lstData = FindViewById <ListView>(Resource.Id.db_list); var dbDel = FindViewById <Button>(Resource.Id.dbDel); //데이터 로드 LoadData(); //이벤트 dbDel.Click += delegate { URL_Log log = new URL_Log(); db.DeleteTableURL_Log(log); LoadData(); }; lstData.ItemClick += (s, e) => { for (int i = 0; i < lstData.Count; i++) { if (e.Position == i) { lstData.GetChildAt(i).SetBackgroundColor(Android.Graphics.Color.DarkGray); } else { lstData.GetChildAt(i).SetBackgroundColor(Android.Graphics.Color.Transparent); } } }; }
public bool DeleteTableURL_Log(URL_Log URL_Log) { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(folder, "URL_Log.db"))) { connection.Query <URL_Log>("DELETE FROM URL_Log"); return(true); } } catch (SQLiteException ex) { Log.Info("SQLiteEx", ex.Message); return(false); } }
public bool UpdateTableURL_Log(URL_Log URL_Log) { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(folder, "URL_Log.db"))) { connection.Query <URL_Log>("UPDATE URL_Log set Url=?,Result=? Where Id=?", URL_Log.Url, URL_Log.Result, URL_Log.Id); return(true); } } catch (SQLiteException ex) { Log.Info("SQLiteEx", ex.Message); return(false); } }
public bool InsertIntoTableURL_Log(URL_Log URL_Log) { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(folder, "URL_Log.db"))) { connection.Insert(URL_Log); return(true); } } catch (SQLiteException ex) { Log.Info("SQLiteEx", ex.Message); return(false); } }