Example #1
0
        public string SongData(string songkey, string column, DateTime data)
        {
            MVCSongs target          = null;
            MVCSongs targetreference = null;

            foreach (MVCSongs q in songs)
            {
                if (q.SongKey == songkey)
                {
                    target = q;
                    break;
                }
            }
            foreach (MVCSongs q in songsref)
            {
                if (q.SongKey == songkey)
                {
                    targetreference = q;
                    break;
                }
            }
            //if (target != null)
            //{
            //   return datestyle(target.EventDate, (targetreference == null) ? DateTime.MinValue : targetreference.EventDate);
            //}
            //else
            return(string.Format("<text>{0}</text>", data));
        }
Example #2
0
        public string Save()
        {
            string            result         = "";
            int               recordschanged = 0;
            SingingClubClient client         = new SingingClubClient();

            client.Open();
            if (songs != null && songsref != null)
            {
                List <MVCSongs> tobeadded = new List <MVCSongs>();
                foreach (MVCSongs q in songs)
                {
                    bool found = false;
                    foreach (MVCSongs qref in songsref)
                    {
                        if (q.KeyEquals(qref) == true)
                        {
                            found = true;
                            if (MVCSongs.FieldsEqual(q, qref) == false)
                            {
                                result = client.GeneralStore("TSCSongList_Main", "UPDATE", q.GetDataXml());
                                if (result != null && Utility.IsNumber(result) && int.Parse(result) > 0)
                                {
                                    recordschanged++;
                                }
                            }
                        }
                    }
                    if (found == false)
                    {
                        tobeadded.Add(q);
                    }
                }
                if (tobeadded.Count > 0)
                {
                    foreach (MVCSongs tba in tobeadded)
                    {
                        result = client.GeneralStore("TSCSongList_Main", "INSERT", tba.GetDataXml());
                        if (result != null && Utility.IsNumber(result) && int.Parse(result) > 0)
                        {
                            recordschanged++;
                        }
                    }
                }
            }
            client.Close();
            return(recordschanged.ToString());
        }
Example #3
0
        public string SongData(string songkey, string column, string data)
        {
            MVCSongs target          = null;
            MVCSongs targetreference = null;

            foreach (MVCSongs q in songs)
            {
                if (q.SongKey == songkey)
                {
                    target = q;
                    break;
                }
            }
            foreach (MVCSongs q in songsref)
            {
                if (q.SongKey == songkey)
                {
                    targetreference = q;
                    break;
                }
            }
            if (target != null)
            {
                switch (column)
                {
                case "Title":
                    return(util.textstyle(target.Title, (targetreference == null) ? null : targetreference.Title));

                case "Artist":
                    return(util.textstyle(target.Artist, (targetreference == null) ? null : targetreference.Artist));

                case "Disk":
                    return(util.textstyle(target.Disk, (targetreference == null) ? null : targetreference.Disk));

                default:
                    return(string.Format("<text>{0}</text>", data));
                }
            }
            else
            {
                return(string.Format("<text>{0}</text>", data));
            }
        }