Ejemplo n.º 1
0
        public ActionResult SongTagEdit(string singerkey, string title, string artist, string disk)
        {
            SingingClubClient client = new SingingClubClient();
            TSCSongs          songs  = null;

            if (SessionBag.Current.SongsXml != null && client != null &&
                title != null && artist != null && disk != null && singerkey != null &&
                title.Trim().Length > 0 && artist.Trim().Length > 0 && disk.Trim().Length > 0 && singerkey.Trim().Length > 0)
            {
                XmlDocument doc  = SessionBag.Current.SongsXml as XmlDocument;
                XmlNode     node = doc.SelectSingleNode(string.Format("/Root/Data[Title=\"{0}\" and Artist=\"{1}\" and Disk=\"{2}\"]", title, artist, disk));
                if (node != null)
                {
                    songs = new TSCSongs(node);
                    TSCSingersSongs singerssongs = new TSCSingersSongs(singerkey, songs.Title, songs.Artist);
                    string          xml          = client.GeneralStore("TSCSingersSongs", "GET", singerssongs.GetDataXml());
                    if (xml != null && xml.Trim().Length == 0)
                    {
                        singerssongs.OneDriveZip = songs.OneDriveZip;
                        xml = client.GeneralStore("TSCSingersSongs", "INSERT", singerssongs.GetDataXml());
                    }
                }
            }

            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult SongLaunch(string title, string artist, string disk)
        {
            TSCSongs song = new TSCSongs();

            if (SessionBag.Current.SongsXml != null)
            {
                XmlDocument doc  = SessionBag.Current.SongsXml as XmlDocument;
                XmlNode     node = doc.SelectSingleNode(string.Format("/Root/Data[Title=\"{0}\" and Artist=\"{1}\" and Disk=\"{2}\"]", title, artist, disk));
                if (node != null)
                {
                    song = new TSCSongs(node);
                }
            }
            return(View(song));
        }
Ejemplo n.º 3
0
        // GET: Songs
        private void GetSongs()
        {
            if (SessionBag.Current.SongsPageOffset == null)
            {
                SessionBag.Current.SongsPageOffset = 0;
            }
            InitData          d      = new InitData();
            SingingClubClient client = new SingingClubClient();

            try
            {
                client.Open();
                TSCSongs songs = new TSCSongs();
                songs.PageOrder  = SessionBag.Current.SongsPageOrder;
                songs.PageByDisk = SessionBag.Current.SongsPageByDisk;
                songs.PageOffset = SessionBag.Current.SongsPageOffset;
                songs.PageReturn = SessionBag.Current.SongsPageReturn;
                //songs.PageSearchString = SessionBag.Current.SongsSearchString;
                string whereclause = Utility.SqlString(SessionBag.Current.SongsPageSearchString);
                if (whereclause != null && whereclause.Length > 0)
                {
                    string srch = "title";
                    if (songs.PageByDisk == true)
                    {
                        srch = "disk";
                    }
                    else if (songs.PageOrder.ToLower().Contains("artist"))
                    {
                        srch = "artist";
                    }
                    if (whereclause.Length > 0)
                    {
                        if (whereclause.Length == 1)
                        {
                            songs.WhereClause = string.Format("{0} > '{1}'", srch, whereclause);
                        }
                        else
                        {
                            songs.WhereClause = string.Format("{0} like '%{1}%'", srch, whereclause);
                        }
                    }
                }
                if (songs.WhereClause.Trim().Length > 0)
                {
                    songs.WhereClause += " and IsHelper = 'No'";
                }
                else
                {
                    songs.WhereClause = "IsHelper = 'No'";
                }
                d.SongsXml = client.GeneralStore("TSCSongList_Main", "GET", songs.GetDataXml());
                XmlDocument SongsXml          = new XmlDocument();
                XmlDocument SongsXmlReference = new XmlDocument();
                if (d.SongsXml != null && d.SongsXml.Trim().Length > 0)
                {
                    SongsXml.LoadXml(d.SongsXml);
                    XmlNodeList nodes = SongsXml.SelectNodes("/Root/Data");
                    if (nodes.Count > 0)
                    {
                        SongsXmlReference.LoadXml(d.SongsXml);
                        SetSongsPageRef();
                        SessionBag.Current.SongsXml          = SongsXml;
                        SessionBag.Current.SongsXmlReference = SongsXmlReference;
                    }
                    else
                    {
                        SessionBag.Current.SongsPageOffset = SessionBag.Current.SongsPageOffsetRef;
                    }
                }
                else
                {
                    SessionBag.Current.SongsPageOffset = SessionBag.Current.SongsPageOffsetRef;
                }
                client.Close();
            }
            catch {}
            finally
            {
                if (client != null)
                {
                    client.Close();
                }
            }
        }