private bool EventValidation()
        {
            if (PackageRegistrationValidators.EventValidation(Customer.CustomerId, EventId.Value))
            {
                IEventCustomerRegistrationViewDataRepository eventCustomerRegistrationViewDataRepository =
                    new EventCustomerRegistrationViewDataRepository();

                var data =
                    eventCustomerRegistrationViewDataRepository.GetEventCustomerOrders(Customer.CustomerId, EventId.Value);

                //check dulicate event registration
                if (data != null)
                {
                    var packageAndTest = data.PackageName;
                    packageAndTest = string.IsNullOrEmpty(packageAndTest)
                                         ? data.AdditinalTest
                                         : packageAndTest +
                                     (string.IsNullOrEmpty(data.AdditinalTest)
                                                ? string.Empty
                                                : ", " + data.AdditinalTest);

                    var message = HttpUtility.HtmlEncode(Customer.Name.FirstName) + " " + HttpUtility.HtmlEncode(Customer.Name.MiddleName) + " " +
                                  HttpUtility.HtmlEncode(Customer.Name.LastName) + " is already registered for this event (" +
                                  HttpUtility.HtmlEncode(data.EventName) + " ) at " +
                                  HttpUtility.HtmlEncode(data.EventDate.ToString("dddd dd MMMM yyyy")) + " " +
                                  HttpUtility.HtmlEncode(data.AppointmentStartTime.ToString("hh:mm tt")) + " for the " +
                                  HttpUtility.HtmlEncode(packageAndTest) +
                                  ". Duplicate registrations for the same customer are not allowed.";
                    SetAndDisplayErrorMessage(message);
                    return(false);
                }
            }
            return(true);
        }
        private bool EventValidation()
        {
            if (PackageRegistrationValidators.EventValidation(Customer.CustomerId, Convert.ToInt64(Request.QueryString["ID"])))
            {
                IEventCustomerRegistrationViewDataRepository eventCustomerRegistrationViewDataRepository =
                    new EventCustomerRegistrationViewDataRepository();

                var data =
                    eventCustomerRegistrationViewDataRepository.GetEventCustomerOrders(Customer.CustomerId, Convert.ToInt64(Request.QueryString["ID"]));

                //check dulicate event registration
                if (data != null)
                {
                    var packageAndTest = data.PackageName;
                    packageAndTest = string.IsNullOrEmpty(packageAndTest)
                                         ? data.AdditinalTest
                                         : packageAndTest +
                                     (string.IsNullOrEmpty(data.AdditinalTest)
                                                ? string.Empty
                                                : ", " + data.AdditinalTest);

                    var message = Customer.Name.FirstName + " " + Customer.Name.MiddleName + " " +
                                  Customer.Name.LastName + " is already registered for this event (" +
                                  data.EventName + " ) at " +
                                  data.EventDate.ToString("dddd dd MMMM yyyy") + " " +
                                  data.AppointmentStartTime.ToString("hh:mm tt") + " for the " +
                                  packageAndTest +
                                  ". Duplicate registrations for the same customer are not allowed. " +
                                  "<span class='gobacklnklogin1_pw'><a id='aChooseAnEvent' href='../Events/Default.aspx?z=" +
                                  Session["z"] + "&m=" + Session["m"] +
                                  "'>Go back and choose another event</a></span>";
                    MaintainPageDataAfterValidationFailure(message);
                }
                return(false);
            }
            return(true);
        }
Beispiel #3
0
    protected void lnkSelectEvent_Click(object sender, EventArgs e)
    {
        var  lnkEvent   = (ImageButton)sender;
        long eventId    = Convert.ToInt64(lnkEvent.CommandArgument);
        long customerId = IoC.Resolve <ISessionContext>().UserSession.CurrentOrganizationRole.OrganizationRoleUserId;

        if (PackageRegistrationValidators.EventValidation(customerId, eventId))
        {
            IEventCustomerRegistrationViewDataRepository eventCustomerRegistrationViewDataRepository =
                new EventCustomerRegistrationViewDataRepository();

            var data =
                eventCustomerRegistrationViewDataRepository.GetEventCustomerOrders(customerId,
                                                                                   Convert.ToInt64(
                                                                                       lnkEvent.CommandArgument));
            if (data != null)
            {
                var packageAndTest = data.PackageName;
                packageAndTest = string.IsNullOrEmpty(packageAndTest)
                                     ? data.AdditinalTest
                                     : packageAndTest +
                                 (string.IsNullOrEmpty(data.AdditinalTest)
                                            ? string.Empty
                                            : ", " + data.AdditinalTest);

                divErrorMsg.InnerHtml = "You are already registered for this event (" + data.EventName +
                                        " ) at " + data.EventDate.ToString("dddd dd MMMM yyyy") + " " +
                                        data.AppointmentStartTime.ToString("hh:mm tt") + " for the " +
                                        packageAndTest +
                                        ". Duplicate registrations, on one event, for the same customer are not allowed.";
                divErrorMsg.Visible = true;
                return;
            }
        }

        var service = IoC.Resolve <IRefundRequestService>();
        var result  = service.CheckifCancelAppointmentRequestExistsforaCustomer(eventId, customerId);

        if (result)
        {
            var settings = IoC.Resolve <ISettings>();
            divErrorMsg.InnerHtml = "Your appointment has been cancelled for this event, the cancellation request is in process. Re-registration is not allowed unless the request is resolved. Please call on this number " + settings.CustomerPortalPhoneTollFree;
            divErrorMsg.Visible   = true;
            return;
        }

        if (string.IsNullOrEmpty(GuId) || RegistrationFlow == null)
        {
            GuId = Guid.NewGuid().ToString();
            var registrationFlow = new RegistrationFlowModel
            {
                GuId    = GuId,
                EventId = eventId
            };
            RegistrationFlow = registrationFlow;
        }
        else
        {
            RegistrationFlow.EventId = eventId;
        }

        if (RegistrationFlow.AppointmentSlotIds != null && RegistrationFlow.AppointmentSlotIds.Count() > 0)
        {
            var eventSchedulingSlotRepository = IoC.Resolve <IEventSchedulingSlotRepository>();
            var slots = eventSchedulingSlotRepository.GetbyIds(RegistrationFlow.AppointmentSlotIds);
            if (slots.Where(s => s.EventId != eventId).Any())
            {
                eventSchedulingSlotRepository.ReleaseSlots(RegistrationFlow.AppointmentSlotIds);
                RegistrationFlow.AppointmentSlotIds = null;
            }
        }


        Response.RedirectUser("UpdateEventCustomerProfile.aspx?guid=" + RegistrationFlow.GuId);
    }