Beispiel #1
0
        public IEnumerable <string> Get(string location)
        {
            BsfEntities db       = new BsfEntities();
            string      today    = DateTime.Now.ToShortDateString();
            var         students = (from att in db.Attedences
                                    where att.Location == location && att.CheckInDate == today
                                    select att).Select(att => att.Student).ToList();

            return(students);
        }
Beispiel #2
0
        public IEnumerable <string> Get(string student, int year)
        {
            BsfEntities db        = new BsfEntities();
            DateTime    yearStart = DateTime.Parse(string.Format("{0}/9/1", year));
            DateTime    yearEnd   = DateTime.Parse(string.Format("{0}/9/1", year + 1));
            var         students  = (from att in db.Attedences
                                     where att.Student == student &&
                                     att.CheckInTimeStamp > yearStart &&
                                     att.CheckInTimeStamp < yearEnd
                                     select att).Select(att => att.CheckInDate).ToList();

            return(students);
        }
        public IEnumerable <string> Get(int year, string location)
        {
            BsfEntities db        = new BsfEntities();
            DateTime    yearStart = DateTime.Parse(string.Format("{0}/9/1", year));
            DateTime    yearEnd   = DateTime.Parse(string.Format("{0}/9/1", year + 1));
            var         roster    = (from att in db.Attedences
                                     where att.Location == location &&
                                     att.CheckInTimeStamp > yearStart &&
                                     att.CheckInTimeStamp < yearEnd
                                     select att).Select(att => att.Student).Distinct().ToList();

            return(roster);
        }
        public void Put(string student, string location)
        {
            BsfEntities db = new BsfEntities();

            var today = DateTime.Today.ToShortDateString();

            var checkin = (from a in db.Attedences
                           where a.Student == student && a.CheckInDate == today
                           select a).ToList();

            if (checkin.Count == 0)
            {
                Attedence att = new Attedence
                {
                    Student          = student,
                    Location         = location,
                    CheckInDate      = DateTime.Now.ToShortDateString(),
                    CheckInTimeStamp = DateTime.Now
                };

                db.Attedences.Add(att);
                db.SaveChanges();
            }
        }