public ActionResult Edit(MeetingAttendee meetingAttendee, string returnController, string returnAction, int actionId)
        {
            MeetingAttendee newMeetingAttendee = Db.MeetingAttendees.Find(meetingAttendee.MeetingAttendeeId);

            if (!IsAccess(newMeetingAttendee, returnController, returnAction))
            {
                return RedirectToAccessDenied();
            }

            if (ModelState.IsValid)
            {
                newMeetingAttendee.Note = meetingAttendee.Note;

                Db.Entry(newMeetingAttendee).State = EntityState.Modified;
                Db.SaveChanges();
                return RedirectToAction(returnAction, returnController, new { id = newMeetingAttendee.MeetingId });
            }

            ViewBag.ReturnController = returnController;
            ViewBag.ReturnAction = returnAction;
            ViewBag.ActionId = actionId;

            MeetingAttendeeEdit meetingAttendeeEdit = MeetingAttendeeEdit.GetModelView(meetingAttendee);

            return View(meetingAttendeeEdit);
        }
        public static MeetingAttendeeDetails GetModelView(MeetingAttendee meetingAttendee)
        {
            if (meetingAttendee == null)
                return null;

            var meetingAttendeeDetails = new MeetingAttendeeDetails(meetingAttendee);
            return meetingAttendeeDetails;
        }
 public MeetingAttendeeDetails(MeetingAttendee meetingAttendee)
 {
     Attendee = PeopleContactDetails.GetModelView(meetingAttendee.Attendee);
     AttendeeId = meetingAttendee.AttendeeId;
     UserAttendee = UserProfileDetails.GetModelView(meetingAttendee.UserAttendee);
     BankAccountHistoryNote = meetingAttendee.BankAccountHistoryNote;
     Note = meetingAttendee.Note;
 }
        private bool IsAccess(MeetingAttendee meetingAttendee, string returnController, string returnAction)
        {
            if (meetingAttendee == null)
            {
                return false;
            }

            if (!IsAdmin && meetingAttendee.Meeting.OrganizerId != UserId && meetingAttendee.Meeting.SecondaryOrganizerId != UserId)
            {
                return false;
            }

            return !String.IsNullOrEmpty(returnController) && !String.IsNullOrEmpty(returnAction);
        }
        private static void SignOrReserve(DefaultContext db, int meetingId, int attendeeId, int userAttendeeId, int registrarId)
        {
            Meeting meeting = MeetingCache.GetDetail(db, meetingId);
            if (meeting == null)
                throw new Exception(ValidationResource.Meeting_CannotFindMeeting_ErrorMessage);

            if (meeting.MeetingAttendees.Count >= meeting.Capacity)
                throw new Exception(ValidationResource.Meeting_CapacityOverloaded_ErrorMessage);

            DateTime currentDateTime = DateTime.Now;
            string maxReservationDate = GetMaxReservationDate(currentDateTime);

            var meetingAttendee = new MeetingAttendee
            {
                MeetingId = meetingId,
                RegistrarId = registrarId,
                MeetingAttendeeType = meeting.Price.GetValueOrDefault() == 0 ? MeetingAttendeeType.Registred : MeetingAttendeeType.Reserved,
                Reserved = currentDateTime,
                Registered = meeting.Price.GetValueOrDefault() == 0 ? currentDateTime : new DateTime?(),
            };

            string meetingDetail = MeetingCommon.GetMeetingDetail(meeting);
            string textBody;

            if (attendeeId != 0)
            {
                PeopleContact peopleContact = PeopleContactCache.GetDetail(db, attendeeId);
                if (peopleContact == null)
                    throw new Exception(ValidationResource.Meeting_CannotFindDbAttendee_ErrorMessage);

                if (!String.IsNullOrEmpty(peopleContact.LyonessId) && meeting.MeetingAttendees.Any(ma =>
                    ma.AttendeeId > 0 && !String.IsNullOrEmpty(ma.Attendee.LyonessId) && ma.Attendee.LyonessId.Equals(peopleContact.LyonessId) ||
                    ma.UserAttendeeId > 0 && ma.UserAttendee.LyonessId.Equals(peopleContact.LyonessId)))
                    throw new Exception(ValidationResource.Meeting_CannotAddDuplicateLyonessId_ErrorMessage);

                meetingAttendee.AttendeeId = attendeeId;
                meetingAttendee.BonusLyonessId = peopleContact.LyonessId;

                db.MeetingAttendees.Add(meetingAttendee);

                try
                {
                    db.SaveChanges();
                }
                catch (Exception e)
                {
                    Logger.SetLog(e);
                    throw new Exception(ValidationResource.Global_DbCommunicationFailed_ErrorMessage);
                }

                if (meeting.Price.GetValueOrDefault() == 0)
                {
                    if (!String.IsNullOrEmpty(peopleContact.Email1))
                    {
                        textBody = String.Format(MailResource.MeetingController_Registered_TextBody, meeting.Title, meetingDetail);
                        Mail.SendEmail(peopleContact.Email1, MailResource.MeetingController_Registered_Subject, textBody, true, true);
                    }

                    textBody = String.Format(MailResource.MeetingController_OwnerRegisteredContact_TextBody, peopleContact.FullName, meeting.Title, meetingDetail);
                    Mail.SendEmail(peopleContact.Registrar.Email1, MailResource.MeetingController_Registered_Subject, textBody, true, true);
                }
                else
                {
                    string paymentInfo = MeetingCommon.GetPaymentInfo(db, meeting, peopleContact.LyonessId);
                    if (!String.IsNullOrEmpty(peopleContact.Email1))
                    {
                        textBody = String.Format(MailResource.MeetingController_Signed_TextBody, meeting.Title, maxReservationDate, meetingDetail, paymentInfo);
                        Mail.SendEmail(peopleContact.Email1, MailResource.MeetingController_Signed_Subject, textBody, true, true);
                    }

                    textBody = String.Format(MailResource.MeetingController_OwnerSignedContact_TextBody, peopleContact.FullName, meeting.Title, maxReservationDate, meetingDetail, paymentInfo);
                    Mail.SendEmail(peopleContact.Registrar.Email1, MailResource.MeetingController_Signed_Subject, textBody, true, true);
                }
            }
            else
            {
                UserProfile userProfile = UserProfileCache.GetDetail(db, userAttendeeId);
                if (userProfile == null)
                    throw new Exception(ValidationResource.Meeting_CannotFindDbAttendee_ErrorMessage);

                if (meeting.MeetingAttendees.Any(ma =>
                    ma.AttendeeId > 0 && !String.IsNullOrEmpty(ma.Attendee.LyonessId) && ma.Attendee.LyonessId.Equals(userProfile.LyonessId) ||
                    ma.UserAttendeeId > 0 && ma.UserAttendee.LyonessId.Equals(userProfile.LyonessId)))
                    throw new Exception(ValidationResource.Meeting_CannotAddDuplicateLyonessId_ErrorMessage);

                meetingAttendee.UserAttendeeId = userAttendeeId;
                meetingAttendee.BonusLyonessId = userProfile.LyonessId;

                db.MeetingAttendees.Add(meetingAttendee);

                try
                {
                    db.SaveChanges();
                }
                catch (Exception e)
                {
                    Logger.SetLog(e);
                    throw new Exception(ValidationResource.Global_DbCommunicationFailed_ErrorMessage);
                }

                if (meeting.Price.GetValueOrDefault() == 0)
                {
                    textBody = String.Format(MailResource.MeetingController_Registered_TextBody, meeting.Title, meetingDetail);
                    Mail.SendEmail(userProfile.Email1, MailResource.MeetingController_Registered_Subject, textBody, true, true);
                }
                else
                {
                    string paymentInfo = MeetingCommon.GetPaymentInfo(db, meeting, userProfile.LyonessId);
                    textBody = String.Format(MailResource.MeetingController_Signed_TextBody, meeting.Title, maxReservationDate, meetingDetail, paymentInfo);
                    Mail.SendEmail(userProfile.Email1, MailResource.MeetingController_Signed_Subject, textBody, true, true);
                }
            }
        }
Exemple #6
0
        private static bool RegisterAttendee(DefaultContext db, MeetingAttendee[] meetingAttendees, string bankAccountHistoryLyonessId, string bankAccountHistoryNote, Meeting meeting, int paidAmount, DateTime currentDateTime, bool isSecondBankAccount, ref int freeCapacity)
        {
            int meetingPrice = isSecondBankAccount ? meeting.SecondPrice.GetValueOrDefault() : meeting.Price.GetValueOrDefault();
            string maxReservationDate = MeetingAttendeeCache.GetMaxReservationDate(currentDateTime);

            // Registrace nebo akumulace nižší platby přihlášeného uživatele
            IEnumerable<MeetingAttendee> userMeetingAttendees = meetingAttendees.Where(ma => ma.UserAttendeeId.HasValue);
            MeetingAttendee meetingAttendee = userMeetingAttendees.FirstOrDefault(ua => ua.UserAttendee.LyonessId == bankAccountHistoryLyonessId);
            if (meetingAttendee != null)
            {
                if (meetingAttendee.Registered.HasValue)
                    return false;

                int totalPaidAmount = (isSecondBankAccount ? meetingAttendee.SecondPaidAmount : meetingAttendee.PaidAmount) + paidAmount;
                string totalBankAccountHistoryNote = String.IsNullOrEmpty(meetingAttendee.BankAccountHistoryNote)
                                                         ? bankAccountHistoryNote
                                                         : String.Format("{0}\n\n{1}", bankAccountHistoryNote, meetingAttendee.BankAccountHistoryNote);

                if (isSecondBankAccount)
                {
                    meetingAttendee.SecondPaidAmount = totalPaidAmount;
                }
                else
                {
                    meetingAttendee.PaidAmount = totalPaidAmount;
                }

                meetingAttendee.Reserved = currentDateTime;
                meetingAttendee.BankAccountHistoryNote = totalBankAccountHistoryNote;

                string meetingDetail = MeetingCommon.GetMeetingDetail(meeting);
                string paymentInfo = MeetingCommon.GetPaymentInfo(db, meeting, bankAccountHistoryLyonessId);
                string textBody;
                if (totalPaidAmount < meetingPrice)
                {
                    textBody = String.Format(MailResource.MeetingController_PaymentIsLow_TextBody, meeting.Title, meetingDetail, paymentInfo, totalPaidAmount);
                    Mail.SendEmail(meetingAttendee.UserAttendee.Email1, MailResource.MeetingController_PaymentIsLow_Subject, textBody, true, true);

                    textBody = String.Format(MailResource.MeetingController_OrganizerPaymentIsLow_TextBody, meetingAttendee.UserAttendee.FullName, meeting.Title, meetingDetail, paymentInfo, totalPaidAmount);
                    Mail.SendEmail(meeting.Organizer.Email1, MailResource.MeetingController_PaymentIsLow_Subject, textBody, true, true);

                    if (meeting.SecondaryOrganizerId.HasValue)
                    {
                        Mail.SendEmail(meeting.SecondaryOrganizer.Email1, MailResource.MeetingController_PaymentIsLow_Subject, textBody, true, true);
                    }
                }
                else if (totalPaidAmount > meetingPrice)
                {
                    meetingAttendee.MeetingAttendeeType = MeetingAttendeeType.Registred;
                    meetingAttendee.Registered = currentDateTime;

                    textBody = String.Format(MailResource.MeetingController_PaymentIsHigh_TextBody, meeting.Title, meetingDetail, paymentInfo, totalPaidAmount);
                    Mail.SendEmail(meetingAttendee.UserAttendee.Email1, MailResource.MeetingController_PaymentIsHigh_Subject, textBody, true, true);

                    textBody = String.Format(MailResource.MeetingController_Registered_TextBody, meeting.Title, meetingDetail);
                    Mail.SendEmail(meetingAttendee.UserAttendee.Email1, MailResource.MeetingController_Registered_Subject, textBody, true, true);

                    textBody = String.Format(MailResource.MeetingController_OrganizerPaymentIsHigh_TextBody, meetingAttendee.UserAttendee.FullName, meeting.Title, meetingDetail, paymentInfo, totalPaidAmount);
                    Mail.SendEmail(meeting.Organizer.Email1, MailResource.MeetingController_PaymentIsHigh_Subject, textBody, true, true);

                    if (meeting.SecondaryOrganizerId.HasValue)
                    {
                        Mail.SendEmail(meeting.SecondaryOrganizer.Email1, MailResource.MeetingController_PaymentIsHigh_Subject, textBody, true, true);
                    }
                }
                else
                {
                    meetingAttendee.MeetingAttendeeType = MeetingAttendeeType.Registred;
                    meetingAttendee.Registered = currentDateTime;

                    textBody = String.Format(MailResource.MeetingController_Registered_TextBody, meeting.Title, meetingDetail);
                    Mail.SendEmail(meetingAttendee.UserAttendee.Email1, MailResource.MeetingController_Registered_Subject, textBody, true, true);
                }

                return true;
            }

            // Registrace nebo akumulace nižší platby přihlášeného kontaktu
            var peopleContactMeetingAttendees = meetingAttendees.Where(ma => ma.AttendeeId.HasValue);
            meetingAttendee = peopleContactMeetingAttendees.FirstOrDefault(a => a.Attendee.LyonessId == bankAccountHistoryLyonessId);
            if (meetingAttendee != null)
            {
                if (meetingAttendee.Registered.HasValue)
                    return false;

                int totalPaidAmount = (isSecondBankAccount ? meetingAttendee.SecondPaidAmount : meetingAttendee.PaidAmount) + paidAmount;
                string totalBankAccountHistoryNote = String.IsNullOrEmpty(meetingAttendee.BankAccountHistoryNote)
                                                         ? bankAccountHistoryNote
                                                         : String.Format("{0}\n\n{1}", bankAccountHistoryNote, meetingAttendee.BankAccountHistoryNote);

                if (isSecondBankAccount)
                {
                    meetingAttendee.SecondPaidAmount = totalPaidAmount;
                }
                else
                {
                    meetingAttendee.PaidAmount = totalPaidAmount;
                }

                meetingAttendee.Reserved = currentDateTime;
                meetingAttendee.BankAccountHistoryNote = totalBankAccountHistoryNote;

                string meetingDetail = MeetingCommon.GetMeetingDetail(meeting);
                string paymentInfo = MeetingCommon.GetPaymentInfo(db, meeting, bankAccountHistoryLyonessId);
                string textBody;
                if (totalPaidAmount < meetingPrice)
                {
                    if (!String.IsNullOrEmpty(meetingAttendee.Attendee.Email1))
                    {
                        textBody = String.Format(MailResource.MeetingController_PaymentIsLow_TextBody, meeting.Title, meetingDetail, paymentInfo, totalPaidAmount);
                        Mail.SendEmail(meetingAttendee.Attendee.Email1, MailResource.MeetingController_PaymentIsLow_Subject, textBody, true, true);
                    }

                    textBody = String.Format(MailResource.MeetingController_OwnerPaymentIsLow_TextBody, meetingAttendee.Attendee.FullName, meeting.Title, meetingDetail, paymentInfo, totalPaidAmount);
                    Mail.SendEmail(meetingAttendee.Attendee.Registrar.Email1, MailResource.MeetingController_PaymentIsLow_Subject, textBody, true, true);

                    textBody = String.Format(MailResource.MeetingController_OrganizerContactPaymentIsLow_TextBody, meetingAttendee.Attendee.FullName, meeting.Title, meetingDetail, paymentInfo, totalPaidAmount);
                    Mail.SendEmail(meeting.Organizer.Email1, MailResource.MeetingController_PaymentIsLow_Subject, textBody, true, true);

                    if (meeting.SecondaryOrganizerId.HasValue)
                    {
                        Mail.SendEmail(meeting.SecondaryOrganizer.Email1, MailResource.MeetingController_PaymentIsLow_Subject, textBody, true, true);
                    }
                }
                else if (totalPaidAmount > meetingPrice)
                {
                    meetingAttendee.MeetingAttendeeType = MeetingAttendeeType.Registred;
                    meetingAttendee.Registered = currentDateTime;

                    if (!String.IsNullOrEmpty(meetingAttendee.Attendee.Email1))
                    {
                        textBody = String.Format(MailResource.MeetingController_PaymentIsHigh_TextBody, meeting.Title, meetingDetail, paymentInfo, totalPaidAmount);
                        Mail.SendEmail(meetingAttendee.Attendee.Email1, MailResource.MeetingController_PaymentIsHigh_Subject, textBody, true, true);

                        textBody = String.Format(MailResource.MeetingController_Registered_TextBody, meeting.Title, meetingDetail);
                        Mail.SendEmail(meetingAttendee.Attendee.Email1, MailResource.MeetingController_Registered_Subject, textBody, true, true);
                    }

                    textBody = String.Format(MailResource.MeetingController_OwnerPaymentIsHigh_TextBody, meetingAttendee.Attendee.FullName, meeting.Title, meetingDetail, paymentInfo, totalPaidAmount);
                    Mail.SendEmail(meetingAttendee.Attendee.Registrar.Email1, MailResource.MeetingController_PaymentIsHigh_Subject, textBody, true, true);

                    textBody = String.Format(MailResource.MeetingController_OwnerRegisteredContact_TextBody, meetingAttendee.Attendee.FullName, meeting.Title, meetingDetail);
                    Mail.SendEmail(meetingAttendee.Attendee.Registrar.Email1, MailResource.MeetingController_PaymentIsHigh_Subject, textBody, true, true);

                    textBody = String.Format(MailResource.MeetingController_OrganizerContactPaymentIsHigh_TextBody, meetingAttendee.Attendee.FullName, meeting.Title, meetingDetail, paymentInfo, totalPaidAmount);
                    Mail.SendEmail(meeting.Organizer.Email1, MailResource.MeetingController_PaymentIsHigh_Subject, textBody, true, true);

                    if (meeting.SecondaryOrganizerId.HasValue)
                    {
                        Mail.SendEmail(meeting.SecondaryOrganizer.Email1, MailResource.MeetingController_PaymentIsHigh_Subject, textBody, true, true);
                    }
                }
                else
                {
                    meetingAttendee.MeetingAttendeeType = MeetingAttendeeType.Registred;
                    meetingAttendee.Registered = currentDateTime;

                    if (!String.IsNullOrEmpty(meetingAttendee.Attendee.Email1))
                    {
                        textBody = String.Format(MailResource.MeetingController_Registered_TextBody, meeting.Title, meetingDetail);
                        Mail.SendEmail(meetingAttendee.Attendee.Email1, MailResource.MeetingController_Registered_Subject, textBody, true, true);
                    }

                    textBody = String.Format(MailResource.MeetingController_OwnerRegisteredContact_TextBody, meetingAttendee.Attendee.FullName, meeting.Title, meetingDetail);
                    Mail.SendEmail(meetingAttendee.Attendee.Registrar.Email1, MailResource.MeetingController_Registered_Subject, textBody, true, true);
                }

                return true;
            }

            if (freeCapacity <= 0)
                return false;

            meetingAttendee = new MeetingAttendee
            {
                MeetingId = meeting.MeetingId,
                MeetingAttendeeType = paidAmount >= meetingPrice ? MeetingAttendeeType.Registred : MeetingAttendeeType.Reserved,
                PaidAmount = isSecondBankAccount ? 0 : paidAmount,
                SecondPaidAmount = isSecondBankAccount ? paidAmount : 0,
                Reserved = currentDateTime,
                Registered = paidAmount >= meetingPrice ? currentDateTime : new DateTime?(),
                BonusLyonessId = bankAccountHistoryLyonessId,
                BankAccountHistoryNote = bankAccountHistoryNote
            };

            // Registrace nebo rezervace nepřihlášeného uživatele
            UserProfile[] userProfiles = db.UserProfiles.Where(up => up.LyonessId == bankAccountHistoryLyonessId).ToArray();
            if (userProfiles.Length == 1)
            {
                freeCapacity--;

                UserProfile userProfile = userProfiles[0];
                meetingAttendee.UserAttendeeId = userProfile.UserId;
                meetingAttendee.RegistrarId = userProfile.UserId;

                db.MeetingAttendees.Add(meetingAttendee);

                string meetingDetail = MeetingCommon.GetMeetingDetail(meeting);
                string paymentInfo = MeetingCommon.GetPaymentInfo(db, meeting, bankAccountHistoryLyonessId);
                string textBody;
                if (paidAmount < meetingPrice)
                {
                    textBody = String.Format(MailResource.MeetingController_Signed_TextBody, meeting.Title, maxReservationDate, meetingDetail, paymentInfo);
                    Mail.SendEmail(userProfile.Email1, MailResource.MeetingController_Signed_Subject, textBody, true, true);

                    textBody = String.Format(MailResource.MeetingController_PaymentIsLow_TextBody, meeting.Title, meetingDetail, paymentInfo, paidAmount);
                    Mail.SendEmail(userProfile.Email1, MailResource.MeetingController_PaymentIsLow_Subject, textBody, true, true);

                    textBody = String.Format(MailResource.MeetingController_OrganizerPaymentIsLow_TextBody, userProfile.FullName, meeting.Title, meetingDetail, paymentInfo, paidAmount);
                    Mail.SendEmail(meeting.Organizer.Email1, MailResource.MeetingController_PaymentIsLow_Subject, textBody, true, true);

                    if (meeting.SecondaryOrganizerId.HasValue)
                    {
                        Mail.SendEmail(meeting.SecondaryOrganizer.Email1, MailResource.MeetingController_PaymentIsLow_Subject, textBody, true, true);
                    }
                }
                else if (paidAmount > meetingPrice)
                {
                    textBody = String.Format(MailResource.MeetingController_PaymentIsHigh_TextBody, meeting.Title, meetingDetail, paymentInfo, paidAmount);
                    Mail.SendEmail(userProfile.Email1, MailResource.MeetingController_PaymentIsHigh_Subject, textBody, true, true);

                    textBody = String.Format(MailResource.MeetingController_Registered_TextBody, meeting.Title, meetingDetail);
                    Mail.SendEmail(userProfile.Email1, MailResource.MeetingController_Registered_Subject, textBody, true, true);

                    textBody = String.Format(MailResource.MeetingController_OrganizerPaymentIsHigh_TextBody, userProfile.FullName, meeting.Title, meetingDetail, paymentInfo, paidAmount);
                    Mail.SendEmail(meeting.Organizer.Email1, MailResource.MeetingController_PaymentIsHigh_Subject, textBody, true, true);

                    if (meeting.SecondaryOrganizerId.HasValue)
                    {
                        Mail.SendEmail(meeting.SecondaryOrganizer.Email1, MailResource.MeetingController_PaymentIsHigh_Subject, textBody, true, true);
                    }
                }
                else
                {
                    textBody = String.Format(MailResource.MeetingController_Registered_TextBody, meeting.Title, meetingDetail);
                    Mail.SendEmail(userProfile.Email1, MailResource.MeetingController_Registered_Subject, textBody, true, true);
                }

                return true;
            }

            // Registrace nebo rezervace nepřihlášeného kontaktu
            var peopleContacts = db.PeopleContacts.Where(pc => pc.LyonessId == bankAccountHistoryLyonessId).ToArray();
            if (peopleContacts.Length == 1)
            {
                freeCapacity--;

                PeopleContact peopleContact = peopleContacts[0];

                meetingAttendee.AttendeeId = peopleContact.PeopleContactId;
                meetingAttendee.RegistrarId = peopleContact.RegistrarId;

                db.MeetingAttendees.Add(meetingAttendee);

                string meetingDetail = MeetingCommon.GetMeetingDetail(meeting);
                string paymentInfo = MeetingCommon.GetPaymentInfo(db, meeting, bankAccountHistoryLyonessId);
                string textBody;
                if (paidAmount < meetingPrice)
                {
                    if (!String.IsNullOrEmpty(peopleContact.Email1))
                    {
                        textBody = String.Format(MailResource.MeetingController_Signed_TextBody, meeting.Title, maxReservationDate, meetingDetail, paymentInfo);
                        Mail.SendEmail(peopleContact.Email1, MailResource.MeetingController_Signed_Subject, textBody, true, true);

                        textBody = String.Format(MailResource.MeetingController_PaymentIsLow_TextBody, meeting.Title, meetingDetail, paymentInfo, paidAmount);
                        Mail.SendEmail(peopleContact.Email1, MailResource.MeetingController_PaymentIsLow_Subject, textBody, true, true);
                    }

                    textBody = String.Format(MailResource.MeetingController_OwnerSignedContact_TextBody, peopleContact.FullName, meeting.Title, maxReservationDate, meetingDetail, paymentInfo);
                    Mail.SendEmail(peopleContact.Registrar.Email1, MailResource.MeetingController_Signed_Subject, textBody, true, true);

                    textBody = String.Format(MailResource.MeetingController_OwnerPaymentIsLow_TextBody, peopleContact.FullName, meeting.Title, meetingDetail, paymentInfo, paidAmount);
                    Mail.SendEmail(peopleContact.Registrar.Email1, MailResource.MeetingController_PaymentIsLow_Subject, textBody, true, true);

                    textBody = String.Format(MailResource.MeetingController_OrganizerContactPaymentIsLow_TextBody, peopleContact.FullName, meeting.Title, meetingDetail, paymentInfo, paidAmount);
                    Mail.SendEmail(meeting.Organizer.Email1, MailResource.MeetingController_PaymentIsLow_Subject, textBody, true, true);

                    if (meeting.SecondaryOrganizerId.HasValue)
                    {
                        Mail.SendEmail(meeting.SecondaryOrganizer.Email1, MailResource.MeetingController_PaymentIsLow_Subject, textBody, true, true);
                    }
                }
                else if (paidAmount > meetingPrice)
                {
                    if (!String.IsNullOrEmpty(peopleContact.Email1))
                    {
                        textBody = String.Format(MailResource.MeetingController_PaymentIsHigh_TextBody, meeting.Title, meetingDetail, paymentInfo, paidAmount);
                        Mail.SendEmail(peopleContact.Email1, MailResource.MeetingController_PaymentIsHigh_Subject, textBody, true, true);

                        textBody = String.Format(MailResource.MeetingController_Registered_TextBody, meeting.Title, meetingDetail);
                        Mail.SendEmail(peopleContact.Email1, MailResource.MeetingController_Registered_Subject, textBody, true, true);
                    }

                    textBody = String.Format(MailResource.MeetingController_OwnerPaymentIsHigh_TextBody, peopleContact.FullName, meeting.Title, meetingDetail, paymentInfo, paidAmount);
                    Mail.SendEmail(peopleContact.Registrar.Email1, MailResource.MeetingController_PaymentIsHigh_Subject, textBody, true, true);

                    textBody = String.Format(MailResource.MeetingController_OwnerRegisteredContact_TextBody, peopleContact.FullName, meeting.Title, meetingDetail);
                    Mail.SendEmail(peopleContact.Registrar.Email1, MailResource.MeetingController_PaymentIsHigh_Subject, textBody, true, true);

                    textBody = String.Format(MailResource.MeetingController_OrganizerContactPaymentIsHigh_TextBody, peopleContact.FullName, meeting.Title, meetingDetail, paymentInfo, paidAmount);
                    Mail.SendEmail(meeting.Organizer.Email1, MailResource.MeetingController_PaymentIsHigh_Subject, textBody, true, true);

                    if (meeting.SecondaryOrganizerId.HasValue)
                    {
                        Mail.SendEmail(meeting.SecondaryOrganizer.Email1, MailResource.MeetingController_PaymentIsHigh_Subject, textBody, true, true);
                    }
                }
                else
                {
                    if (!String.IsNullOrEmpty(peopleContact.Email1))
                    {
                        textBody = String.Format(MailResource.MeetingController_Registered_TextBody, meeting.Title, meetingDetail);
                        Mail.SendEmail(peopleContact.Email1, MailResource.MeetingController_Registered_Subject, textBody, true, true);
                    }

                    textBody = String.Format(MailResource.MeetingController_OwnerRegisteredContact_TextBody, peopleContact.FullName, meeting.Title, meetingDetail);
                    Mail.SendEmail(peopleContact.Registrar.Email1, MailResource.MeetingController_PaymentIsHigh_Subject, textBody, true, true);
                }

                return true;
            }

            return false;
        }
        public static MeetingAttendeeEdit GetModelView(MeetingAttendee meetingAttendee)
        {
            if (meetingAttendee == null)
                return null;

            var meetingAttendeeEdit = new MeetingAttendeeEdit(meetingAttendee);
            return meetingAttendeeEdit;
        }