예제 #1
0
        public MeetingBusinessInfoDetail(Meeting meeting, DefaultContext db, int userId, bool isAdmin)
            : base(meeting, db, userId, isAdmin)
        {
            if (meeting == null || meeting.MeetingType != MeetingType.Lgs)
                return;

            City = meeting.City;
            AddressLine1 = meeting.AddressLine1;
            MeetingType = MeetingType.Lgs;
            MeetingKind = MeetingKind.Public;
            Date = meeting.Started.Date;
            StartTime = meeting.Started.ToString("HH:mm");
            FinishTime = meeting.Finished.ToString("HH:mm");

            var attendees = new List<MeetingDetailAttendee>();
            foreach (MeetingAttendee meetingAttendee in meeting.MeetingAttendees.Where(ma => ma.AttendeeId.HasValue || ma.UserAttendeeId.HasValue))
            {
                MeetingDetailAttendee attendee;
                if (meetingAttendee.AttendeeId.HasValue)
                {
                    bool showContactAcronym = ShowContactAcronym(db, userId, meetingAttendee.Attendee.RegistrarId);
                    attendee = new MeetingDetailAttendee
                                   {
                                       MeetingAttendeeId = meetingAttendee.MeetingAttendeeId,
                                       FirstName = showContactAcronym
                                                       ? meetingAttendee.Attendee.FirstNameAcronym
                                                       : meetingAttendee.Attendee.FirstName,
                                       LastName = showContactAcronym
                                                      ? meetingAttendee.Attendee.LastNameAcronym
                                                      : meetingAttendee.Attendee.LastName,
                                       City = meetingAttendee.Attendee.CityIndexView,
                                       LyonessId = meetingAttendee.Attendee.LyonessId,
                                       Leader = meetingAttendee.Attendee.Registrar.FullNameWithoutLyonessId,
                                       AccessUnsign =
                                           isAdmin || meeting.OrganizerId == userId ||
                                           meeting.SecondaryOrganizerId == userId ||
                                           meetingAttendee.Attendee.RegistrarId == userId
                                   };
                }
                else
                {
                    attendee = new MeetingDetailAttendee
                    {
                        MeetingAttendeeId = meetingAttendee.MeetingAttendeeId,
                        FirstName = meetingAttendee.UserAttendee.FirstName,
                        LastName = meetingAttendee.UserAttendee.LastName,
                        City = meetingAttendee.UserAttendee.CityIndexView,
                        LyonessId = meetingAttendee.UserAttendee.LyonessId,
                        Leader = meetingAttendee.UserAttendee.Registrar == null
                         ? NullDisplayText
                         : meetingAttendee.UserAttendee.Registrar.FullNameWithoutLyonessId,
                        AccessUnsign = isAdmin || meeting.OrganizerId == userId || meeting.SecondaryOrganizerId == userId || meetingAttendee.UserAttendeeId == userId
                    };
                }

                attendees.Add(attendee);
            }

            MeetingAttendees = attendees.ToArray();
        }
예제 #2
0
        public static MeetingDetailAttendee[] ProcessSorting(MeetingDetailAttendee[] meetingDetailAttendees, string sortOrder)
        {
            MeetingDetailAttendee[] sortedMeetingDetailAttendees;
            switch (sortOrder)
            {
                case LastNameDescSortOrder:
                    sortedMeetingDetailAttendees = meetingDetailAttendees.OrderByDescending(m => m.LastName).ToArray();
                    break;

                case LyonessIdDescSortOrder:
                    sortedMeetingDetailAttendees = meetingDetailAttendees.OrderByDescending(m => m.LyonessId).ToArray();
                    break;

                case LyonessIdAscSortOrder:
                    sortedMeetingDetailAttendees = meetingDetailAttendees.OrderBy(m => m.LyonessId).ToArray();
                    break;

                default:
                    sortedMeetingDetailAttendees = meetingDetailAttendees.OrderBy(tt => tt.LastName).ToArray();
                    break;
            }

            return sortedMeetingDetailAttendees;
        }
예제 #3
0
        public MeetingSkoleniDavidaKotaskaDetail(Meeting meeting, DefaultContext db, int userId, bool isAdmin)
            : base(meeting, db, userId, isAdmin)
        {
            if (meeting == null || meeting.MeetingType != MeetingType.SkoleniDavidaKotaska)
                return;

            City = meeting.City;
            AddressLine1 = meeting.AddressLine1;
            MeetingType = MeetingType.SkoleniDavidaKotaska;
            MeetingKind = MeetingKind.Public;
            Title = meeting.Title;
            Date = meeting.Started.Date;
            StartTime = meeting.Started.ToString("HH:mm");
            FinishTime = meeting.Finished.ToString("HH:mm");

            Price = meeting.Price.HasValue && meeting.BankAccount != null ? String.Format("{0:N0} {1}", meeting.Price.GetValueOrDefault(), meeting.BankAccount.CurrencyType) : NullDisplayText;
            SecondPrice = meeting.SecondPrice.HasValue && meeting.SecondBankAccount != null ? String.Format("{0:N0} {1}", meeting.SecondPrice.GetValueOrDefault(), meeting.SecondBankAccount.CurrencyType) : NullDisplayText;
            RegisterDeadline = meeting.RegisterDeadline.GetValueOrDefault();
            AccountId = meeting.BankAccount != null ? meeting.BankAccount.AccountId : NullDisplayText;
            SecondAccountId = meeting.SecondBankAccount != null ? meeting.SecondBankAccount.AccountId : NullDisplayText;
            Ss = meeting.MeetingId;
            BringYourOwn = meeting.BringYourOwn;

            AccessSignUnsign &= DateTime.Now <= meeting.RegisterDeadline.GetValueOrDefault();

            int[] currentUserDownlineUserIds = UserProfileCache.GetDownlineUserIdsWithoutAdmins(db, userId) ?? new int[0];
            var attendees = new List<MeetingDetailAttendee>();
            foreach (MeetingAttendee meetingAttendee in meeting.MeetingAttendees.Where(ma => ma.AttendeeId.HasValue || ma.UserAttendeeId.HasValue))
            {
                var formattingClass = new StringBuilder();
                formattingClass.AppendFormat("{0} ", !meetingAttendee.Registered.HasValue ? MeetingAttendeeReservedClass : MeetingAttendeeRegisteredClass);
                formattingClass.Append(meetingAttendee.Reserved.GetValueOrDefault().Date == DateTime.MaxValue.Date ? MeetingAttendeeFreezedClass : String.Empty);

                string paidAmmount = String.Format("{0:N0} {1}", meetingAttendee.PaidAmount, meeting.BankAccount != null ? meeting.BankAccount.CurrencyType : default(CurrencyType));
                if (meeting.SecondBankAccountId != null)
                {
                    paidAmmount += String.Format(", {0:N0} {1}", meetingAttendee.SecondPaidAmount, meeting.SecondBankAccount.CurrencyType);
                }

                MeetingDetailAttendee attendee;
                if (meetingAttendee.AttendeeId.HasValue)
                {
                    attendee = new MeetingDetailAttendee
                    {
                        MeetingAttendeeId = meetingAttendee.MeetingAttendeeId,
                        FirstName = meetingAttendee.Attendee.FirstName,
                        LastName = meetingAttendee.Attendee.LastName,
                        LyonessId = meetingAttendee.Attendee.LyonessId,
                        PaidAmmount = paidAmmount,
                        FormattingClass = formattingClass.ToString(),
                        City = meetingAttendee.Attendee.CityIndexView,
                        Leader = meetingAttendee.Attendee.Registrar.FullNameWithoutLyonessId,
                        AccessUnsign = isAdmin || meeting.OrganizerId == userId || meeting.SecondaryOrganizerId == userId || !meetingAttendee.Registered.HasValue && meetingAttendee.Reserved.GetValueOrDefault().Date != DateTime.MaxValue.Date && meetingAttendee.Attendee.RegistrarId == userId,
                        AccessLocking = !meetingAttendee.Registered.HasValue && (isAdmin || meeting.OrganizerId == userId || meeting.SecondaryOrganizerId == userId),
                        IsReservationLocked = meetingAttendee.Reserved.GetValueOrDefault().Date == DateTime.MaxValue.Date
                    };
                }
                else
                {
                    attendee = new MeetingDetailAttendee
                    {
                        MeetingAttendeeId = meetingAttendee.MeetingAttendeeId,
                        FirstName = meetingAttendee.UserAttendee.FirstName,
                        LastName = meetingAttendee.UserAttendee.LastName,
                        LyonessId = meetingAttendee.UserAttendee.LyonessId,
                        PaidAmmount = paidAmmount,
                        FormattingClass = formattingClass.ToString(),
                        City = meetingAttendee.UserAttendee.CityIndexView,
                        Leader = meetingAttendee.UserAttendee.Registrar == null
                         ? NullDisplayText
                         : meetingAttendee.UserAttendee.Registrar.FullNameWithoutLyonessId,
                        AccessUnsign = isAdmin || meeting.OrganizerId == userId || meeting.SecondaryOrganizerId == userId || !meetingAttendee.Registered.HasValue && meetingAttendee.Reserved.GetValueOrDefault().Date != DateTime.MaxValue.Date && (meetingAttendee.UserAttendeeId == userId || currentUserDownlineUserIds.Contains(meetingAttendee.UserAttendeeId.GetValueOrDefault())),
                        AccessLocking = !meetingAttendee.Registered.HasValue && (isAdmin || meeting.OrganizerId == userId || meeting.SecondaryOrganizerId == userId),
                        IsReservationLocked = meetingAttendee.Reserved.GetValueOrDefault().Date == DateTime.MaxValue.Date
                    };
                }

                attendees.Add(attendee);
            }

            MeetingAttendees = attendees.ToArray();
        }