public static List <HistoryItem> GetHistoryItems() { HistoryTableAdapter adapter = new HistoryTableAdapter(); List <HistoryItem> results = new List <HistoryItem>(); var rows = adapter.GetData(); foreach (var row in rows) { HistoryItem item = new HistoryItem(); item.ID = row.Id; item.URL = row.URL; item.Title = row.Title; item.Date = row.Date; item.DateTime = row.DateTime; results.Add(item); } HistoryItem historyItem = new HistoryItem(); int i = 0; while (i != results.Count) { if (historyItem.URL == results[i].URL) { DeleteHistoryItem(results[i].ID, results[i].Date); results.Remove(results[i]); } else { historyItem = results[i]; i++; } } return(results); }
public static List <HistoryItem> GetItems() { var adapter = new HistoryTableAdapter(); var results = new List <HistoryItem>(); try { var rows = adapter.GetData(); foreach (var row in rows) { var item = new HistoryItem(); item.Title = row.Title; item.URL = row.URL; item.ID = row.Id; item.Date = row.Date; results.Add(item); } return(results); } catch (System.Data.ConstraintException) { return(results); } }
public static List <HistoryItem> deleteItem(string URLin) { var adapter = new HistoryTableAdapter(); var results = new List <HistoryItem>(); var rows = adapter.GetData(); foreach (var row in rows) { if (row.URL.Equals(URLin)) { adapter.Delete(row.Id, row.URL, row.Title, row.Date); break; } } foreach (var row in rows) { var item = new HistoryItem(); item.URL = row.URL; item.Title = row.Title; item.Date = row.Date; item.Id = row.Id; results.Add(item); } return(results); }
public static HistoryItem FindHistoryItem(string term) { var adapter = new HistoryTableAdapter(); var workingList = GetHistoryList(); return(workingList.Find(x => x.Name == term)); }
public static void UpdateDatabase() { var adapter = new HistoryTableAdapter(); var historySet = new HistoryDataSet(); adapter.Update(historySet); }
public static void DeleteHistoryItem(HistoryItem item) { var adapter = new HistoryTableAdapter(); var oldItem = item; adapter.Delete(item.ID, item.URL, item.Name, item.Date); adapter.UpdateQuery(item.URL, item.Name, item.Date, oldItem.ID, oldItem.URL, oldItem.Name, oldItem.Date, item.ID); }
public static void AddHistory(HistoryItem item) { try { var adapter = new HistoryTableAdapter(); adapter.Insert(item.URL, item.Name, item.Date); } catch { } }
//////////////////////////// // DELETES HISTORY ITEMS // ////////////////////////// public static void DeleteHist() { var adapter = new HistoryTableAdapter(); var rows = adapter.GetData(); foreach (var row in rows) { adapter.Delete(row.Id, row.URL, row.Title, row.Date); } }
public static void ClearHistory() { var pages = new HistoryTableAdapter(); var rows = pages.GetData(); foreach (var row in rows) { row.Delete(); } pages.Update(rows); }
private void clearHistoryButton_Click(object sender, EventArgs e) { var adapter = new HistoryTableAdapter(); var history = adapter.GetData(); foreach (var item in history) { HistoryManager.DeleteHistoryRow(item); listBox1.Items.Clear(); } }
////////////////////////////////////// // REMOVES A SPECIFIC HISTORY ITEM // //////////////////////////////////// public static void RemoveHist(string candidate) { var adapter = new HistoryTableAdapter(); var rows = adapter.GetData(); foreach (var row in rows) { string rowChecker = string.Format(string.Format("[{0}] {1} ({2})", row.Date, row.Title, row.URL)); if (rowChecker == candidate) { adapter.Delete(row.Id, row.URL, row.Title, row.Date); } } }
public static void deleteSingle(string idx) { var adapter = new HistoryTableAdapter(); var rows = adapter.GetData(); //(string.Format("[{0}] {1}({2})", pages.Date, pages.Title, pages.URL)); foreach (var row in rows) { if (string.Format("[{0}] {1}({2})", row.Date, row.Title, row.URL) == idx) { row.Delete(); } } adapter.Update(rows); }
public static void deleteItem(int idx) { var adapter = new HistoryTableAdapter(); //adapter.DeleteHP(idx+1); var rows = adapter.GetData(); foreach (var row in rows) { if (row.Id == (idx + 1)) { row.Delete(); } } adapter.Update(rows); }
/** * Deletes item from table adapter based on index of listbox. */ public static bool DeleteHistoryItem(string URLin, DateTime dateIn) { bool itWorked = false; var adapter = new HistoryTableAdapter(); var rows = adapter.GetData(); foreach (var row in rows) { // if date and url match, delete if ((row.URL.Equals(URLin)) && (row.Date.ToString().Equals(dateIn.ToString()))) { adapter.Delete(row.Id, row.URL, row.Title, row.Date); break; } } return(itWorked); }
public void Start(SERVER_TYPE type, int port) { _team_template_start = new StringBuilder(); _team_template_end = new StringBuilder(); try { using (StreamReader sr = new StreamReader(@"Team.kml")) { String line; while ((line = sr.ReadLine()) != null) { if (line.Equals("<!-- INSERT_PLACEMARKS -->")) { break; } else { _team_template_start.Append(line); } } while ((line = sr.ReadLine()) != null) { _team_template_end.Append(line); } sr.Close(); } _server_type = type; _port_number = port; _hist_time = DateTime.Now; _keepAppRunning = true; InitialiseListener(); if (_server_type == SERVER_TYPE.HISTORY) { _history_adapter = new HistoryTableAdapter(); _history_adapter.Connection.Open(); } _listeningThread = new Thread(ListeningThread); _listeningThread.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message + ex.InnerException + ex.ToString()); } }
public static List <HistoryItem> GetHistoryList() { var adapter = new HistoryTableAdapter(); var result = new List <HistoryItem>(); var rows = adapter.GetData(); foreach (var row in rows) { var item = new HistoryItem(); item.URL = row.URL; item.Name = row.Name; item.Date = row.Date; result.Add(item); } return(result); }
public static List <HistoryItem> GetItems() { var adapter = new HistoryTableAdapter(); var results = new List <HistoryItem>(); var rows = adapter.GetData(); foreach (var row in rows) { var item = new HistoryItem(); item.Id = row.Id; item.URL = row.URL; item.Title = row.Title; item.Date = row.Date; results.Add(item); } return(results); }
public static List <HistoryItem> clearItems() { var adapter = new HistoryTableAdapter(); var results = new List <HistoryItem>(); var rows = adapter.GetData(); foreach (var row in rows) { var item = new HistoryItem(); item.URL = row.URL; item.Title = row.Title; item.Date = row.Date; item.Id = row.Id; adapter.Delete(row.Id, row.URL, row.Title, row.Date); results.Remove(item); } return(results); }
public static List <HistoryItem> GetItems() { var adapter = new HistoryTableAdapter(); var results = new List <HistoryItem>(); var rows = adapter.GetData(); foreach (var row in rows) { #pragma warning disable IDE0017 // Simplify object initialization var item = new HistoryItem(); #pragma warning restore IDE0017 // Simplify object initialization item.URL = row.URL; item.Title = row.Title; item.Date = row.Date; results.Add(item); } return(results); }
/** * Gets all History Items in the database. * @return a list of all history items */ public static List <HistoryItem> GetAllHistoryItems() { var adapter = new HistoryTableAdapter(); var results = new List <HistoryItem>(); try { var rows = adapter.GetData(); foreach (var row in rows) { var item = new HistoryItem(row.URL, row.Title, row.Date); results.Add(item); } } finally { } return(results); }
public static void DeleteHistory() { var adapter = new HistoryTableAdapter(); //var results = new List<HistoryItem>(); var rows = adapter.GetData(); foreach (var row in rows) { row.Delete(); /*#pragma warning disable IDE0017 // Simplify object initialization * var item = new HistoryItem(); #pragma warning restore IDE0017 // Simplify object initialization * item.URL = row.URL; * item.Title = row.Title; * item.Date = row.Date;*/ //results.Remove(item); } }
public static List <HistoryItem> GetSearchItems(string search) { var adapter = new HistoryTableAdapter(); var results = new List <HistoryItem>(); var rows = adapter.GetData(); foreach (var row in rows) { var item = new HistoryItem(); item.URL = row.URL; item.Title = row.Title; item.Date = row.Date; if (item.Title.Contains(search)) { results.Add(item); } } return(results); }
public static List <HistoryItem> DeleteSelected(string selected) { var adapter = new HistoryTableAdapter(); var results = new List <HistoryItem>(); var rows = adapter.GetData(); foreach (var row in rows) { var item = new HistoryItem(); item.URL = row.URL; item.Title = row.Title; item.Date = row.Date; results.Add(item); if (selected.Contains(row.Date.ToString())) { adapter.DeleteQuery(item.Date); results.Remove(item); } } return(results); }
public void Stop() { // Close down our thread and listener if required. _keepAppRunning = false; if (_listeningThread != null && _listeningThread.ThreadState == ThreadState.Running) { _listeningThread.Abort(); _listeningThread = null; } if (_listener != null && _listener.IsListening) { _listener.Stop(); _listener.Close(); _listener = null; } _curr_data.Clear(); if (_history_adapter != null && _history_adapter.Connection.State != ConnectionState.Closed) { _history_adapter.Connection.Close(); _history_adapter = null; } }
public static void DeleteHistoryItem(int id, DateTime dateTime) { HistoryTableAdapter adapter = new HistoryTableAdapter(); adapter.Delete(id, dateTime); }
public static void AddHistoryItem(HistoryItem item) { HistoryTableAdapter adapter = new HistoryTableAdapter(); adapter.Insert(item.URL, item.Title, item.Date, item.DateTime); }
public void DeleteItem(int Id) { var adapter = new HistoryTableAdapter(); adapter.Delete1(Id); }
public static HistoryDataTable GetHistoryData() { var adapter = new HistoryTableAdapter(); return(adapter.GetData()); }
public static void addHistoryItem(HistoryItem item) { var adapter = new HistoryTableAdapter(); }
public static void DeleteHistoryRow(HistoryDataSet.HistoryRow item) { var adapter = new HistoryTableAdapter(); adapter.Delete(item.Id, item.URL, item.Name, item.Date); }