public void GetAllShippingOptions() { List <ShippingOption> allShippingOptions = _shippingOptionRepository.GetAllShippingOptions(); Assert.IsNotNull(allShippingOptions, "Null collection of Pods returned."); Assert.IsNotEmpty(allShippingOptions, "Empty collection of pods returned."); }
public SourceCodeEditModel Get(SourceCodeEditModel model) { model.AllSignUpModes = SignUpMode.CallCenter.GetNameValuePairs().Select(dt => new OrderedPair <int, string>(dt.FirstValue, dt.SecondValue)); model.AllPackages = _packageRepository.GetAll().Select(m => new OrderedPair <long, string>(m.Id, m.Name)).OrderBy(m => m.SecondValue).ToArray(); model.AllTests = ((ITestRepository)_testRepository).GetAll().Select(m => new OrderedPair <long, string>(m.Id, m.Name)).OrderBy(m => m.SecondValue).ToArray(); var shippingOptions = _shippingOptionRepository.GetAllShippingOptions(); model.AllShippingOptions = shippingOptions != null?shippingOptions.Select(so => new OrderedPair <long, string>(so.Id, so.Name)).OrderBy(m => m.SecondValue).ToArray() : new OrderedPair <long, string> [0]; var products = _electronicProductRepository.GetAllProducts(); model.AllProducts = products != null?products.Select(po => new OrderedPair <long, string>(po.Id, po.Name)).OrderBy(m => m.SecondValue).ToArray() : new OrderedPair <long, string> [0]; return(model); }
public ListModelBase <HourlyAppointmentBookedModel, HourlyAppointmentsBookedListModelFilter> GetHourlyAppointmentsBooked(int pageNumber, int pageSize, ModelFilterBase filter, out int totalRecords) { var customFilter = filter as HourlyAppointmentsBookedListModelFilter; customFilter = customFilter ?? new HourlyAppointmentsBookedListModelFilter(); var appFilter = new AppointmentsBookedListModelFilter { AccountId = customFilter.AccountId, FromDate = customFilter.FromDate, ToDate = customFilter.ToDate, ShowCustomersWithAppointment = customFilter.ShowCustomersWithAppointment, IsHealthPlanEvent = true }; var eventCustomers = _eventCustomerRepository.GetEventCustomersbyRegisterationDate(pageNumber, pageSize, appFilter, out totalRecords); if (eventCustomers.IsNullOrEmpty()) { return(null); } var appointments = _appointmentRepository.GetByIds(eventCustomers.Where(ec => ec.AppointmentId.HasValue).Select(ec => ec.AppointmentId.Value).ToList()); var eventIds = eventCustomers.Select(ec => ec.EventId).Distinct().ToArray(); var model = _eventReportingService.GetEventVolumeModel(eventCustomers.Select(ec => ec.EventId).Distinct().ToArray()); var customers = _customerRepository.GetCustomers(eventCustomers.Select(ec => ec.CustomerId).Distinct().ToArray()); var customerIds = customers.Select(x => x.CustomerId); var orders = _orderRepository.GetAllOrdersByEventCustomerIds(eventCustomers.Select(ec => ec.Id).ToArray(), true); var customerEligibilities = _customerEligibilityRepository.GetCustomerEligibilityByCustomerIdsAndYear(customerIds, DateTime.Today.Year); if (customerEligibilities.IsNullOrEmpty()) { customerEligibilities = new List <CustomerEligibility>(); } var eventPackages = _eventPackageRepository.GetbyEventIds(eventIds); var eventTests = _eventTestRepository.GetByEventIds(eventIds); var sourceCodes = _sourceCodeRepository.GetSourceCodeByIds(orders.SelectMany(o => o.OrderDetails.Where(od => od.SourceCodeOrderDetail != null && od.SourceCodeOrderDetail.IsActive) .Select(od => od.SourceCodeOrderDetail.SourceCodeId)).Distinct().ToArray()); var orgRoleUserIds = eventCustomers.Where(ec => ec.DataRecorderMetaData != null && ec.DataRecorderMetaData.DataRecorderCreator != null).Select(ec => ec.DataRecorderMetaData.DataRecorderCreator.Id).ToList(); var eventAppointmentChangeLogs = _eventAppointmentChangeLogRepository.GetByEventCustomerIds(eventCustomers.Select(ec => ec.Id).ToArray()).ToArray(); orgRoleUserIds.AddRange(eventAppointmentChangeLogs.Select(eacl => eacl.CreatedByOrgRoleUserId)); var registeredbyAgent = _organizationRoleUserRepository.GetOrganizationRoleUsers(orgRoleUserIds); var roles = _roleRepository.GetAll(); var registeredbyAgentNameIdPair = _organizationRoleUserRepository.GetNameIdPairofUsers(orgRoleUserIds.ToArray()).ToArray(); var callDetails = _callCenterCallRepository.GetCallDetails(customers); var shippingDetailIds = orders.SelectMany(o => o.OrderDetails.SelectMany(od => od.ShippingDetailOrderDetails.Select(sdod => sdod.ShippingDetailId))).ToArray(); var shippingDetails = _shippingDetailRepository.GetByIds(shippingDetailIds); var cdShippingOption = _shippingOptionRepository.GetShippingOptionByProductId((long)Product.UltraSoundImages); var shippingOptions = _shippingOptionRepository.GetAllShippingOptions(); var customTags = _customTagRepository.GetByCustomerIds(customerIds); var tagNames = customers.Where(x => !string.IsNullOrEmpty(x.Tag)).Select(x => x.Tag).ToArray(); var corporateAccount = _corporateAccountRepository.GetByTags(tagNames); var corporateAccountIds = corporateAccount.Select(x => x.Id).ToArray(); var accountAdditionalField = _accountAdditionalFieldRepository.GetAccountAdditionalFieldsByAccountIds(corporateAccountIds); var primaryCarePhysicians = _primaryCarePhysicianRepository.GetByCustomerIds(eventCustomers.Select(ec => ec.CustomerId).Distinct().ToArray()); var languages = _languageRepository.GetAll(); var pcpAppointments = _pcpAppointmentRepository.GetByEventCustomerIds(eventCustomers.Select(ec => ec.Id).ToArray()); return(_customAppointmentsBookedModelFactory.CreateHourlyModel(eventCustomers, appointments, orders, model, customers, registeredbyAgent, roles, registeredbyAgentNameIdPair, sourceCodes, callDetails, shippingDetails, cdShippingOption, shippingOptions, eventAppointmentChangeLogs, primaryCarePhysicians, eventPackages, eventTests, languages, customTags, corporateAccount, accountAdditionalField, pcpAppointments, customerEligibilities)); }