Esempio n. 1
0
        public string SingerData(string singerkey, string column, DateTime data)
        {
            MVCSingers target          = null;
            MVCSingers targetreference = null;

            foreach (MVCSingers q in singers)
            {
                if (q.SingerKey == singerkey)
                {
                    target = q;
                    break;
                }
            }
            foreach (MVCSingers q in singersref)
            {
                if (q.SingerKey == singerkey)
                {
                    targetreference = q;
                    break;
                }
            }
            //if (target != null)
            //{
            //   return datestyle(target.EventDate, (targetreference == null) ? DateTime.MinValue : targetreference.EventDate);
            //}
            //else
            return(string.Format("<text>{0}</text>", data));
        }
Esempio n. 2
0
        public ActionResult SongTag(string title, string artist, string disk)
        {
            SingersGrid singers = new SingersGrid();

            singers.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)
                {
                    singers.song = new TSCSongs(node);
                }
            }

            Models.MvcList list = Controllers.QueueRoundData.GetRound(SessionBag.Current.RoundXml as XmlDocument, 1);
            foreach (object itm in list)
            {
                MVCQueue queue = itm as MVCQueue;
                if (queue != null)
                {
                    if (queue.SingerKey != null && queue.SingerKey.Trim().Length > 0)
                    {
                        MVCSingers singer = new MVCSingers();
                        singer.SingerKey = queue.SingerKey;
                        singers.singers.Add(singer);
                        singers.singersref.Add(singer);
                    }
                }
            }
            singers.Bind();
            ViewData.Model = singers;
            return(View());
        }
Esempio n. 3
0
        public string Save()
        {
            string            result         = "";
            int               recordschanged = 0;
            SingingClubClient client         = new SingingClubClient();

            client.Open();
            if (singers != null && singersref != null)
            {
                List <MVCSingers> tobeadded = new List <MVCSingers>();
                foreach (MVCSingers q in singers)
                {
                    bool found = false;
                    foreach (MVCSingers qref in singersref)
                    {
                        if (q.KeyEquals(qref) == true)
                        {
                            found = true;
                            if (MVCSingers.FieldsEqual(q, qref) == false)
                            {
                                result = client.GeneralStore("TSCSingers", "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 (MVCSingers tba in tobeadded)
                    {
                        result = client.GeneralStore("TSCSingers", "INSERT", tba.GetDataXml());
                        if (result != null && Utility.IsNumber(result) && int.Parse(result) > 0)
                        {
                            recordschanged++;
                        }
                    }
                }
            }
            client.Close();
            return(recordschanged.ToString());
        }
Esempio n. 4
0
        public ActionResult PageEditSinger(string SingerKey, string Command = "")
        {
            MVCSingers tscsinger = null;

            if (SingerKey != null && SingerKey.Trim().Length > 0)
            {
                SingerData singerData = new SingerData(Command, SingerKey, SessionBag.Current.SingersXml as XmlDocument);
                tscsinger = singerData.GetSinger();
            }
            else
            {
                tscsinger         = new MVCSingers();
                tscsinger.command = Command;
            }
            return(View(tscsinger));
        }
Esempio n. 5
0
        public string SingerData(string singerkey, string column, string data)
        {
            MVCSingers target          = null;
            MVCSingers targetreference = null;

            foreach (MVCSingers q in singers)
            {
                if (q.SingerKey == singerkey)
                {
                    target = q;
                    break;
                }
            }
            foreach (MVCSingers q in singersref)
            {
                if (q.SingerKey == singerkey)
                {
                    targetreference = q;
                    break;
                }
            }
            if (target != null)
            {
                switch (column)
                {
                case "SingerName":
                    return(util.textstyle(target.SingerName, (targetreference == null) ? null : targetreference.SingerName));

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

                default:
                    return(string.Format("<text>{0}</text>", data));
                }
            }
            else
            {
                return(string.Format("<text>{0}</text>", data));
            }
        }
Esempio n. 6
0
        public ActionResult PageSetSinger(MVCSingers model)
        {
            string singerkey   = Request.Form["SingerKey"];
            string singername  = Request.Form["SingerName"];
            string singeremail = Request.Form["SingerEmail"];

            string command = Request.Form["command"];

            if (command == null)
            {
                command = "";
            }
            else
            {
                command = command.Trim().ToLower();
            }
            if (command == "remove" && singerkey != null && singerkey.Trim().Length > 0)
            {
                MVCSingers singer = new MVCSingers();
                singer.SingerKey = singerkey;
                SingingClubClient client = new SingingClubClient();
                string            result = client.GeneralStore("TSCSingers", "DELETE", singer.GetDataXml());
                if (result != null && Utility.IsNumber(result) && int.Parse(result) > 0)
                {
                    string _SingersXml = client.GeneralStore("TSCSingers", "GET", (new MVCSingers()).GetDataXml());
                    client.Close();
                    XmlDocument SingersXml          = new XmlDocument();
                    XmlDocument SingersXmlReference = new XmlDocument();

                    SingersXml.LoadXml(_SingersXml);
                    SingersXmlReference.LoadXml(_SingersXml);

                    SessionBag.Current.SingersXml          = SingersXml;
                    SessionBag.Current.SingersXmlReference = SingersXmlReference;
                }
            }

            SingersGrid singers = new SingersGrid();

            if (SessionBag.Current.SingersXml != null && SessionBag.Current.SingersXml is XmlDocument &&
                SessionBag.Current.SingersXmlReference != null && SessionBag.Current.SingersXmlReference is XmlDocument &&
                singerkey != null && singerkey.Trim().Length > 0)
            {
                XmlDocument doc    = SessionBag.Current.SingersXml as XmlDocument;
                XmlDocument docref = SessionBag.Current.SingersXmlReference as XmlDocument;
                XmlNodeList nodes  = doc.SelectNodes("/Root/Data");
                bool        found  = false;
                foreach (XmlNode node in nodes)
                {
                    MVCSingers add = new MVCSingers(node);
                    if (add.SingerKey == singerkey)
                    {
                        SetText(node, "SingerName", singername);
                        SetText(node, "SingerEmail", singeremail);
                        add   = new MVCSingers(node);
                        found = true;
                    }
                    singers.singers.Add(add);
                }
                if (found == false && command != "remove")
                {
                    XmlNode root = doc.SelectSingleNode("/Root");
                    if (root != null)
                    {
                        XmlNode data = doc.CreateNode(XmlNodeType.Element, "Data", null);
                        if (data != null)
                        {
                            root.AppendChild(data);
                            SetText(data, "SingerKey", singerkey);
                            SetText(data, "SingerName", singername);
                            SetText(data, "SingerEmail", singeremail);
                            MVCSingers add = new MVCSingers(data);
                            singers.singers.Add(add);
                        }
                    }
                }
                nodes = docref.SelectNodes("/Root/Data");
                foreach (XmlNode node in nodes)
                {
                    singers.singersref.Add(new MVCSingers(node));
                }
                //singers.singers.Sort();
                singers.Bind();
                ViewData.Model = singers;
            }

            return(View());
        }