Example #1
0
        protected void ProcessUserSignUsign(Meeting meeting, DefaultContext db, int id, bool isAdmin, int userId, string searchString, string searchStringAccording, string sortOrder, string signedSortOrder, int pageNumber, int pageSize, int signedPageNumber)
        {
            if (!_availableForProcess)
                return;

            _availableForProcess = false;

            if (meeting.RegisterDeadline.GetValueOrDefault(DateTime.MaxValue) < DateTime.Now)
                return;

            IEnumerable<UserProfileIndex> userProfiles = isAdmin
                                                             ? UserProfileIndex.GetUserProfileIndexForAdmin(db, userId, searchString, searchStringAccording, sortOrder)
                                                             : UserProfileIndex.GetUserProfileIndex(db, userId, searchString, searchStringAccording, sortOrder);

            var attendees = new List<MeetingSignUnsignAttendee>();
            var signedAttendees = new List<MeetingSignUnsignAttendee>();
            foreach (UserProfileIndex userProfile in userProfiles)
            {
                bool signed = false;
                if (meeting.MeetingAttendees != null && meeting.MeetingAttendees.Any())
                {
                    signed = meeting.MeetingAttendees.Any(ma => ma.UserAttendeeId == userProfile.UserId);
                }

                if (!signed)
                {
                    var attendee = new MeetingSignUnsignAttendee
                    {
                        AttendeeId = userProfile.UserId,
                        Signed = false,
                        FirstName = userProfile.FirstName,
                        LastName = userProfile.LastName,
                        City = userProfile.City
                    };
                    attendees.Add(attendee);
                }
                else
                {
                    var signedAttendee = new MeetingSignUnsignAttendee
                    {
                        AttendeeId = userProfile.UserId,
                        Signed = true,
                        FirstName = userProfile.FirstName,
                        LastName = userProfile.LastName,
                        City = userProfile.City
                    };
                    signedAttendees.Add(signedAttendee);
                }
            }

            MeetingCache.ProcessSearchingAndSorting(ref attendees, ref signedAttendees, searchString, searchStringAccording, sortOrder, signedSortOrder);

            Attendees = attendees.ToPagedList(pageNumber, pageSize);
            SignedAttendees = signedAttendees.ToPagedList(signedPageNumber, pageSize);

            UserProfile user = UserProfileCache.GetDetail(db, userId);
            UserAttendee = new MeetingSignUnsignAttendee
            {
                AttendeeId = user.UserId,
                City = user.City,
                FirstName = user.FirstName,
                LastName = user.LastName,
                Signed = meeting.MeetingAttendees != null && meeting.MeetingAttendees.Any(ma => ma.UserAttendeeId == user.UserId)
            };

            _availableForProcess = true;
        }
Example #2
0
        protected void ProcessSignUsign(Meeting meeting, IQueryable<PeopleContact> peopleContacts, DefaultContext db, int id, bool isAdmin, int registrarId, string searchString, string searchStringAccording, string sortOrder, string signedSortOrder, int pageNumber, int pageSize, int signedPageNumber)
        {
            if (!_availableForProcess)
                return;

            _availableForProcess = false;

            if (meeting.RegisterDeadline.GetValueOrDefault(DateTime.MaxValue) < DateTime.Now)
                return;

            var attendees = new List<MeetingSignUnsignAttendee>();
            var signedAttendees = new List<MeetingSignUnsignAttendee>();
            foreach (PeopleContact peopleContact in peopleContacts)
            {
                bool signed = false;
                if (meeting.MeetingAttendees != null && meeting.MeetingAttendees.Any())
                {
                    signed = meeting.MeetingAttendees.Any(ma => ma.AttendeeId == peopleContact.PeopleContactId);
                }

                if (!signed)
                {
                    var attendee = new MeetingSignUnsignAttendee
                    {
                        AttendeeId = peopleContact.PeopleContactId,
                        Signed = false,
                        FirstName = peopleContact.FirstName,
                        LastName = peopleContact.LastName,
                        City = peopleContact.City
                    };
                    attendees.Add(attendee);
                }
                else
                {
                    var signedAttendee = new MeetingSignUnsignAttendee
                    {
                        AttendeeId = peopleContact.PeopleContactId,
                        Signed = true,
                        FirstName = peopleContact.FirstName,
                        LastName = peopleContact.LastName,
                        City = peopleContact.City
                    };
                    signedAttendees.Add(signedAttendee);
                }
            }

            MeetingCache.ProcessSearchingAndSorting(ref attendees, ref signedAttendees, searchString, searchStringAccording, sortOrder, signedSortOrder);

            Attendees = attendees.ToPagedList(pageNumber, pageSize);
            SignedAttendees = signedAttendees.ToPagedList(signedPageNumber, pageSize);

            UserProfile userProfile = UserProfileCache.GetDetail(db, registrarId);
            UserAttendee = new MeetingSignUnsignAttendee
            {
                AttendeeId = registrarId,
                City = userProfile.City,
                FirstName = userProfile.FirstName,
                LastName = userProfile.LastName,
                Signed = meeting.MeetingAttendees != null && meeting.MeetingAttendees.Any(ma => ma.UserAttendeeId == registrarId)
            };

            _availableForProcess = true;
        }