Esempio n. 1
0
        public List <EventCustomerRegistrationViewData> GetEventCustomerRegistrationViewData(long eventId, EventCustomerFilterMode eventCustomerFilterMode)
        {
            switch (eventCustomerFilterMode)
            {
            case EventCustomerFilterMode.Actual:
            case EventCustomerFilterMode.Cash:
            case EventCustomerFilterMode.Check:
            case EventCustomerFilterMode.ECheck:
            case EventCustomerFilterMode.CreditCard:
            case EventCustomerFilterMode.NoShow:
            case EventCustomerFilterMode.Paid:
            case EventCustomerFilterMode.Registered:
            case EventCustomerFilterMode.UnPaid:
            case EventCustomerFilterMode.UnPaidNoShowExcluded:
            case EventCustomerFilterMode.LeftWithoutScreening:
                return(_eventCustomerRegistrationViewDataRepository.GetEventCustomerOrdersForEvent(eventCustomerFilterMode, eventId));

            case EventCustomerFilterMode.Filled:
                return(_eventCustomerRegistrationViewDataRepository.GetEventCustomerOrdersForEvent(eventId));

            case EventCustomerFilterMode.All:
            {
                var unBookedAppointments = _slotService.GetSlots(eventId, AppointmentStatus.Free);

                var blockedAppointments = _slotService.GetSlots(eventId, AppointmentStatus.Blocked);

                var unBookedEventCustomerRegistrationViewData = _eventCustomerRegistrationViewDataFactory.Create(unBookedAppointments, AppointmentSlotStatus.Open);
                var blockedEventCustomerRegistrationViewData  = _eventCustomerRegistrationViewDataFactory.Create(blockedAppointments, AppointmentSlotStatus.Blocked);
                var bookedEventCustomerRegistrationViewData   = _eventCustomerRegistrationViewDataRepository.GetEventCustomerOrdersForEvent(eventId);
                bookedEventCustomerRegistrationViewData = bookedEventCustomerRegistrationViewData.Concat(unBookedEventCustomerRegistrationViewData).ToList();
                bookedEventCustomerRegistrationViewData = bookedEventCustomerRegistrationViewData.Concat(blockedEventCustomerRegistrationViewData).ToList();
                return(bookedEventCustomerRegistrationViewData.OrderBy(ec => ec.AppointmentStartTime).ToList());
            }

            case EventCustomerFilterMode.Open:
            {
                var unBookedAppointments = _slotService.GetSlots(eventId, AppointmentStatus.Free);
                return(_eventCustomerRegistrationViewDataFactory.Create(unBookedAppointments, AppointmentSlotStatus.Open));
            }

            case EventCustomerFilterMode.Blocked:
            {
                var blockedAppointments = _slotService.GetSlots(eventId, AppointmentStatus.Blocked);
                return(_eventCustomerRegistrationViewDataFactory.Create(blockedAppointments, AppointmentSlotStatus.Blocked));
            }
            }
            return(null);
        }
        public OnSiteRegistrationEditModel SetEventAndPackageDetail(OnSiteRegistrationEditModel model, long eventId, Roles role)
        {
            if (model == null)
            {
                model = new OnSiteRegistrationEditModel();
            }

            var theEvent = _eventRepository.GetById(eventId);

            model.EventId   = theEvent.Id;
            model.EventDate = theEvent.EventDate;
            model.EventName = theEvent.Name;

            var eventPackages = _eventPackageRepository.GetPackagesForEventByRole(eventId, (long)role);

            var parentRole = (Roles)GetParentRoleIdByRoleId((long)role);

            var enableAlaCarte = Convert.ToBoolean(_configurationRepository.GetConfigurationValue(ConfigurationSettingName.EnableAlaCarte));

            if (enableAlaCarte)
            {
                if (role == Roles.Customer || parentRole == Roles.Customer)
                {
                    enableAlaCarte = theEvent.EnableAlaCarteOnline;
                }
                else if (role == Roles.CallCenterRep || role == Roles.CallCenterManager || parentRole == Roles.CallCenterRep || parentRole == Roles.CallCenterManager)
                {
                    enableAlaCarte = theEvent.EnableAlaCarteCallCenter;
                }
                else if (role == Roles.Technician || parentRole == Roles.Technician)
                {
                    enableAlaCarte = theEvent.EnableAlaCarteTechnician;
                }
                else if (!(theEvent.EnableAlaCarteOnline || theEvent.EnableAlaCarteCallCenter || theEvent.EnableAlaCarteTechnician))
                {
                    enableAlaCarte = false;
                }
            }
            var eventTests = enableAlaCarte ? _eventTestRepository.GetTestsForEventByRole(eventId, (long)role) : null;

            eventPackages = eventPackages != null?eventPackages.OrderByDescending(d => d.Price) : null;

            eventTests = eventTests != null?eventTests.OrderByDescending(d => d.Price) : null;

            model.AllEventPackages = Mapper.Map <IEnumerable <EventPackage>, IEnumerable <EventPackageOrderItemViewModel> >(eventPackages);
            model.AllEventTests    = Mapper.Map <IEnumerable <EventTest>, IEnumerable <EventTestOrderItemViewModel> >(eventTests);

            model.Appointments = _slotService.GetSlots(model.EventId, AppointmentStatus.Free);

            return(model);
        }
Esempio n. 3
0
        public ActionResult AvailableSlots(long eventId, DateTime fromTime, DateTime toTime, int screeningTime, int numberOfSlotstoShow, long packageId, IEnumerable <long> testIds, IEnumerable <long> bookedSlotIds = null)
        {
            if (testIds != null && testIds.Any() && screeningTime > 0)
            {
                var eventTests = _eventTestRepository.GetByEventAndTestIds(eventId, testIds);
                //testIds = eventTests.Where(et => et.Test.ScreeningTime > 0).Select(et => et.TestId).ToArray();

                testIds = eventTests.Select(et => et.TestId).ToArray();
            }

            IEnumerable <EventSchedulingSlot> bookedSlots = null;

            if (!bookedSlotIds.IsNullOrEmpty())
            {
                bookedSlots = _eventSchedulingSlotRepository.GetbyIds(bookedSlotIds);
            }

            screeningTime = _eventSchedulingSlotService.GetScreeningTime(testIds, eventId, packageId);

            var model = _eventSchedulingSlotService.GetSlots(eventId, fromTime, toTime, screeningTime, numberOfSlotstoShow, packageId, testIds, bookedSlots);

            return(PartialView(model));
        }
Esempio n. 4
0
        public MassRegistrationEditModel GetRegistrationEditModel(DataRow row, IEnumerable <State> states, IEnumerable <Country> countries, long eventId, List <long> selectedAppointmentIds)
        {
            var registrationEditModel = new MassRegistrationEditModel();

            registrationEditModel.FirstName = GetRowValue(row, "FirstName");
            registrationEditModel.LastName  = GetRowValue(row, "LastName");
            registrationEditModel.Email     = GetRowValue(row, "Email");

            registrationEditModel.Address = new AddressEditModel();
            registrationEditModel.Address.StreetAddressLine1 = GetRowValue(row, "Address");
            registrationEditModel.Address.StreetAddressLine2 = GetRowValue(row, "Suite");
            registrationEditModel.Address.City = GetRowValue(row, "City");

            registrationEditModel.Address.StateId =
                states.Where(s => s.Name == GetRowValue(row, "State")).Select(s => s.Id).FirstOrDefault();

            registrationEditModel.Address.CountryId =
                countries.Where(c => c.Name == GetRowValue(row, "Country")).Select(c => c.Id).FirstOrDefault();

            registrationEditModel.Address.ZipCode = GetRowValue(row, "Zip");

            var packages     = _eventPackageRepository.GetPackagesForEvent(eventId);
            var appointments = _slotService.GetSlots(eventId, AppointmentStatus.Free).ToList();

            appointments.RemoveAll(a => selectedAppointmentIds.Contains(a.Id));

            registrationEditModel.PackageId = packages.Where(p => p.Package.Name == GetRowValue(row, "Package")).Select(p => p.PackageId).FirstOrDefault();

            var appointmentString = GetRowValue(row, "AppointmentTime");

            registrationEditModel.AppointmentId = string.IsNullOrEmpty(appointmentString) ? 0 : appointments.Where(ap => ap.StartTime.ToShortTimeString() == Convert.ToDateTime((string)appointmentString).ToShortTimeString()).Select(ap => ap.Id).FirstOrDefault();

            if (registrationEditModel.AppointmentId > 0)
            {
                selectedAppointmentIds.Add(registrationEditModel.AppointmentId);
            }

            var      dateString = GetRowValue(row, "DOB");
            DateTime date;

            if (DateTime.TryParse(dateString, out date))
            {
                registrationEditModel.DateOfBirth = date;
            }

            registrationEditModel.HomeNumber = PhoneNumber.Create(GetRowValue(row, "PhoneNumber"), PhoneNumberType.Home);
            try
            {
                registrationEditModel.EmployeeId = GetRowValue(row, "EmployeeId");
            }
            catch
            { }


            try
            {
                registrationEditModel.InsuranceId = GetRowValue(row, "MemberId");
            }
            catch
            { }

            try
            {
                registrationEditModel.InsuranceId = GetRowValue(row, "InsuranceId");
            }
            catch
            { }

            try
            {
                var ssn = GetRowValue(row, "SSN");
                if (!string.IsNullOrEmpty(ssn))
                {
                    var length       = ssn.Length;
                    var appendString = "";
                    for (int i = 0; i < 9 - length; i++)
                    {
                        appendString += "X";
                    }
                    registrationEditModel.Ssn = appendString + ssn;
                }
            }
            catch
            { }

            registrationEditModel.SendNotification = true;
            registrationEditModel.AddFreeShipping  = true;
            return(registrationEditModel);
        }
Esempio n. 5
0
 public IEnumerable <EventSchedulingSlot> GetAppointmentSlots(long eventId)
 {
     return(_eventSchedulingSlotService.GetSlots(eventId, AppointmentStatus.Free));
 }