/// <summary> /// Get Specyfied groups /// </summary> /// <param name="group"></param> /// <returns></returns> public static List <ILibraryGroupItem> getLibraryGroup(Library.Group group) { connect(); List <ILibraryGroupItem> lib = new List <ILibraryGroupItem>(); try { Command.CommandText = "SELECT * FROM " + group.ToString() + "s ORDER BY " + group.ToString() + "Title ASC"; //SQL Command.CommandType = System.Data.CommandType.Text; Connection.Open(); Reader = Command.ExecuteReader(); ILibraryGroupItem groupItem = null; while (Reader.Read()) { groupItem = new Album(); groupItem.Title = Reader[group + "Title"].ToString(); groupItem.Genre = Reader[group + "Genre"].ToString(); if (group == Library.Group.Album) { groupItem.ArtistName = Reader["AlbumArtist"].ToString(); } groupItem.Cover = DBConnection.getSampleTrack(group.ToString(), groupItem.Title).Cover; lib.Add(groupItem); } } catch (Exception ex) { Console.WriteLine(Command.CommandText); Console.WriteLine(ex); return(null); } finally { if (Connection != null) { Connection.Close(); } } return(lib); }
public MGItem(Library.Group group, string title, string subHeading1, string subHeading2, Image cover) { InitializeComponent(); this.SetStyle(ControlStyles.UserPaint, true); base.BorderStyle = BorderStyle.None; this.BorderStyle = BorderStyle.FixedSingle; this.title = title; this.heading1 = subHeading1; this.heading2 = subHeading2; this.cover = cover; if (title.Count() > 30) { lb_mainHeading.Text = title.Substring(0, 30) + "..."; } else { lb_mainHeading.Text = title; } lb_heading1.Text = heading1; lb_heading2.Text = heading2; pictureBox1.Image = cover; if (heading2.Equals("")) { lb_sepLine.Text = ""; } else { lb_sepLine.Text = "|"; } this.group = group; }
public static List <Track> getLibraryGroupTracks(Library.Group group, string groupTitle) { connect(); List <Track> tracksList = new List <Track>(); try { Command.CommandText = "SELECT * FROM Tracks WHERE Track" + group.ToString() + "='" + Tools.replaceCharacters(groupTitle) + "'"; //SQL Command.CommandType = System.Data.CommandType.Text; Connection.Open(); Reader = Command.ExecuteReader(); Track track; while (Reader.Read()) { track = Library.createTrack(Reader["TrackPatch"].ToString()); tracksList.Add(track); } } catch (Exception ex) { Console.WriteLine(Command.CommandText); Console.WriteLine(ex); return(null); } finally { if (Connection != null) { Connection.Close(); } } return(tracksList); }