public OrderedPair <List <Package>, List <Test> > GetPackagesAndTests(long eventId, long roleId) { IEventPackageRepository packageRepository = new EventPackageRepository(); var eventPackages = packageRepository.GetPackagesForEventByRole(eventId, roleId).OrderByDescending(p => p.Price); var packages = eventPackages.Select(ep => ep.Package).ToList(); IEventTestRepository eventTestRepository = new EventTestRepository(); var eventTests = eventTestRepository.GetTestsForEventByRole(eventId, roleId); var tests = eventTests.Select(et => et.Test).ToList(); var packagesAndTests = new OrderedPair <List <Package>, List <Test> >(packages, tests); return(packagesAndTests); }
protected void Page_Load(object sender, EventArgs e) { SetTitle(); if (!IsPostBack) { if (RegistrationFlow != null && RegistrationFlow.IsRetest) { RetestNo.Checked = false; RetestYes.Checked = true; } else { RetestNo.Checked = true; RetestYes.Checked = false; } if (RegistrationFlow != null && RegistrationFlow.SingleTestOverride) { SingleTestOverrideYes.Checked = true; SingleTestOverrideNo.Checked = false; } else { SingleTestOverrideYes.Checked = false; SingleTestOverrideNo.Checked = true; } if (Request.QueryString["EventID"] != null) { EventId = long.Parse(Request.QueryString["EventID"]); } if (EventId != 0) { // Hack: This is done if the user hits back button on payment page, to get back to select package page. if (SourceCodeId > 0 && !string.IsNullOrEmpty(SourceCode)) { txtCouponCode.Text = SourceCode; } } else { const string message = "Sorry, Event detail not found. <a href=\"RegCustomerSearchEvent.aspx\">Click here</a> to search event again "; DisplayErrorMessage(message); } //ItemCartControl.EventId = EventId; //ItemCartControl.RoleId = (long)Roles.Technician; //ItemCartControl.PackageId = PackageId; //ItemCartControl.TestIds = TestIds; } if (EventId > 0) { if (EventData != null) { EventType = EventData.EventType; var configurationSettingRepository = IoC.Resolve <IConfigurationSettingRepository>(); EnableAlaCarte = Convert.ToBoolean(configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.EnableAlaCarte)); if (EnableAlaCarte) { EnableAlaCarte = EventData.EnableAlaCarteTechnician; } } var eventCustomerQuestionAnswerService = IoC.Resolve <IEventCustomerQuestionAnswerService>(); hfQuestionAnsTestId.Value = eventCustomerQuestionAnswerService.GetQuestionAnswerTestIdString(CustomerId, EventId); IEventPackageRepository packageRepository = new EventPackageRepository(); var preApprovedPackageRepository = IoC.Resolve <IPreApprovedPackageRepository>(); if (AccountByEventId != null && AccountByEventId.AllowPreQualifiedTestOnly) { long preApprovedPackageId = preApprovedPackageRepository.CheckPreApprovedPackages(CustomerId); if (PackageId == 0 && preApprovedPackageId > 0 && (RegistrationFlow == null || !RegistrationFlow.SingleTestOverride) && (RegistrationFlow == null || string.IsNullOrEmpty(RegistrationFlow.DisqualifiedTest))) { var eventPackages = packageRepository.GetPackagesForEventByRole(EventId, (long)Roles.CallCenterRep); if (!eventPackages.IsNullOrEmpty()) { var preApprovedPackage = eventPackages.FirstOrDefault(x => x.PackageId == preApprovedPackageId); if (preApprovedPackage != null) { PackageId = preApprovedPackage.PackageId; TestIds = preApprovedPackage.Tests.Select(t => t.TestId).ToList(); } } } } if (RegistrationFlow != null && !string.IsNullOrWhiteSpace(RegistrationFlow.DisqualifiedTest) && string.IsNullOrWhiteSpace(hfDisqualifedTest.Value)) { hfDisqualifedTest.Value = RegistrationFlow.DisqualifiedTest; } if (RegistrationFlow != null && !string.IsNullOrWhiteSpace(RegistrationFlow.QuestionIdAnswerTestId) && string.IsNullOrWhiteSpace(hfQuestionAnsTestId.Value)) { hfQuestionAnsTestId.Value = RegistrationFlow.QuestionIdAnswerTestId; } /*if (!DisqualifiedTestIds.IsNullOrEmpty()) * { * TestIds = TestIds.Where(x => !DisqualifiedTestIds.Contains(x)).ToList(); * }*/ ItemCartControl.EventId = EventId; ItemCartControl.RoleId = (long)Roles.Technician; ItemCartControl.PackageId = PackageId; ItemCartControl.TestIds = TestIds; } ClientScript.RegisterStartupScript(typeof(string), "JsCode_WaitForPageLoad", " $('.package-list').toggle(); ", true); if (Request.Params["__EVENTTARGET"] == "NextButton" && Request.Params["__EVENTARGUMENT"] == "Click") { NextButtonClick(); } }
protected void Page_Load(object sender, EventArgs e) { RegistrationFlow.CanSaveConsentInfo = false; SetTitle(); bool defaultBasePackage = false; FillClinicialQuestionnaireDiv.Visible = false; ClinicalQuestionTemplateId = 0; IsClinicalQuestionaireFilled = false; if (EventId > 0) { if (EventData != null) { EventType = EventData.EventType; var configurationSettingRepository = IoC.Resolve <IConfigurationSettingRepository>(); EnableAlaCarte = Convert.ToBoolean(configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.EnableAlaCarte)); if (EnableAlaCarte) { EnableAlaCarte = EventData.EnableAlaCarteCallCenter; } } if (AccountByEventId != null) { if (AccountByEventId.AskClinicalQuestions && AccountByEventId.ClinicalQuestionTemplateId.HasValue) { FillClinicialQuestionnaireDiv.Visible = true; ClinicalQuestionTemplateId = AccountByEventId.ClinicalQuestionTemplateId.Value; GetRecommendationText(); } defaultBasePackage = AccountByEventId.DefaultSelectionBasePackage; // for penguin integartion var settings = IoC.Resolve <ISettings>(); QuestionnaireType questionnaireType = QuestionnaireType.None; if (AccountByEventId != null && AccountByEventId.IsHealthPlan && EventData != null) { var accountHraChatQuestionnaireHistoryServices = IoC.Resolve <IAccountHraChatQuestionnaireHistoryServices>(); questionnaireType = accountHraChatQuestionnaireHistoryServices.QuestionnaireTypeByAccountIdandEventDate(AccountByEventId.Id, EventData.EventDate); } if (questionnaireType == QuestionnaireType.HraQuestionnaire) { var userSession = IoC.Resolve <ISessionContext>().UserSession; var token = (Session.SessionID + "_" + userSession.UserId + "_" + userSession.CurrentOrganizationRole.RoleId + "_" + userSession.CurrentOrganizationRole.OrganizationId).Encrypt(); HraQuestionerAppUrlWithoutVisit = settings.HraQuestionerAppUrl + "?userToken=" + HttpUtility.UrlEncode(token) + "&customerId=" + CustomerId + "&orgName=" + settings.OrganizationNameForHraQuestioner + "&tag=" + AccountByEventId.Tag; HraQuestionerAppUrl = HraQuestionerAppUrlWithoutVisit + "&visitId=" + (RegistrationFlow.AwvVisitId.HasValue ? RegistrationFlow.AwvVisitId.Value : 0); ChatQuestionerAppUrl = string.Empty; } else if (questionnaireType == QuestionnaireType.ChatQuestionnaire) { ChatQuestionerAppUrl = settings.HraQuestionerAppUrl; HraQuestionerAppUrl = string.Empty; } } } if (!IsPostBack) { if (RegistrationFlow != null && RegistrationFlow.IsRetest) { RetestNo.Checked = false; RetestYes.Checked = true; } else { RetestNo.Checked = true; RetestYes.Checked = false; } if (RegistrationFlow != null && RegistrationFlow.SingleTestOverride) { SingleTestOverrideYes.Checked = true; SingleTestOverrideNo.Checked = false; } else { SingleTestOverrideYes.Checked = false; SingleTestOverrideNo.Checked = true; } if (EventId != 0) { // Hack: This is done if the user hits back button on payment page, to get back to select package page. if (SourceCodeId > 0 && !string.IsNullOrEmpty(SourceCode)) { txtCouponCode.Text = SourceCode; } else if (RegistrationFlow != null) { txtCouponCode.Text = RegistrationFlow.CallSourceCode; } hfEventID.Value = EventId.ToString(); var eventCustomerQuestionAnswerService = IoC.Resolve <IEventCustomerQuestionAnswerService>(); hfQuestionAnsTestId.Value = eventCustomerQuestionAnswerService.GetQuestionAnswerTestIdString(CustomerId, EventId); } else { const string message = "Sorry, Event detail not found. <a href=\"RegCustomerSearchEvent.aspx\">Click here</a> to search event again "; DisplayErrorMessage(message); } if (CurrentProspectCustomer != null && CurrentProspectCustomer.Id > 0 && CurrentProspectCustomer.SourceCodeId != null && CurrentProspectCustomer.SourceCodeId.Value > 0) { ISourceCodeRepository sourceCodeRepository = new SourceCodeRepository(); var sourceCode = sourceCodeRepository.GetSourceCodeById(CurrentProspectCustomer.SourceCodeId.Value); if (sourceCode != null) { txtCouponCode.Text = sourceCode.CouponCode; } } IEventPackageRepository packageRepository = new EventPackageRepository(); var preApprovedPackageRepository = IoC.Resolve <IPreApprovedPackageRepository>(); if (AccountByEventId != null && AccountByEventId.AllowPreQualifiedTestOnly) { long preApprovedPackageId = preApprovedPackageRepository.CheckPreApprovedPackages(CustomerId); if (PackageId == 0 && preApprovedPackageId > 0 && (RegistrationFlow == null || !RegistrationFlow.SingleTestOverride) && (RegistrationFlow == null || string.IsNullOrEmpty(RegistrationFlow.DisqualifiedTest))) { var eventPackages = packageRepository.GetPackagesForEventByRole(EventId, (long)Roles.CallCenterRep); if (!eventPackages.IsNullOrEmpty()) { var preApprovedPackage = eventPackages.FirstOrDefault(x => x.PackageId == preApprovedPackageId); if (preApprovedPackage != null) { PackageId = preApprovedPackage.PackageId; TestIds = preApprovedPackage.Tests.Select(t => t.TestId).ToList(); } } } } if (defaultBasePackage && PackageId == 0 && (RegistrationFlow == null || !RegistrationFlow.SingleTestOverride) && (RegistrationFlow == null || string.IsNullOrEmpty(RegistrationFlow.DisqualifiedTest))) { var eventPackages = packageRepository.GetPackagesForEventByRole(EventId, (long)Roles.CallCenterRep) .OrderBy(p => p.Price); if (!eventPackages.IsNullOrEmpty()) { var lowestPricePackage = eventPackages.First(); PackageId = lowestPricePackage.PackageId; TestIds = lowestPricePackage.Tests.Select(t => t.TestId).ToList(); } } if (RegistrationFlow != null && !string.IsNullOrWhiteSpace(RegistrationFlow.DisqualifiedTest) && string.IsNullOrWhiteSpace(hfDisqualifedTest.Value)) { hfDisqualifedTest.Value = RegistrationFlow.DisqualifiedTest; } if (RegistrationFlow != null && !string.IsNullOrWhiteSpace(RegistrationFlow.QuestionIdAnswerTestId) && string.IsNullOrWhiteSpace(hfQuestionAnsTestId.Value)) { hfQuestionAnsTestId.Value = RegistrationFlow.QuestionIdAnswerTestId; } /*if (!DisqualifiedTestIds.IsNullOrEmpty()) * { * TestIds = TestIds.Where(x => !DisqualifiedTestIds.Contains(x)).ToList(); * }*/ ItemCartControl.EventId = EventId; ItemCartControl.RoleId = (long)Roles.CallCenterRep; ItemCartControl.PackageId = PackageId; ItemCartControl.TestIds = TestIds; if (Request.QueryString["Call"] != null && Request.QueryString["Call"] == "No") { divCall.Style.Add(HtmlTextWriterStyle.Display, "none"); divCall.Style.Add(HtmlTextWriterStyle.Visibility, "hidden"); } else { var repository = new CallCenterCallRepository(); hfCallStartTime.Value = repository.GetCallStarttime(CallId); } if (Request.UrlReferrer != null) { ViewState["UrlReferer"] = Request.UrlReferrer.PathAndQuery; } } if (Request.Params["__EVENTTARGET"] == "NextButton" && Request.Params["__EVENTARGUMENT"] == "Click") { NextButtonClick(); } }