Ejemplo n.º 1
0
        // Note: image IDs should be used here, not program IDs.
        public IDictionary <string, SDProgramImageResponse> GetImagesByIds(ISet <string> imageIDs)
        {
            Console.WriteLine("Reading program images from DB");
            Dictionary <string, SDProgramImageResponse> imagesByID =
                new Dictionary <string, SDProgramImageResponse>();

            foreach (string id in imageIDs)
            {
                imageIDs.Add(Misc.LimitString(id, 10));
            }
            using (SQLiteCommand command = new SQLiteCommand(string.Format("select {1}, {2} from {0};",
                                                                           kImagesTableName, kImageIdColumnName, kImageDataColumnName), connection_))
            {
                SQLiteDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    string id = reader[0].ToString();
                    if (imageIDs.Contains(id))
                    {
                        imagesByID[id] = JSONClient.Deserialize <SDProgramImageResponse>(reader[1].ToString());
                    }
                }
            }
            return(imagesByID);
        }
Ejemplo n.º 2
0
 public static string GetSDImageIDByProgramID(string programID)
 {
     return(Misc.LimitString(programID, 10));
 }