Ejemplo n.º 1
0
        public ShowItem GetShowItem(int showNo)
        {
            SQLiteCommand query = new SQLiteCommand();
            query.CommandText = "SELECT show_no, date, show_name, show_comment FROM [" + Year + "_show] WHERE show_no = @noparam;";
            query.CommandType = System.Data.CommandType.Text;
            query.Parameters.Add(new SQLiteParameter("@noparam", showNo));
            query.Connection = ClubConn;
            SQLiteDataReader reader = DoTheReader(query);
            ShowItem item = new ShowItem();

            while (reader.Read())
            {
                item.No = reader.GetInt32(0);
                item.Date = StringToDate(reader.GetString(1));
                item.Name = reader.GetString(2);
                item.Comments = reader.GetString(3);
            }
            reader.Close();
            ClubConn.Close();
            return item;
        }
Ejemplo n.º 2
0
        // Optional: sort (default is date)
        public List<ShowItem> GetShowItemList(ShowSort sort = ShowSort.Default)
        {
            // Case statment for sort column
            string sortString;
            switch(sort)
            {
                case ShowSort.Number: sortString = "show_no"; break;
                case ShowSort.Name: sortString = "show_name"; break;
                default: sortString = "date"; break;
            }

            string query = "SELECT show_no, date, show_name, show_comment FROM [" + Year + "_show] ORDER BY " + sortString + ";";
            SQLiteDataReader reader = DoTheReader(ClubConn, query);
            List<ShowItem> showItemList = new List<ShowItem>();
            ShowItem item;

            reader = DoTheReader(ClubConn, query);
            while (reader.Read())
            {
                item = new ShowItem();
                item.No = reader.GetInt32(0);
                item.Date = StringToDate(reader.GetString(1));
                item.Name = reader.GetString(2);
                item.Comments = reader.GetString(3);
                showItemList.Add(item);
            }
            reader.Close();
            ClubConn.Close();
            return showItemList;
        }
Ejemplo n.º 3
0
        // Optional: sort (default is date)
        public List<ShowItem> GetShowItemList(string database, int year, string sort)
        {
            MySqlDataReader reader;
            ShowItem item;
            List<ShowItem> showItemList = new List<ShowItem>();

            if (sort == String.Empty)
                sort = "date";
            reader = GetReader(database, year + "_show", "show_no, date, show_name, show_comment", String.Empty, sort);
            while(reader.Read())
            {
                item = new ShowItem();
                item.no = reader.GetInt32(0);
                item.date = reader.GetDateTime(1);
                item.name = reader.GetString(2);
                item.comments = reader.GetString(3);
                showItemList.Add(item);
            }
            reader.Close();
            connection.Close();
            return showItemList;
        }
Ejemplo n.º 4
0
        public ShowItem GetShowItem(string database, int year, int showNo)
        {
            MySqlDataReader reader;
            ShowItem item = new ShowItem();

            reader = GetReader(database, year + "_show", "show_no, date, show_name, show_comment", "show_no=" + showNo, "date");
            while (reader.Read())
            {
                item.no = reader.GetInt32(0);
                item.date = reader.GetDateTime(1);
                item.name = reader.GetString(2);
                item.comments = reader.GetString(3);
            }
            reader.Close();
            connection.Close();
            return item;
        }