public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { RunsListAdapterViewHolder vh = holder as RunsListAdapterViewHolder; var item = _runs.ElementAt(position); vh.Caption.Text = item.Caption; }
public Task <T> ElementAtAsync(int index) { return(Task.Factory.StartNew(() => { using (((SQLiteConnectionWithLock)_innerQuery.Connection).Lock()) { return _innerQuery.ElementAt(index); } })); }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { StaysListAdapterViewHolder vh = holder as StaysListAdapterViewHolder; var item = _stays.ElementAt(position); vh.City.Text = item.City; }
public Task <T> ElementAtAsync(int index) { return(Task.Factory.StartNew(() => { using (((SQLiteConnectionWithLock)_innerQuery.Connection).Lock()) { return _innerQuery.ElementAt(index); } }, CancellationToken.None, _taskCreationOptions, _taskScheduler ?? TaskScheduler.Default)); }
public Task <T> ElementAtAsync(int index, CancellationToken cancellationToken = default(CancellationToken)) { return(Task.Factory.StartNew(() => { cancellationToken.ThrowIfCancellationRequested(); using (((SQLiteConnectionWithLock)_innerQuery.Connection).Lock()) { return _innerQuery.ElementAt(index); } }, cancellationToken, _taskCreationOptions, _taskScheduler ?? TaskScheduler.Default)); }
/// <summary> /// Read the list of items. /// </summary> public List <TEntity> Read() { var returnItem = new List <TEntity> (); TableQuery <TEntity> itemList = DatabaseConnection.Table <TEntity> (); for (int i = 0; i < itemList.Count(); i++) { returnItem.Add(itemList.ElementAt(i)); } return(returnItem); }
public DateTime GetOldest() { TableQuery <Table> DateOrder = BDDConnection.Table <Table>().OrderBy(t => t.Date); int test = DateOrder.Count(); if (DateOrder.Count() != 0) { DateTime OldtDate = DateOrder.ElementAt(0).Date; return(OldtDate); } return(new DateTime()); }
private void OnItemClick(object sender, int position) { var currentStay = _stays.ElementAt(position); if (currentStay != null) { var intent = new Intent(this, typeof(RunsListActivity)); intent.PutExtra(IntentConstants.StayId, currentStay.Id); intent.PutExtra(IntentConstants.StayLabel, currentStay.City); StartActivity(intent); //StartActivity(typeof(RunsListActivity)); } }
public void LoadFromStorage() { using (var connection = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), C.DB_PATH)) { var cmd = connection.CreateCommand($"SELECT name FROM sqlite_master WHERE type='table' AND name='{typeof(Todo).Name}'"); if (cmd.ExecuteScalar <string>() == null) { connection.CreateTable <Todo>(SQLite.Net.Interop.CreateFlags.None); } TableQuery <Todo> q = connection.Table <Todo>(); _instance.Todos.Clear(); for (int i = 0; i < q.Count(); ++i) { Todos.Add(q.ElementAt(i)); } } }
public void InsertNewElement(List <JSON.Weather> p_List) { TableQuery <Table> DateOrder = BDDConnection.Table <Table>().OrderByDescending(t => t.Date); DateTime RecentDate = new DateTime(); if (DateOrder.Count() != 0) { RecentDate = DateOrder.ElementAt(0).Date; } int indiceInsert = 0; if (DateTime.Compare(RecentDate, DateTime.Parse(p_List[indiceInsert].date.Heure)) < 0) { ClearTable(); InsertList(p_List); } else { while (DateTime.Compare(RecentDate, DateTime.Parse(p_List[indiceInsert].date.Heure)) > 0) { indiceInsert++; } List <Table> temp = new List <Table>(); Table tmp; foreach (Weather wth in p_List) { tmp = wth; temp.Add(tmp); } for (int i = indiceInsert; i < temp.Count - 1; i++) { try { Insert(temp[i]); } catch (Exception e) { Log.Info("BDD Weather APP", "Error when trying to insert the new elements of weather in the BDD " + e.ToString()); } } } }
public List <Promocion> cargarPromociones() { List <Promocion> promos = new List <Promocion>(); try { TableQuery <Promocion> listaPromos = baseDatos.Table <Promocion>(); for (int i = 0; i < listaPromos.Count(); i++) { promos.Add(listaPromos.ElementAt(i)); } } catch (Exception e) { } return(promos); }
public static List <Tag> GetTagByPidStatic(string pid) { TableQuery <Tag> table = connection.Table <Tag>().Where(x => x.PID == pid); if (table.Count() == 0) { return(null); } else { int count = table.Count(); List <Tag> list = new List <Tag>(count); for (int i = 0; i < count; i++) { list.Add(table.ElementAt(i)); } return(list); } }
public List <UserApp> cargarUsuarios() { List <UserApp> usuarios = new List <UserApp>(); try { TableQuery <UserApp> tablaUsuarios = baseDatos.Table <UserApp>(); for (int i = 0; i < tablaUsuarios.Count(); i++) { usuarios.Add(tablaUsuarios.ElementAt(i)); } } catch (Exception e) { Console.WriteLine("Error: " + e); } return(usuarios); }
public List <TweetProgramado> cargarTweetProgramado() { List <TweetProgramado> tweetsProg = new List <TweetProgramado>(); try { TableQuery <TweetProgramado> tweets = baseDatos.Table <TweetProgramado>(); for (int i = 0; i < tweets.Count(); i++) { tweetsProg.Add(tweets.ElementAt(i)); } } catch (Exception e) { Console.WriteLine("Error: " + e); } return(tweetsProg); }
public Player Player_Default() { // Query to see if any player exists locally Data_Server dServ = new Data_Server(); SQLiteConnection db = new SQLiteConnection(dbPath); db.CreateTable <Player>(); TableQuery <Player> qryPlayer = db.Table <Player>(); if (qryPlayer.Count() == 0) { db.Close(); return(null); } else { Player toReturn = qryPlayer.ElementAt(0); db.Close(); return(Player_Get(toReturn.Username)); } }
public List <Client> getClientsByName(string clientName) { List <Client> clientList = new List <Client>(); using (var conn = SqlLiteConnection(dbPath)) { try { TableQuery <Client> clientResults = from s in conn.Table <Client>() where s.name.Equals(clientName) select s; for (int i = 0; i < clientResults.Count(); i++) { clientList.Add(clientResults.ElementAt(i)); } } catch (Exception e) { log.Error("Error getClientsByName: " + e.Message); throw new HttpResponseException(System.Net.HttpStatusCode.InternalServerError); } } return((clientList.Count != 0) ? clientList : null); }
/// <summary> /// Gets all clients from db /// </summary> /// <returns>Returns a list of clients or null if empty</returns> public List <Client> getClients() { List <Client> clientListReturn = null; using (var conn = SqlLiteConnection(dbPath)) { try { clientListReturn = new List <Client>(); TableQuery <Client> clientList = conn.Table <Client>(); for (int i = 0; i < clientList.Count(); i++) { clientListReturn.Add(clientList.ElementAt(i)); } } catch (Exception e) { log.Error("Error getClients: " + e.Message); throw new HttpResponseException(System.Net.HttpStatusCode.InternalServerError); } } return((clientListReturn.Count != 0) ? clientListReturn : null); }
/// <summary> /// Returns the element at a given index /// </summary> public Task <T> ElementAtAsync(int index) { return(ReadAsync(conn => _innerQuery.ElementAt(index))); }