Пример #1
0
        private DBDataItem getDataItem(int iddataitem)
        {
            isConnected();
            String q = "SELECT * FROM `dataitems` WHERE iddataitems = '" + iddataitem + "'";
           // Console.WriteLine(q);
            //Create Command
            MySqlCommand cmd = new MySqlCommand(q, connection);

            //Create a data reader and Execute the command
            MySqlDataReader dataReader = cmd.ExecuteReader();



            //Read the data and store them in the list
                dataReader.Read();

                String label = dataReader.GetString("label");
                Int32 id = dataReader.GetInt32("iddataitems");
                String type = dataReader.GetString("type");
                TimeSpan runtime = TimeSpan.FromMilliseconds(dataReader.GetInt32("runtime"));
                String title = dataReader.GetString("title");
                String artist = dataReader.GetString("artist");
                String file = dataReader.GetString("file");
                String radiovis1 = dataReader.GetString("radiovis1");
                String radiovis2 = dataReader.GetString("radiovis2");
                String radiovis3 = dataReader.GetString("radiovis3");
                String radiovis4 = dataReader.GetString("radiovis3");
                String radiovistxt = dataReader.GetString("radiovistxt");
                String category = dataReader.GetString("category");

                dataReader.Close();
                DBDataItem item = new DBDataItem(label, id, runtime, type, title, artist,file,radiovis1, radiovis2, radiovis3, radiovis4, radiovistxt, category);
                return item;

        }
Пример #2
0
 public ScheduledSlot(int idhist, int idscheduledslice, int position, string type, int iddataitem, string param, string label, DateTime scheduleddatetime)
 {
     this.idhist = idhist;
     this.idscheduledslice = idscheduledslice;
     this.position = position;
     this.type = type;
     this.iddataitem = iddataitem;
     this.param = param;
     this.label = label;
     this.scheduleddatetime = scheduleddatetime;
     this.dataitem = null;
 }
Пример #3
0
        private DBDataItem getDataItemFromCategoryShortName(string categoryshortname)
        {
            //int idcateg = getCategoryIdFromShortName(categoryshortname);

            DBDataItem ret=null;

            isConnected();
            String q = "SELECT * FROM `dataitems` WHERE category='" + categoryshortname + "' ORDER by RAND() LIMIT 1";
            Console.WriteLine(q);
            //Create Command
            MySqlCommand cmd = new MySqlCommand(q, connection);
            
            //Create a data reader and Execute the command
            MySqlDataReader dataReader = cmd.ExecuteReader();
            Console.WriteLine(dataReader.FieldCount);
            
            //Read the data and store them in the list
            while (dataReader.Read())
            {
                Int32 id = dataReader.GetInt32("iddataitems");
                TimeSpan runtime = TimeSpan.FromMilliseconds(dataReader.GetInt32("runtime"));
                String label = dataReader.GetString("label");
                ret = new DBDataItem(label, id, runtime);



            }

            //close Data Reader
            dataReader.Close();

            return ret;
        }