Exemplo n.º 1
0
        public string VenueData(string venuekey, string column, DateTime data)
        {
            MVCVenues target          = null;
            MVCVenues targetreference = null;

            foreach (MVCVenues q in venues)
            {
                if (q.VenueKey == venuekey)
                {
                    target = q;
                    break;
                }
            }
            foreach (MVCVenues q in venuesref)
            {
                if (q.VenueKey == venuekey)
                {
                    targetreference = q;
                    break;
                }
            }
            //if (target != null)
            //{
            //   return datestyle(target.EventDate, (targetreference == null) ? DateTime.MinValue : targetreference.EventDate);
            //}
            //else
            return(string.Format("<text>{0}</text>", data));
        }
Exemplo n.º 2
0
        public string VenueData(string venuekey, string column, string data)
        {
            MVCVenues target          = null;
            MVCVenues targetreference = null;

            foreach (MVCVenues q in venues)
            {
                if (q.VenueKey == venuekey)
                {
                    target = q;
                    break;
                }
            }
            foreach (MVCVenues q in venuesref)
            {
                if (q.VenueKey == venuekey)
                {
                    targetreference = q;
                    break;
                }
            }
            if (target != null)
            {
                switch (column)
                {
                case "VenueName":
                    return(util.textstyle(target.VenueName, (targetreference == null) ? null : targetreference.VenueName));

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

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

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

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

                default:
                    return(string.Format("<text>{0}</text>", data));
                }
            }
            else
            {
                return(string.Format("<text>{0}</text>", data));
            }
        }
Exemplo n.º 3
0
        public string Save()
        {
            string            result         = "";
            int               recordschanged = 0;
            SingingClubClient client         = new SingingClubClient();

            client.Open();
            if (venues != null && venuesref != null)
            {
                List <MVCVenues> tobeadded = new List <MVCVenues>();
                foreach (MVCVenues q in venues)
                {
                    bool found = false;
                    foreach (MVCVenues qref in venuesref)
                    {
                        if (q.KeyEquals(qref) == true)
                        {
                            found = true;
                            if (MVCVenues.FieldsEqual(q, qref) == false)
                            {
                                result = client.GeneralStore("TSCVenues", "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 (MVCVenues tba in tobeadded)
                    {
                        result = client.GeneralStore("TSCVenues", "INSERT", tba.GetDataXml());
                        if (result != null && Utility.IsNumber(result) && int.Parse(result) > 0)
                        {
                            recordschanged++;
                        }
                    }
                }
            }
            client.Close();
            return(recordschanged.ToString());
        }
Exemplo n.º 4
0
        public ActionResult PageEditVenue(string VenueKey, string Command = "")
        {
            MVCVenues tscvenue = null;

            if (VenueKey != null && VenueKey.Trim().Length > 0)
            {
                VenueData venueData = new VenueData(Command, VenueKey, SessionBag.Current.VenuesXml as XmlDocument);
                tscvenue = venueData.GetVenue();
            }
            else
            {
                tscvenue         = new MVCVenues();
                tscvenue.command = Command;
            }
            return(View(tscvenue));
        }
Exemplo n.º 5
0
        public ActionResult PageSetVenue(MVCVenues model)
        {
            string venuekey     = Request.Form["VenueKey"];
            string venuename    = Request.Form["VenueName"];
            string venueemail   = Request.Form["VenueEmail"];
            string venueaddress = Request.Form["VenueAddress"];
            string venuecontact = Request.Form["VenueContact"];
            string venuephone   = Request.Form["VenuePhone"];

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

            if (command == null)
            {
                command = "";
            }
            else
            {
                command = command.Trim().ToLower();
            }
            if (command == "remove" && venuekey != null && venuekey.Trim().Length > 0)
            {
                MVCVenues venue = new MVCVenues();
                venue.VenueKey = venuekey;
                SingingClubClient client = new SingingClubClient();
                client.Open();
                string result = client.GeneralStore("TSCVenues", "DELETE", venue.GetDataXml());
                if (result != null && Utility.IsNumber(result) && int.Parse(result) > 0)
                {
                    string _VenuesXml = client.GeneralStore("TSCVenues", "GET", (new MVCVenues()).GetDataXml());
                    client.Close();
                    XmlDocument VenuesXml          = new XmlDocument();
                    XmlDocument VenuesXmlReference = new XmlDocument();

                    VenuesXml.LoadXml(_VenuesXml);
                    VenuesXmlReference.LoadXml(_VenuesXml);

                    SessionBag.Current.VenuesXml          = VenuesXml;
                    SessionBag.Current.VenuesXmlReference = VenuesXmlReference;
                }
            }

            VenuesGrid venues = new VenuesGrid();

            if (SessionBag.Current.VenuesXml != null && SessionBag.Current.VenuesXml is XmlDocument &&
                SessionBag.Current.VenuesXmlReference != null && SessionBag.Current.VenuesXmlReference is XmlDocument &&
                venuekey != null && venuekey.Trim().Length > 0)
            {
                XmlDocument doc    = SessionBag.Current.VenuesXml as XmlDocument;
                XmlDocument docref = SessionBag.Current.VenuesXmlReference as XmlDocument;
                XmlNodeList nodes  = doc.SelectNodes("/Root/Data");
                bool        found  = false;
                foreach (XmlNode node in nodes)
                {
                    MVCVenues add = new MVCVenues(node);
                    if (add.VenueKey == venuekey)
                    {
                        SetText(node, "VenueName", venuename);
                        SetText(node, "VenueEmail", venueemail);
                        SetText(node, "VenueAddress", venueaddress);
                        SetText(node, "VenueContact", venuecontact);
                        SetText(node, "VenuePhone", venuephone);
                        add   = new MVCVenues(node);
                        found = true;
                    }
                    venues.venues.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, "VenueKey", venuekey);
                            SetText(data, "VenueName", venuename);
                            SetText(data, "VenueEmail", venueemail);
                            SetText(data, "VenueAddress", venueaddress);
                            SetText(data, "VenueContact", venuecontact);
                            SetText(data, "VenuePhone", venuephone);
                            MVCVenues add = new MVCVenues(data);
                            venues.venues.Add(add);
                        }
                    }
                }
                nodes = docref.SelectNodes("/Root/Data");
                foreach (XmlNode node in nodes)
                {
                    venues.venuesref.Add(new MVCVenues(node));
                }
                //venues.venues.Sort();
                venues.Bind();
                ViewData.Model = venues;
            }

            return(View());
        }