public EventMetricsViewData GetEventMetricsViewData(long eventId, long orgRoleUserId) { // TODO: This method really needs refactoring, // TODO: probably every different part of the view data needs to be handled in different factory. // TODO: Will revisit this after shopping cart is complete. var orders = _orderRepository.GetAllOrdersForEvent(eventId); var eventPackages = _eventPackageRepository.GetPackagesForEvent(eventId); var eventTests = _eventTestRepository.GetTestsForEvent(eventId); var eventCustomers = _eventCustomerRepository.GetEventCustomersbyEventId(eventId); IOrganizationRoleUserRepository organizationRoleUserRepository = new OrganizationRoleUserRepository(); var organizationRoleUser = organizationRoleUserRepository.GetOrganizationRoleUser(orgRoleUserId); var eventMetricsViewData = _revenueStatisticsViewDataFactory.CreateEventMetricsViewData(orders, eventPackages, eventTests, organizationRoleUser, eventCustomers); eventMetricsViewData = _eventCustomerRepository.GetEventCustomerFlagMetrics(eventMetricsViewData, eventId); return(eventMetricsViewData); }
private void ParseLockedEventFilesExceptWellmed() { try { var lockCorporateEventFolderLocation = string.Empty; var corporateAccounts = _corporateAccountRepository.GetAllHealthPlan(); var sourcePath = _settings.LockCorporateEventFolderLocation; foreach (var corporateAccount in corporateAccounts) { _logger.Info("Getting events for Account : " + corporateAccount.Tag); if (corporateAccount != null && (corporateAccount.Id == _settings.WellmedAccountId || corporateAccount.Id == _settings.WellmedTxAccountId)) { continue; } var eventIds = _eventRepository.GetEventIdsByAccountIdAndDate(corporateAccount.Id, DateTime.Today, DateTime.Today.AddDays(1)); if (eventIds.IsNullOrEmpty()) { _logger.Info("No events found for Account : " + corporateAccount.Tag); continue; } if (corporateAccount != null && string.IsNullOrWhiteSpace(corporateAccount.AcesClientShortName)) { _logger.Info("AcesClient Short Name not specified for Account : " + corporateAccount.Tag); continue; } lockCorporateEventFolderLocation = Path.Combine(sourcePath, corporateAccount.AcesClientShortName); if (!DirectoryOperationsHelper.IsDirectoryExist(lockCorporateEventFolderLocation)) { _logger.Info("Path does not exist for Account :" + corporateAccount.Tag + " Path @" + lockCorporateEventFolderLocation); continue; } foreach (var eventId in eventIds) { _logger.Info("Importing for EventId " + eventId); try { var location = _mediaRepository.GetUnlockEventsParseLocation(eventId, true); var eventCustomers = _eventCustomerRepository.GetEventCustomersbyEventId(eventId); if (!eventCustomers.IsNullOrEmpty()) { var customerIds = eventCustomers.Select(x => x.CustomerId).ToArray(); if (!customerIds.IsNullOrEmpty()) { ParseFileFromBPShare(customerIds, lockCorporateEventFolderLocation, location.PhysicalPath); } } _logger.Info("Import completed for EventId " + eventId); } catch (Exception exception) { _logger.Error("some error occurred while parsing event id " + eventId); _logger.Error(string.Format("Message: " + exception.Message + "\n stack trace: " + exception.StackTrace)); } } } } catch (Exception exception) { _logger.Error(string.Format("Message: " + exception.Message + "\n stack trace: " + exception.StackTrace)); } }
public void ParseLockedEventFilesForWellmed() { try { var lockCorporateEventFolderLocation = string.Empty; var wellmedFlAccountId = _settings.WellmedAccountId; var wellmedTxAccountId = _settings.WellmedTxAccountId; long[] wellmedAccountIds = { wellmedFlAccountId, wellmedTxAccountId }; var corporateAccounts = _corporateAccountRepository.GetByIds(wellmedAccountIds); foreach (var corporateAccount in corporateAccounts) { _logger.Info("Getting events for Account : " + corporateAccount.Tag); if (corporateAccount != null && corporateAccount.Id == _settings.WellmedAccountId) { lockCorporateEventFolderLocation = _settings.WellmedFlLockCorporateEventFolderLocation; } else if (corporateAccount != null && corporateAccount.Id == _settings.WellmedTxAccountId) { lockCorporateEventFolderLocation = _settings.WellmedTxLockCorporateEventFolderLocation; } var eventIds = _eventRepository.GetEventIdsByAccountIdAndDate(corporateAccount.Id, DateTime.Today, DateTime.Today.AddDays(1)); if (eventIds.IsNullOrEmpty()) { _logger.Info("No events found for Account : " + corporateAccount.Tag); continue; } foreach (var eventId in eventIds) { _logger.Info("Importing for EventId " + eventId); try { var location = _mediaRepository.GetUnlockEventsParseLocation(eventId, true); var eventCustomers = _eventCustomerRepository.GetEventCustomersbyEventId(eventId); if (!eventCustomers.IsNullOrEmpty()) { var customers = _customerRepository.GetCustomers(eventCustomers.Select(ec => ec.CustomerId).ToArray()); if (!customers.IsNullOrEmpty()) { var memberIds = customers.Where(x => !x.InsuranceId.IsNullOrEmpty()).Select(x => x.InsuranceId).ToArray(); if (!memberIds.IsNullOrEmpty()) { CopyFileFromBPShare(memberIds, lockCorporateEventFolderLocation, location.PhysicalPath); } } } _logger.Info("Import completed for EventId " + eventId); } catch (Exception exception) { _logger.Error("some error occurred while parsing event id " + eventId); _logger.Error(string.Format("Message: " + exception.Message + "\n stack trace: " + exception.StackTrace)); } } } } catch (Exception exception) { _logger.Error(string.Format("Message: " + exception.Message + "\n stack trace: " + exception.StackTrace)); } }