Exemple #1
0
        public ActionResult AgendaCheckins(int id)
        {
            // when viewing a specific agenda, show the Activities (if any) and the total Attendees for the Agenda
            AgendaDisplayObject retVal = DBHelper.GetAgendaWithDataByID(id);

            retVal.ActivityFullList = new List <ActivityDisplayObject>();
            foreach (Activity act in retVal.ActivityList)
            {
                ActivityDisplayObject toAdd = new ActivityDisplayObject();

                toAdd.Activity        = act;
                toAdd.CurrentCheckins = ATAPS_Pile.GetActivityAttendeeCurrentByActivityID(act.ID, id);
                if (toAdd.CurrentCheckins == null)
                {
                    toAdd.CurrentCheckins = new List <AttendeeLastCheck>();
                    toAdd.CheckedInCount  = 0;
                }
                else
                {
                    toAdd.CheckedInCount = toAdd.CurrentCheckins.Count();
                }
                retVal.ActivityFullList.Add(toAdd);
            }

            return(View(retVal));
        }
Exemple #2
0
        //[ValidateAntiForgeryToken]
        public ActionResult UploadConfirmed(HttpPostedFileBase file, int?filter)
        {
            if (filter == null)
            {
                return(HttpNotFound());
            }
            ViewBag.FilterID = filter;
            if (file.ContentLength > 0)
            {
                List <Attendee> attendeeList = ATAPS_Pile.ParseAttendeeXLS(file, filter ?? default(int));
                // save the names
                foreach (Attendee item in attendeeList)
                {
                    // try to pull the Attendee by ParticipantID and EventID
                    Attendee already = db.Attendees.Where(o => o.ParticipantID == item.ParticipantID && o.EventID == filter).FirstOrDefault();
                    if (already != null)
                    {
                        if (already.ID != 0)
                        {
                            already.ActivityListNames = item.ActivityListNames;
                            already.AttPicture        = item.AttPicture;
                            already.Email             = item.Email;
                            already.EventID           = item.EventID;
                            already.Filename          = item.Filename;
                            already.FirstName         = item.FirstName;
                            already.IsPrimary         = item.IsPrimary;
                            already.LastName          = item.LastName;
                            already.Mobile            = item.Mobile;
                            already.ParticipantID     = item.ParticipantID;
                            already.ParticipantType   = item.ParticipantType;
                            already.PhoneticFirst     = item.PhoneticFirst;
                            already.PhoneticLast      = item.PhoneticLast;
                            already.PreferredFirst    = item.PreferredFirst;
                            already.PreferredLast     = item.PreferredLast;
                            already.PrimaryID         = item.PrimaryID;
                            already.RfID              = item.RfID;
                            already.RSVPStatus        = item.RSVPStatus;
                            already.Title             = item.Title;
                            already.Department        = item.Department;
                            already.ActivityListNames = item.ActivityListNames;

                            db.Entry(already).State = EntityState.Modified;
                            db.SaveChanges();
                        }
                    }
                    else
                    {
                        db.Attendees.Add(item);
                    }
                }
                db.SaveChanges();
            }

            return(RedirectToAction("Index", new { filter = filter }));
        }
        public IHttpActionResult TagAttendeeInByID(int rfid, int agendaID, int?activityID, string dir)
        {
            Attendee retVal = new Attendee();

            retVal.LastName = "None Found";

            int actID = -1;

            if (activityID > 0)
            {
                actID = activityID ?? default(int);
            }

            // find attendee by RFID
            Attendee found   = db.Attendees.Where(o => o.RfID == rfid.ToString()).FirstOrDefault();
            dynamic  retJSON = new ExpandoObject();

            retJSON.Attendee         = retVal;
            retJSON.DuplicateCheckin = false;
            // if found, insert a TagIn for this Attendee and return the object
            if (found != null)
            {
                retVal = found;
                // check to see if this is a duplicate check
                AttendeeLastCheck confirm = db.AttendeeLastChecks.Where(o => o.AttendeeID == found.ID).OrderByDescending(o => o.LastUpdate).FirstOrDefault();
                if (confirm != null)
                {
                    if (confirm.LastAgenda == agendaID && confirm.LastActivity == actID && confirm.CheckDir == dir)
                    {
                        // this is a duplicate
                        retJSON.DuplicateCheckin = true;
                    }
                }

                if (retJSON.DuplicateCheckin == false)
                {
                    AttendeeLastCheck tagIn = new AttendeeLastCheck();
                    tagIn.AgendaID     = agendaID;
                    tagIn.AttendeeID   = found.ID;
                    tagIn.LastActivity = activityID;
                    tagIn.LastAgenda   = agendaID;
                    tagIn.LastUpdate   = DateTime.Now;
                    tagIn.CheckDir     = dir;
                    db.AttendeeLastChecks.Add(tagIn);
                    db.SaveChanges();
                }
                retJSON.Attendee = found;
            }

            retJSON.CheckedInCount = ATAPS_Pile.GetActivityAttendeeCurrentCountByActivityID(actID, agendaID);
            return(Ok(retJSON));
        }
        // GET:  Registration/Busses
        public ActionResult Busses()
        {
            Parm checkinParm = db.Parms.Where(o => o.ParmName == "RegistrationAgendaID").FirstOrDefault();

            if (checkinParm == null)
            {
                bool good = ATAPS_Pile.CreateRegistrationAgenda();
            }

            checkinParm = db.Parms.Where(o => o.ParmName == "RegistrationAgendaID").FirstOrDefault();
            AgendaDisplayObject regAgenda = DBHelper.GetAgendaWithDataByID(int.Parse(checkinParm.ParmValue));

            return(View(regAgenda));
        }
        public IHttpActionResult GetActivityByID(int filter)
        {
            ActivityDisplayObject retVal = new ActivityDisplayObject();

            if (filter > 0)
            {
                retVal.Activity       = db.Activities.Where(o => o.ID == filter).FirstOrDefault();
                retVal.ActivityDetail = db.ActivityDetails.Where(o => o.ActivityID == filter).FirstOrDefault();
                retVal.ActivityType   = db.ActivityTypes.Where(o => o.ID == retVal.Activity.ActivityTypeID).FirstOrDefault();

                int accessEventID = int.Parse(ConfigurationManager.AppSettings["ActiveEvent"]);
                retVal.CheckedInCount = ATAPS_Pile.GetActivityAttendeeCurrentCountByActivityID(retVal.Activity.ID, retVal.Activity.AgendaID);
            }
            return(Ok(retVal));
        }
Exemple #6
0
        public ActionResult ActivityDetails(int filter, int id)
        {
            ViewBag.FilterID = filter;
            ActivityDisplayObject retVal = new ActivityDisplayObject();

            retVal.Activity        = db.Activities.Where(o => o.ID == id).FirstOrDefault();
            retVal.CurrentCheckins = ATAPS_Pile.GetActivityAttendeeCurrentByActivityID(id, retVal.Activity.AgendaID);
            retVal.AttendeeList    = new List <Attendee>();
            foreach (AttendeeLastCheck check in retVal.CurrentCheckins)
            {
                retVal.AttendeeList.Add(db.Attendees.Where(o => o.ID == check.AttendeeID).FirstOrDefault());
            }
            retVal.CheckedInCount = retVal.CurrentCheckins.Count();

            return(View(retVal));
        }
        public IHttpActionResult GetAttendeesFiltered(int id, string sortOrder, string searchString, int?pageNum)
        {
            FilteredAttendeeListWithPages retVal = new FilteredAttendeeListWithPages();
            List <Attendee> attendees            = new List <Attendee>();
            int             pageSize             = 25;

            attendees = ATAPS_Pile.GetSortedAttendeesWithFilter(id, sortOrder, searchString, pageNum);

            if (pageNum == null)
            {
                pageNum = 1;
            }
            decimal pages = 1 + (attendees.Count() / pageSize);

            if (pageNum * pageSize > attendees.Count())
            {
                int modCheck = attendees.Count() % pageSize; // get remainder
                int lastPage = (int)Math.Ceiling(pages);     // last page
                attendees = attendees.Skip((lastPage - 1) * pageSize).Take(modCheck).ToList();
            }
            else
            {
                int startAt = (pageNum ?? default(int)) - 1;
                attendees = attendees.Skip(startAt * pageSize).Take(pageSize).ToList();
            }
            // finally populate pagination tags


            //decimal pages = 1 + (attendees.Count() / pageSize);
            int upperLim = (int)pages;
            int lowerLim = 1;
            int curPage  = pageNum ?? default(int);

            retVal.CurPage    = curPage;
            retVal.TotalPages = upperLim;
            retVal.LowerLim   = lowerLim;
            retVal.UpperLim   = upperLim;

            retVal.Pages = ATAPS_Pile.GetAttendeePageList(lowerLim, upperLim, curPage, attendees.Count());

            retVal.Attendees = attendees;
            return(Ok(retVal));
        }
        // GET: EventRecords/Create
        public ActionResult Create(int?filter)
        {
            if (filter == null)
            {
                return(HttpNotFound());
            }
            ViewBag.FilterID = filter;
            RFIDDBEntities db = new RFIDDBEntities();

            ViewBag.PossibleClients = db.Clients.Where(o => o.ID == filter).ToList();
            EventRecord eventRec = new EventRecord();

            eventRec.EventCode = "Invalid Client ID";
            if (ViewBag.PossibleClients.Count > 0)
            {
                eventRec.EventCode = ATAPS_Pile.GenerateEventShortcode(ViewBag.PossibleClients[0].ClientName);
            }

            return(View(eventRec));
        }
        public ActionResult BulkCheckin(string searchString, string busNum)
        {
            ViewBag.BusNumber = busNum;

            int?pageNum  = 1;
            int pageSize = 25;

            ViewBag.PageSize = pageSize;
            // here we pull the query based on the sort order and direction
            List <Attendee> attendees = new List <Attendee>();

            string sortOrder = "name";

            ViewBag.NameSortParm  = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.QueueSortParm = sortOrder == "WinnerQueueOrder" ? "wqo_desc" : "WinnerQueueOrder";
            ViewBag.PartSortParm  = sortOrder == "ParticipantType" ? "ptype_desc" : "ParticipantType";
            ViewBag.RSVPSortParm  = sortOrder == "RSVPStatus" ? "rsvp_desc" : "RSVPStatus";
            ViewBag.RFIDSortParm  = sortOrder == "RFID" ? "rfid_desc" : "RFID";
            ViewBag.LastSort      = sortOrder;
            if (sortOrder == "")
            {
                ViewBag.LastSort = "Name";
            }

            // find max queue order and add one
            List <Attendee> all_attendees = new List <Attendee>();

            all_attendees = db.Attendees.OrderBy(x => x.WinnerQueueOrder).ToList();
            int?last_queue_position = all_attendees[all_attendees.Count - 1].WinnerQueueOrder;
            int next_queue_position = (last_queue_position == null) ? 1 : (int)(last_queue_position + 1);

            // get attendees matching the search string
            int eventId = int.Parse(ConfigurationManager.AppSettings["ActiveEvent"]);

            attendees = ATAPS_Pile.GetSortedAttendeesWithFilter(eventId, sortOrder, searchString, pageNum);

            if (pageNum == null)
            {
                pageNum = 1;
            }
            decimal pages = 1 + (attendees.Count() / pageSize);

            if (pageNum * pageSize > attendees.Count())
            {
                int modCheck = attendees.Count() % pageSize; // get remainder
                int lastPage = (int)Math.Ceiling(pages);     // last page
                attendees = attendees.Skip((lastPage - 1) * pageSize).Take(modCheck).ToList();
            }
            else
            {
                int startAt = (pageNum ?? default(int)) - 1;
                attendees = attendees.Skip(startAt * pageSize).Take(pageSize).ToList();
            }
            // finally populate pagination tags

            //decimal pages = 1 + (attendees.Count() / pageSize);
            int upperLim = (int)pages;
            int lowerLim = 1;
            int curPage  = pageNum ?? default(int);

            ViewBag.CurPage  = curPage;
            ViewBag.Pages    = upperLim;
            ViewBag.LowerLim = lowerLim;
            ViewBag.UpperLim = upperLim;

            List <int> pageList = ATAPS_Pile.GetAttendeePageList(lowerLim, upperLim, curPage, attendees.Count());

            ViewBag.PageList = pageList;

            return(View(attendees));
        }
Exemple #10
0
        // GET: Attendees/Scan
        public ActionResult Scan(int?filter, string sortOrder, string searchString, int?pageNum)
        {
            if (filter == null)
            {
                return(HttpNotFound());
            }
            ViewBag.FilterID = filter;

            int pageSize = 25;

            ViewBag.PageSize = pageSize;
            // here we pull the query based on the sort order and direction
            List <Attendee> attendees = new List <Attendee>();

            ViewBag.NameSortParm  = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.QueueSortParm = sortOrder == "WinnerQueueOrder" ? "wqo_desc" : "WinnerQueueOrder";
            ViewBag.PartSortParm  = sortOrder == "ParticipantType" ? "ptype_desc" : "ParticipantType";
            ViewBag.RSVPSortParm  = sortOrder == "RSVPStatus" ? "rsvp_desc" : "RSVPStatus";
            ViewBag.RFIDSortParm  = sortOrder == "RFID" ? "rfid_desc" : "RFID";
            ViewBag.LastSort      = sortOrder;
            if (sortOrder == "")
            {
                ViewBag.LastSort = "Name";
            }

            // find max queue order and add one
            List <Attendee> all_attendees = new List <Attendee>();

            all_attendees = db.Attendees.OrderBy(x => x.WinnerQueueOrder).ToList();
            int?last_queue_position = all_attendees[all_attendees.Count - 1].WinnerQueueOrder;
            int next_queue_position = (last_queue_position == null) ? 1 : (int)(last_queue_position + 1);

            // get attendees matching the search string
            attendees = ATAPS_Pile.GetSortedAttendeesWithFilter(filter, sortOrder, searchString, pageNum);

            // if only one result, queue it
            if (attendees.Count == 1)
            {
                // read this attendee
                int      id       = attendees[0].ID;
                Attendee attendee = db.Attendees.Where(o => o.ID == id).FirstOrDefault();

                // see if the attendee is already queued
                string conf;
                if (attendee.WinnerQueueOrder == null || Request["Confirmed"] == "yes")
                {
                    // set queue order and save changes
                    attendee.WinnerQueueOrder = next_queue_position;
                    db.SaveChanges();
                    conf = attendees[0].FirstName + " " + attendees[0].LastName + " is now queued at position " + next_queue_position + ".";
                }
                else
                {
                    conf = "conf," + filter + "," + searchString + "," + attendee.Filename;
                }

                // show form again
                return(RedirectToAction("Scan", new { filter = filter, sortOrder = conf }));
            }

            if (pageNum == null)
            {
                pageNum = 1;
            }
            decimal pages = 1 + (attendees.Count() / pageSize);

            if (pageNum * pageSize > attendees.Count())
            {
                int modCheck = attendees.Count() % pageSize; // get remainder
                int lastPage = (int)Math.Ceiling(pages);     // last page
                attendees = attendees.Skip((lastPage - 1) * pageSize).Take(modCheck).ToList();
            }
            else
            {
                int startAt = (pageNum ?? default(int)) - 1;
                attendees = attendees.Skip(startAt * pageSize).Take(pageSize).ToList();
            }
            // finally populate pagination tags


            //decimal pages = 1 + (attendees.Count() / pageSize);
            int upperLim = (int)pages;
            int lowerLim = 1;
            int curPage  = pageNum ?? default(int);

            ViewBag.CurPage  = curPage;
            ViewBag.Pages    = upperLim;
            ViewBag.LowerLim = lowerLim;
            ViewBag.UpperLim = upperLim;

            List <int> pageList = ATAPS_Pile.GetAttendeePageList(lowerLim, upperLim, curPage, attendees.Count());

            ViewBag.PageList = pageList;

            EventRecord eRec = db.EventRecords.Find(filter);

            ViewBag.EventName = eRec.EventName;
            //ModelState.Clear();
            return(View(attendees));
        }
Exemple #11
0
        // GET: Attendees
        public ActionResult Index(int?filter, string sortOrder, string searchString, int?pageNum)
        {
            if (filter == null)
            {
                return(HttpNotFound());
            }
            ViewBag.FilterID = filter;

            int pageSize = 25;

            ViewBag.PageSize = pageSize;
            // here we pull the query based on the sort order and direction
            List <Attendee> attendees = new List <Attendee>();

            ViewBag.NameSortParm  = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.QueueSortParm = sortOrder == "WinnerQueueOrder" ? "wqo_desc" : "WinnerQueueOrder";
            ViewBag.PartSortParm  = sortOrder == "ParticipantType" ? "ptype_desc" : "ParticipantType";
            ViewBag.RSVPSortParm  = sortOrder == "RSVPStatus" ? "rsvp_desc" : "RSVPStatus";
            ViewBag.RFIDSortParm  = sortOrder == "RFID" ? "rfid_desc" : "RFID";
            ViewBag.LastSort      = sortOrder;
            if (sortOrder == "")
            {
                ViewBag.LastSort = "Name";
            }

            attendees = ATAPS_Pile.GetSortedAttendeesWithFilter(filter, sortOrder, searchString, pageNum);
            #region refactored in ATAPS_Pile

            //attendees = db.Attendees.Where(o => o.EventID == filter).ToList();

            //if (!String.IsNullOrEmpty(searchString))
            //{
            //    attendees = attendees.Where(s => s.LastName.ToLower().Contains(searchString.ToLower())
            //                           || s.FirstName.ToLower().Contains(searchString.ToLower())
            //                           || s.RfID.ToLower().Contains(searchString.ToLower())).ToList();
            //}

            //ViewBag.CurSearch = searchString;

            //switch (sortOrder)
            //{
            //    case "name_desc":
            //        attendees = attendees.OrderByDescending(s => s.LastName).ToList();
            //        break;
            //    case "ParticipantType":
            //        attendees = attendees.OrderBy(s => s.ParticipantType).ToList();
            //        break;
            //    case "ptype_desc":
            //        attendees = attendees.OrderByDescending(s => s.ParticipantType).ToList();
            //        break;
            //    case "RSVPStatus":
            //        attendees = attendees.OrderBy(s => s.RSVPStatus).ToList();
            //        break;
            //    case "rsvp_desc":
            //        attendees = attendees.OrderByDescending(s => s.RSVPStatus).ToList();
            //        break;
            //    case "RFID":
            //        attendees = attendees.OrderBy(s => s.RfID).ToList();
            //        break;
            //    case "rfid_desc":
            //        attendees = attendees.OrderByDescending(s => s.RfID).ToList();
            //        break;
            //    default:
            //        attendees = attendees.OrderBy(s => s.LastName).ToList();
            //        break;
            //}

            //if (pageNum == null)
            //{
            //    ViewBag.PageNum = 1;
            //    pageNum = 1;
            //}
            //else
            //{
            //    ViewBag.PageNum = pageNum;
            //}
            //decimal pages = 1+(attendees.Count() / pageSize);
            //ViewBag.NumPages = Math.Ceiling(pages);
            //if (pageNum * pageSize > attendees.Count())
            //{
            //    int modCheck = attendees.Count() % pageSize; // get remainder
            //    int lastPage = (int)Math.Ceiling(pages); // last page
            //    ViewBag.PageNum = lastPage;
            //    attendees = attendees.Skip((lastPage - 1) * pageSize).Take(modCheck).ToList();
            //}
            //else
            //{
            //    int startAt = (pageNum ?? default(int)) - 1;
            //    attendees = attendees.Skip(startAt * pageSize).Take(pageSize).ToList();
            //}
            #endregion

            if (pageNum == null)
            {
                pageNum = 1;
            }
            decimal pages = 1 + (attendees.Count() / pageSize);
            int     temp  = 0;
            if (pageNum * pageSize > attendees.Count())
            {
                int modCheck = attendees.Count() % pageSize; // get remainder
                int lastPage = (int)Math.Ceiling(pages);     // last page
                attendees = attendees.Skip((lastPage - 1) * pageSize).Take(modCheck).ToList();
            }
            else
            {
                int startAt = (pageNum ?? default(int)) - 1;
                attendees = attendees.Skip(startAt * pageSize).Take(pageSize).ToList();
            }
            // finally populate pagination tags


            //decimal pages = 1 + (attendees.Count() / pageSize);
            int upperLim = (int)pages;
            int lowerLim = 1;
            int curPage  = pageNum ?? default(int);
            ViewBag.CurPage  = curPage;
            ViewBag.Pages    = upperLim;
            ViewBag.LowerLim = lowerLim;
            ViewBag.UpperLim = upperLim;

            List <int> pageList = ATAPS_Pile.GetAttendeePageList(lowerLim, upperLim, curPage, attendees.Count());

            ViewBag.PageList = pageList;

            EventRecord eRec = db.EventRecords.Find(filter);
            ViewBag.EventName = eRec.EventName;
            //ModelState.Clear();
            return(View(attendees));
        }
Exemple #12
0
        public ActionResult RFIDByName(int?filter, string sortOrder, string searchString, int?pageNum)
        {
            if (filter == null || filter == 0)
            {
                //List<EventDate> dateList = db.EventDates.ToList();
                return(HttpNotFound());
            }
            int accessEventID = int.Parse(ConfigurationManager.AppSettings["ActiveEvent"]);

            ViewBag.EventID     = accessEventID;
            ViewBag.EventDateID = filter;

            int pageSize = 25;

            ViewBag.PageSize = pageSize;
            // here we pull the query based on the sort order and direction
            List <Attendee> attendees = new List <Attendee>();

            ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.PartSortParm = sortOrder == "ParticipantType" ? "ptype_desc" : "ParticipantType";
            ViewBag.RSVPSortParm = sortOrder == "RSVPStatus" ? "rsvp_desc" : "RSVPStatus";
            ViewBag.RFIDSortParm = sortOrder == "RFID" ? "rfid_desc" : "RFID";
            ViewBag.LastSort     = sortOrder;
            if (sortOrder == "")
            {
                ViewBag.LastSort = "Name";
            }

            attendees = ATAPS_Pile.GetSortedAttendeesWithFilter(accessEventID, sortOrder, searchString, pageNum);
            if (pageNum == null)
            {
                pageNum = 1;
            }
            decimal pages = 1 + (attendees.Count() / pageSize);

            if (pageNum * pageSize > attendees.Count())
            {
                int modCheck = attendees.Count() % pageSize; // get remainder
                int lastPage = (int)Math.Ceiling(pages);     // last page
                attendees = attendees.Skip((lastPage - 1) * pageSize).Take(modCheck).ToList();
            }
            else
            {
                int startAt = (pageNum ?? default(int)) - 1;
                attendees = attendees.Skip(startAt * pageSize).Take(pageSize).ToList();
            }
            // finally populate pagination tags


            //decimal pages = 1 + (attendees.Count() / pageSize);
            int upperLim = (int)pages;
            int lowerLim = 1;
            int curPage  = pageNum ?? default(int);

            ViewBag.CurPage  = curPage;
            ViewBag.Pages    = upperLim;
            ViewBag.LowerLim = lowerLim;
            ViewBag.UpperLim = upperLim;

            List <int> pageList = ATAPS_Pile.GetAttendeePageList(lowerLim, upperLim, curPage, attendees.Count());

            ViewBag.PageList = pageList;

            EventRecord eRec = db.EventRecords.Find(accessEventID);

            ViewBag.EventName = eRec.EventName;
            return(View(attendees));
        }