Ejemplo n.º 1
0
        /// <summary>
        /// Inserts a new service record into the database.
        /// </summary>
        /// <param name="date"></param>
        /// <param name="title"></param>
        /// <param name="theme"></param>
        /// <param name="songleader"></param>
        /// <returns></returns>
        public bool addService(DateTime date, string title, string theme, Person songleader)
        {
            using (var db = new WSOApp())
            {
                Service newService = new Service
                {
                    Svc_DateTime    = date,
                    Title           = title,
                    Theme           = theme,
                    Songleader_ID   = songleader.Person_ID,
                    Notes           = null,
                    Organist_Conf   = 'N',
                    Pianist_Conf    = 'N',
                    Songleader_Conf = 'N',
                    Organist_ID     = null,
                    Pianist_ID      = null
                };
                db.Services.Add(newService);

                db.SaveChanges();
            }


            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Query the database for
        /// </summary>
        /// <param name="template"></param>
        /// <returns></returns>
        public List <ServiceEvent> getServiceEvents(Service template)
        {
            List <ServiceEvent> serviceEventTemplate;

            using (var db = new WSOApp())
            {
                var eventQuery = from s in db.ServiceEvents
                                 where s.Service_ID == template.Service_ID
                                 select s;
                serviceEventTemplate = eventQuery.ToList();
            }

            return(serviceEventTemplate);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns a list of all previous longleaders.
        /// </summary>
        public List <Person> GetSongLeaders()
        {
            List <Person> Songleaders = new List <Person>();

            using (var db = new WSOApp())
            {
                foreach (Service sev in db.Services)
                {
                    var SongLeaderQuery = from p in db.Persons
                                          where p.Person_ID == sev.Songleader_ID
                                          select p;
                    List <Person> SongLeaderResults = SongLeaderQuery.ToList();
                    Songleaders.AddRange(SongLeaderResults);
                }
            }
            return(Songleaders.Distinct().ToList());
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Query the database for a service
        /// </summary>
        /// <param name="datetime"></param>
        /// <returns>Service object matching <datetime></returns>
        public Service getService(DateTime datetime)
        {
            Service service;

            using (var db = new WSOApp()) {
                var tempServiceQuery = from s in db.Services
                                       where s.Svc_DateTime == datetime
                                       select s;
                List <Service> results = tempServiceQuery.ToList();
                if (results.Count > 0)
                {
                    service = results[0];
                }
                else
                {
                    service = null;
                }
            }

            return(service);
        }
Ejemplo n.º 5
0
        public bool addEvent(int serviceid, int seqNum, int?eventType)
        {
            using (var db = new WSOApp())
            {
                ServiceEvent sEvent = new ServiceEvent
                {
                    Service_ID   = serviceid,
                    Seq_Num      = seqNum,
                    EventType_ID = eventType,
                    Notes        = null,
                    Confirmed    = 'N',
                    Person_ID    = null,
                    Ensemble_ID  = null,
                    Song_ID      = null
                };

                db.ServiceEvents.Add(sEvent);

                db.SaveChanges();
            }

            return(true);
        }