コード例 #1
0
        public PriceScreenRecordDto GetCreatePriceScreenRecord(int cruiseId)
        {
            _unitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant);
            int workingYear = DateTime.Now.Year;

            try
            {
                IEnumerable <ISettingValue> listSettings = SettingManager.GetAllSettingValuesForUserAsync(AbpSession.ToUserIdentifier()).Result;
                if (listSettings != null)
                {
                    if (listSettings.Where(o => o.Name == AppSettings.UserManagement.WorkingYear).SingleOrDefault() != null)
                    {
                        workingYear = Convert.ToInt32(listSettings.Where(o => o.Name == AppSettings.UserManagement.WorkingYear).SingleOrDefault().Value);
                    }
                }
            }
            catch (Exception)
            {
            }

            PriceScreenRecordDto priceScreenRecordDto = new PriceScreenRecordDto();

            try
            {
                string defaultCurrency = SettingManager.GetSettingValueForApplicationAsync(AppSettings.DefaultCurrency).Result;

                //var fares = _lookup_cruiseFaresRepository.GetAll().Where(x => x.Id == fareId).FirstOrDefault();
                var seasonGroups = _lookup_cruiseDeparturesRepository.GetAll().Where(x => x.CruisesId == cruiseId && x.DepartureYear == workingYear).
                                   Select(m => new { m.SeasonGroup }).Distinct();
                var cruises = _cruisesRepository.GetAll().Where(x => x.Id == cruiseId).FirstOrDefault();
                var deckIds = _lookup_cruiseShipCabinsRepository.GetAll().Where(x => x.CruiseShipsId == cruises.CruiseShipsId)
                              .Select(m => new { m.CruiseShipDecksId, m.Id, m.CabinTypeID }).Distinct();

                var _lookupCruiseServices = _cruiseServicesRepository.FirstOrDefault((int)cruises.CruiseServicesId);
                var serviceUnit           = _cruiseServiceUnitsRepository.FirstOrDefault((int)_lookupCruiseServices.CruiseServiceUnitsId);
                var masterAmenities       = _cruiseMasterAmenitiesRepository.GetAll().Where(x => x.Id == serviceUnit.ServiceUnit.Value).FirstOrDefault();


                // var distinctgroupSubscriptions = deckIds.GroupBy(m => new { m.CruiseShipDecksId, m.Id, m.CabinTypeID })
                //                                .Select(group => group.First()).ToList();
                List <CheckDuplicate> checkDuplicatesDecks = new List <CheckDuplicate>();
                foreach (var deckId in deckIds)
                {
                    var match = checkDuplicatesDecks.FirstOrDefault(x => x.CabinTypeID == deckId.CabinTypeID && x.CruiseShipDecksId == deckId.CruiseShipDecksId);
                    if (match == null)
                    {
                        CheckDuplicate checkDuplicatevalues = new CheckDuplicate();
                        checkDuplicatevalues.CruiseShipDecksId = deckId.CruiseShipDecksId.Value;
                        checkDuplicatevalues.Id          = deckId.Id;
                        checkDuplicatevalues.CabinTypeID = deckId.CabinTypeID;
                        checkDuplicatesDecks.Add(checkDuplicatevalues);
                    }
                }
                priceScreenRecordDto.FareId         = 0;
                priceScreenRecordDto.CruiseId       = cruiseId;
                priceScreenRecordDto.CruiseShipsId  = cruises.CruiseShipsId.Value;
                priceScreenRecordDto.DefaultCurency = defaultCurrency;
                priceScreenRecordDto.ServiceUnit    = masterAmenities.DisplayName.ToString();

                priceScreenRecordDto.SeasonGroup = new List <SeasonGroups>();
                foreach (var item in seasonGroups)
                {
                    SeasonGroups objSeasonGroup = new SeasonGroups();
                    objSeasonGroup.SeasonGroupName = item.SeasonGroup;
                    priceScreenRecordDto.SeasonGroup.Add(objSeasonGroup);
                }
                priceScreenRecordDto.ShipCabinDetail = new List <ShipCabinDetails>();
                foreach (var deckId in checkDuplicatesDecks)
                {
                    ShipCabinDetails objShipCabinDetails = new ShipCabinDetails();

                    //var ShipDecks = _cruiseShipDecksRepository.GetAll().Where(x => x.Id == deckId.CruiseShipDecksId).FirstOrDefault();
                    var deckName  = _cruiseMasterAmenitiesRepository.GetAll().Where(x => x.Id == deckId.CruiseShipDecksId).Select(m => new { m.DisplayName }).FirstOrDefault();
                    var cabinType = _cruiseMasterAmenitiesRepository.GetAll().Where(x => x.Id == deckId.CabinTypeID).Select(m => new { m.DisplayName }).FirstOrDefault();

                    objShipCabinDetails.CruiseShipDecksId = deckId.CruiseShipDecksId;
                    objShipCabinDetails.Id          = deckId.Id;
                    objShipCabinDetails.CabinTypeID = deckId.CabinTypeID;
                    objShipCabinDetails.DeckName    = deckName.DisplayName;
                    objShipCabinDetails.CabinType   = cabinType.DisplayName;

                    priceScreenRecordDto.ShipCabinDetail.Add(objShipCabinDetails);
                }
            }
            catch (Exception ex)
            {
            }
            return(priceScreenRecordDto);
        }
コード例 #2
0
 public async Task PrepareCollectedData()
 {
     await _backgroundJobManager.EnqueueAsync <UserCollectedDataPrepareJob, UserIdentifier>(AbpSession.ToUserIdentifier());
 }
コード例 #3
0
        public async Task MarkAllUnreadMessagesOfUserAsRead(MarkAllUnreadMessagesOfUserAsReadInput input)
        {
            var userId   = AbpSession.GetUserId();
            var tenantId = AbpSession.TenantId;

            // receiver messages
            var messages = await _chatMessageRepository
                           .GetAll()
                           .Where(m =>
                                  m.UserId == userId &&
                                  m.TargetTenantId == input.TenantId &&
                                  m.TargetUserId == input.UserId &&
                                  m.ReadState == ChatMessageReadState.Unread)
                           .ToListAsync();

            if (!messages.Any())
            {
                return;
            }

            foreach (var message in messages)
            {
                message.ChangeReadState(ChatMessageReadState.Read);
            }

            // sender messages
            using (CurrentUnitOfWork.SetTenantId(input.TenantId))
            {
                var reverseMessages = await _chatMessageRepository.GetAll()
                                      .Where(m => m.UserId == input.UserId && m.TargetTenantId == tenantId && m.TargetUserId == userId)
                                      .ToListAsync();

                if (!reverseMessages.Any())
                {
                    return;
                }

                foreach (var message in reverseMessages)
                {
                    message.ChangeReceiverReadState(ChatMessageReadState.Read);
                }
            }

            var userIdentifier   = AbpSession.ToUserIdentifier();
            var friendIdentifier = input.ToUserIdentifier();

            _userFriendsCache.ResetUnreadMessageCount(userIdentifier, friendIdentifier);

            var onlineUserClients = _onlineClientManager.GetAllByUserId(userIdentifier);

            if (onlineUserClients.Any())
            {
                await _chatCommunicator.SendAllUnreadMessagesOfUserReadToClients(onlineUserClients, friendIdentifier);
            }

            var onlineFriendClients = _onlineClientManager.GetAllByUserId(friendIdentifier);

            if (onlineFriendClients.Any())
            {
                await _chatCommunicator.SendReadStateChangeToClients(onlineFriendClients, userIdentifier);
            }
        }
コード例 #4
0
        public PartialViewResult SideBarNav(string activeMenu = "")
        {
            var model = new SideBarNavViewModel
            {
                MainMenu           = AsyncHelper.RunSync(() => _userNavigationManager.GetMenuAsync("MainMenu", AbpSession.ToUserIdentifier())),
                ActiveMenuItemName = activeMenu
            };

            return(PartialView("_SideBarNav", model));
        }
コード例 #5
0
 public async Task SetAllNotificationsAsRead()
 {
     await _userNotificationManager.UpdateAllUserNotificationStatesAsync(AbpSession.ToUserIdentifier(), UserNotificationState.Read);
 }
コード例 #6
0
ファイル: LayoutController.cs プロジェクト: fanghao811/ZOG.MS
        public PartialViewResult Sidebar(string currentPageName = "")
        {
            var sidebarModel = new SidebarViewModel
            {
                Menu            = AsyncHelper.RunSync(() => _userNavigationManager.GetMenuAsync(MpaNavigationProvider.MenuName, AbpSession.ToUserIdentifier())),
                CurrentPageName = currentPageName
            };

            return(PartialView("_Sidebar", sidebarModel));
        }
コード例 #7
0
        private async Task Create(CreateOrEditCruiseItinerariesDto input)
        {
            string defaultCurrentLanguage = await SettingManager.GetSettingValueForUserAsync(AppSettings.DefaultCurrentLanguage, AbpSession.ToUserIdentifier());

            if (string.IsNullOrWhiteSpace(defaultCurrentLanguage))
            {
                defaultCurrentLanguage = "EN";
            }
            var imageParts = input.ItineraryMap.Split(',').ToList <string>();

            byte[] mapInBytes = Convert.FromBase64String(imageParts[1]);

            CruiseItinerary cruiseItineraries = new CruiseItinerary
            {
                ItineraryMap   = mapInBytes,
                ItineraryCode  = input.ItineraryCode,
                ItineraryName  = input.ItineraryName,
                Description    = input.Description,
                OnBoardService = input.OnBoardService
            };

            if (AbpSession.TenantId != null)
            {
                cruiseItineraries.TenantId = (int?)AbpSession.TenantId;
            }
            cruiseItineraries.Lang = defaultCurrentLanguage.ToUpper();

            await _cruiseItinerariesRepository.InsertAsync(cruiseItineraries);
        }
コード例 #8
0
        private async Task <string> getCurrentLanguageAsync()
        {
            string defaultCurrentLanguage = await SettingManager.GetSettingValueForUserAsync(AppSettings.DefaultCurrentLanguage, AbpSession.ToUserIdentifier());

            if (string.IsNullOrWhiteSpace(defaultCurrentLanguage))
            {
                defaultCurrentLanguage = "EN";
            }

            return(defaultCurrentLanguage);
        }
コード例 #9
0
 /// <summary>
 /// 将所有通知置为已读
 /// </summary>
 public async Task SetAllNotificationsAsRead()
 {
     var currentUserId = AbpSession.ToUserIdentifier();
     await _userNotificationManager.UpdateAllUserNotificationStatesAsync(currentUserId, UserNotificationState.Read);
 }
コード例 #10
0
        public async Task <PagedResultDto <GetCruisePricesForViewDto> > GetAll(GetAllCruisePricesInput input)
        {
            string defaultCurrentLanguage = await SettingManager.GetSettingValueForUserAsync(AppSettings.DefaultCurrentLanguage, AbpSession.ToUserIdentifier());

            if (string.IsNullOrWhiteSpace(defaultCurrentLanguage))
            {
                defaultCurrentLanguage = "EN";
            }

            int  workingYear     = DateTime.Now.Year;
            bool showNextYear    = false;
            bool showHistoryData = false;

            try
            {
                IEnumerable <ISettingValue> listSettings = SettingManager.GetAllSettingValuesForUserAsync(AbpSession.ToUserIdentifier()).Result;
                if (listSettings != null)
                {
                    if (listSettings.Where(o => o.Name == AppSettings.UserManagement.ShowDeletedYearData).SingleOrDefault() != null)
                    {
                        if (Convert.ToBoolean(listSettings.Where(o => o.Name == AppSettings.UserManagement.ShowDeletedYearData).SingleOrDefault().Value))
                        {
                            _unitOfWorkManager.Current.DisableFilter(AbpDataFilters.SoftDelete);
                        }
                    }
                    if (listSettings.Where(o => o.Name == AppSettings.UserManagement.ShowNextYearData).SingleOrDefault() != null)
                    {
                        if (Convert.ToBoolean(listSettings.Where(o => o.Name == AppSettings.UserManagement.ShowNextYearData).SingleOrDefault().Value))
                        {
                            showNextYear = true;
                        }
                    }
                    if (listSettings.Where(o => o.Name == AppSettings.UserManagement.ShowHistoryData).SingleOrDefault() != null)
                    {
                        if (Convert.ToBoolean(listSettings.Where(o => o.Name == AppSettings.UserManagement.ShowHistoryData).SingleOrDefault().Value))
                        {
                            showHistoryData = true;
                        }
                    }
                    if (listSettings.Where(o => o.Name == AppSettings.UserManagement.WorkingYear).SingleOrDefault() != null)
                    {
                        workingYear = Convert.ToInt32(listSettings.Where(o => o.Name == AppSettings.UserManagement.WorkingYear).SingleOrDefault().Value);
                    }
                }
            }
            catch (Exception)
            {
            }

            var filteredCruisePrices = _cruisePricesRepository.GetAll()
                                       .WhereIf(!string.IsNullOrWhiteSpace(input.Filter), e => false || e.CurrencyId.Contains(input.Filter))
                                       .WhereIf(!string.IsNullOrWhiteSpace(input.CruiseServicesServiceNameFilter), e => e.CruiseServicesFk != null && e.CruiseServicesFk.ServiceNaFk.DisplayName.ToLower() == input.CruiseServicesServiceNameFilter.ToLower().Trim())
                                       .WhereIf(workingYear > 0 && showNextYear == true && showHistoryData == false, e => (e.PriceYear == workingYear || e.PriceYear == workingYear + 1))
                                       .WhereIf(workingYear > 0 && showNextYear == true && showHistoryData == true, e => (e.PriceYear == workingYear || e.PriceYear == workingYear + 1 || e.PriceYear <= workingYear))
                                       .WhereIf(workingYear > 0 && showNextYear == false && showHistoryData == true, e => (e.PriceYear == workingYear || e.PriceYear <= workingYear))
                                       .WhereIf(workingYear > 0 && showNextYear == false && showHistoryData == false, e => e.PriceYear == workingYear)
                                       .Where(x => x.CruiseId == input.CruiseId);



            var pagedAndFilteredCruisePrices = filteredCruisePrices
                                               .OrderBy(x => x.SeasonGroup).ThenByDescending(x => x.CruiseServicesId)
                                               .PageBy(input);

            _unitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant);
            var cruisePrices = from o in pagedAndFilteredCruisePrices

                               join o1 in _lookup_cruiseFaresRepository.GetAll() on o.CruiseFaresId equals o1.Id into j1
                               from s1 in j1.DefaultIfEmpty()

                               join o3 in _lookup_cruiseShipCabinsRepository.GetAll() on o.CruiseShipCabinsId equals o3.Id into j3
                               from s3 in j3.DefaultIfEmpty()

                               join o4 in _lookup_cruiseServicesRepository.GetAll() on o.CruiseServicesId equals o4.Id into j4
                               from s4 in j4.DefaultIfEmpty()



                               join o8 in _cruiseServiceUnitsRepository.GetAll() on s4.CruiseServiceUnitsId equals o8.Id into j8
                               from s8 in j8.DefaultIfEmpty()
                               // service unit name Id
                               join o9 in _cruiseMasterAmenitiesRepository.GetAll() on s8.ServiceUnit equals o9.Id into j9
                               from s9 in j9.DefaultIfEmpty()

                               join o5 in _cruiseMasterAmenitiesRepository.GetAll() on s3.CruiseShipDecksId equals o5.Id into j5
                               from s5 in j5.DefaultIfEmpty()

                               // deack name
                               join o6 in _cruiseMasterAmenitiesRepository.GetAll() on o.DeckId equals o6.Id into j6
                               from s6 in j6.DefaultIfEmpty()

                               // cabin type ID
                               join o7 in _cruiseMasterAmenitiesRepository.GetAll().Where(x => x.Lang.ToUpper() == defaultCurrentLanguage.ToUpper()) on o.CabinTypeId equals o7.Id into j7
                               from s7 in j7.DefaultIfEmpty()


                               select new GetCruisePricesForViewDto()
            {
                CruisePrices = new CruisePricesDto
                {
                    UnitPrice     = o.UnitPrice,
                    CurrencyId    = o.CurrencyId,
                    SeasonGroup   = o.SeasonGroup,
                    DeckName      = s6 == null ? "" : s6.DisplayName.ToString(),
                    CabintypeName = s7 == null ? "" : s7.DisplayName.ToString(),
                    Id            = o.Id
                },
                CruiseFaresFareName = s1 == null ? "" : s1.FareName.ToString(),
                CruiseShipCabinsCabinCategoryId = s5 == null ? "" : s5.DisplayName.ToString(),
                CruiseServicesServiceName       = s4 == null ? "" : s4.ServiceNaFk.DisplayName.ToString(),
                CruiseServicesServiceUnit       = s9 == null ? "" : s9.DisplayName.ToString()
            };



            var totalCount = await filteredCruisePrices.CountAsync();

            return(new PagedResultDto <GetCruisePricesForViewDto>(
                       totalCount,
                       await cruisePrices.ToListAsync()
                       ));
        }
コード例 #11
0
        public async Task ReOrderRowByIcon(ReorderRowsByIcon input)
        {
            string defaultCurrentLanguage = await SettingManager.GetSettingValueForUserAsync(AppSettings.DefaultCurrentLanguage, AbpSession.ToUserIdentifier());

            if (string.IsNullOrWhiteSpace(defaultCurrentLanguage))
            {
                defaultCurrentLanguage = "EN";
            }

            await ReorderMasterAmenities(input);
        }
コード例 #12
0
        public async Task SaveCharterPriceScreenRecord(List <SavePriceScreenRecordDto> items)
        {
            int workingYear = DateTime.Now.Year;

            try
            {
                IEnumerable <ISettingValue> listSettings = SettingManager.GetAllSettingValuesForUserAsync(AbpSession.ToUserIdentifier()).Result;
                if (listSettings != null)
                {
                    if (listSettings.Where(o => o.Name == AppSettings.UserManagement.WorkingYear).SingleOrDefault() != null)
                    {
                        workingYear = Convert.ToInt32(listSettings.Where(o => o.Name == AppSettings.UserManagement.WorkingYear).SingleOrDefault().Value);
                    }
                }
            }
            catch (Exception)
            {
            }


            var firstElement = items.First();

            string[] seasonGroupList = firstElement.SeasonGroup.Split(',');

            string defaultCurrency = await SettingManager.GetSettingValueForApplicationAsync(AppSettings.DefaultCurrency);

            foreach (var item in items)
            {
                int countOfseason = 1;
                foreach (var season in seasonGroupList)
                {
                    CruisePrice cruisePrices = new CruisePrice();
                    cruisePrices.CruiseFaresId    = item.FareId;
                    cruisePrices.ShipId           = item.CruiseShipsId;
                    cruisePrices.CruiseServicesId = 6;
                    cruisePrices.CurrencyId       = defaultCurrency;
                    cruisePrices.PriceYear        = item.PriceYear;
                    if (AbpSession.TenantId != null)
                    {
                        cruisePrices.TenantId = (int?)AbpSession.TenantId;
                    }
                    switch (countOfseason)
                    {
                    // season one
                    case 1:
                        if (item.TextBoxValue1)
                        {
                            cruisePrices.UnitPrice   = Convert.ToDecimal(item.UnitPrice1);
                            cruisePrices.SeasonGroup = season;
                        }
                        break;

                    // season second
                    case 2:
                        if (item.TextBoxValue2)
                        {
                            cruisePrices.UnitPrice   = Convert.ToDecimal(item.UnitPrice2);
                            cruisePrices.SeasonGroup = season;
                        }
                        break;

                    // season third
                    case 3:
                        if (item.TextBoxValue3)
                        {
                            cruisePrices.UnitPrice   = Convert.ToDecimal(item.UnitPrice3);
                            cruisePrices.SeasonGroup = season;
                        }
                        break;

                    // season forth
                    case 4:
                        if (item.TextBoxValue4)
                        {
                            cruisePrices.UnitPrice   = Convert.ToDecimal(item.UnitPrice4);
                            cruisePrices.SeasonGroup = season;
                        }
                        break;

                    // season fifth
                    case 5:
                        if (item.TextBoxValue5)
                        {
                            cruisePrices.UnitPrice   = Convert.ToDecimal(item.UnitPrice5);
                            cruisePrices.SeasonGroup = season;
                        }
                        break;

                    // season six
                    case 6:
                        if (item.TextBoxValue6)
                        {
                            cruisePrices.UnitPrice   = Convert.ToDecimal(item.UnitPrice6);
                            cruisePrices.SeasonGroup = season;
                        }
                        break;
                    }

                    await _cruisePricesRepository.InsertAsync(cruisePrices);

                    countOfseason++;
                }
            }
        }
コード例 #13
0
        public PriceScreenRecordDto GetCreateCharterPriceScreenRecord(int fareId)
        {
            int workingYear = DateTime.Now.Year;

            try
            {
                IEnumerable <ISettingValue> listSettings = SettingManager.GetAllSettingValuesForUserAsync(AbpSession.ToUserIdentifier()).Result;
                if (listSettings != null)
                {
                    if (listSettings.Where(o => o.Name == AppSettings.UserManagement.WorkingYear).SingleOrDefault() != null)
                    {
                        workingYear = Convert.ToInt32(listSettings.Where(o => o.Name == AppSettings.UserManagement.WorkingYear).SingleOrDefault().Value);
                    }
                }
            }
            catch (Exception)
            {
            }
            PriceScreenRecordDto priceScreenRecordDto = new PriceScreenRecordDto();

            try
            {
                string defaultCurrency = SettingManager.GetSettingValueForApplicationAsync(AppSettings.DefaultCurrency).Result;
                var    fares           = _lookup_cruiseFaresRepository.GetAll().Where(x => x.Id == fareId).FirstOrDefault();
                var    seasonGroups    = _charterDeparturesRepository.GetAll().
                                         Where(x => x.CruiseShipId == fares.ShipId && x.DepartureYear == workingYear).
                                         Select(m => new { m.SeasonGroup }).Distinct();


                priceScreenRecordDto.FareId         = fareId;
                priceScreenRecordDto.CruiseShipsId  = fares.ShipId.Value;
                priceScreenRecordDto.DefaultCurency = defaultCurrency;
                priceScreenRecordDto.SeasonGroup    = new List <SeasonGroups>();
                foreach (var item in seasonGroups)
                {
                    SeasonGroups objSeasonGroup = new SeasonGroups();
                    objSeasonGroup.SeasonGroupName = item.SeasonGroup;

                    priceScreenRecordDto.SeasonGroup.Add(objSeasonGroup);
                }
            }
            catch (Exception ex)
            {
            }
            return(priceScreenRecordDto);
        }
コード例 #14
0
        public CruisePriceModalsScreen CruisePriceModalsScreen(GetCruisePriceModalsScreen getCruisePriceModalsScreen)
        {
            _unitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant);
            int workingYear = DateTime.Now.Year;

            try
            {
                IEnumerable <ISettingValue> listSettings = SettingManager.GetAllSettingValuesForUserAsync(AbpSession.ToUserIdentifier()).Result;
                if (listSettings != null)
                {
                    if (listSettings.Where(o => o.Name == AppSettings.UserManagement.WorkingYear).SingleOrDefault() != null)
                    {
                        workingYear = Convert.ToInt32(listSettings.Where(o => o.Name == AppSettings.UserManagement.WorkingYear).SingleOrDefault().Value);
                    }
                }
            }
            catch
            {
            }
            CruisePriceModalsScreen cruisePriceModalsScreen = new CruisePriceModalsScreen();
            var    cruises         = _cruisesRepository.GetAll().Where(x => x.Id == getCruisePriceModalsScreen.cruiseId).FirstOrDefault();
            string defaultCurrency = SettingManager.GetSettingValueForApplicationAsync(AppSettings.DefaultCurrency).Result;
            var    seasonGroups    = _lookup_cruiseDeparturesRepository.GetAll().Where(x => x.CruisesId == getCruisePriceModalsScreen.cruiseId && x.DepartureYear == workingYear).
                                     Select(m => new { m.SeasonGroup }).Distinct();
            var _lookupCruiseServices = _cruiseServicesRepository.FirstOrDefault((int)cruises.CruiseServicesId);
            var serviceUnit           = _cruiseServiceUnitsRepository.FirstOrDefault((int)_lookupCruiseServices.CruiseServiceUnitsId);
            var masterAmenities       = _cruiseMasterAmenitiesRepository.GetAll().Where(x => x.Id == serviceUnit.ServiceUnit.Value).FirstOrDefault();

            cruisePriceModalsScreen.CruiseId       = getCruisePriceModalsScreen.cruiseId;
            cruisePriceModalsScreen.CruiseShipsId  = cruises.CruiseShipsId.Value;
            cruisePriceModalsScreen.DefaultCurency = defaultCurrency;
            if (getCruisePriceModalsScreen.serviceGroupId == 5 || getCruisePriceModalsScreen.serviceGroupId == 7)
            {
                cruisePriceModalsScreen.DefaultCurency = "%";
            }
            cruisePriceModalsScreen.ServiceUnit = masterAmenities.DisplayName.ToString();
            // bind SeasonGroups
            cruisePriceModalsScreen.SeasonGroup = new List <SeasonGroups>();
            foreach (var item in seasonGroups)
            {
                SeasonGroups objSeasonGroup = new SeasonGroups();
                objSeasonGroup.SeasonGroupName = item.SeasonGroup;
                cruisePriceModalsScreen.SeasonGroup.Add(objSeasonGroup);
            }
            var _serviceList = _cruiseServicesRepository.GetAll().Where(x => x.CruiseServiceGroupsId == getCruisePriceModalsScreen.serviceGroupId);

            cruisePriceModalsScreen.ServiceList = new List <ServiceList>();
            foreach (var item in _serviceList)
            {
                ServiceList serviceList = new ServiceList();
                var         masterAmenities_ServiecName = _cruiseMasterAmenitiesRepository.GetAll().Where(x => x.Id == item.ServiceName).FirstOrDefault();
                serviceList.ServiceName           = masterAmenities_ServiecName.DisplayName;
                serviceList.ServiceId             = item.Id;
                serviceList.CruiseServiceGroupsId = getCruisePriceModalsScreen.serviceGroupId;

                cruisePriceModalsScreen.ServiceList.Add(serviceList);
            }

            return(cruisePriceModalsScreen);
        }
コード例 #15
0
        public async Task <IViewComponentResult> InvokeAsync(string currentPageName)
        {
            // 检查千层饼是否可以触发。


            //var tenancyName = "";
            //if (AbpSession.TenantId.HasValue)
            //{
            //    var tenant = await _tenantManager.GetByIdAsync(AbpSession.GetTenantId());
            //    tenancyName = tenant.TenancyName;
            //}

            var headerModel = new HeaderViewModel
            {
                LoginInformations = await _sessionAppService.GetCurrentLoginInformations(),
                IsInHostView      = !AbpSession.TenantId.HasValue,

                Menu                      = await _userNavigationManager.GetMenuAsync(PortalNavigationProvider.MenuName, AbpSession.ToUserIdentifier()),
                CurrentPageName           = currentPageName,
                IsMultiTenancyEnabled     = _multiTenancyConfig.IsEnabled,
                TenantRegistrationEnabled = await _settingManager.GetSettingValueAsync <bool>(AppSettingNames.HostSettings.AllowSelfRegistration),

                //todo:url璺宠浆
            };

            return(View(headerModel));
        }
コード例 #16
0
ファイル: MenuAppService.cs プロジェクト: 792702675/MFUI
        public async Task <IList <UserMenuItem> > GetUserMenus()
        {
            var menu = await _userNavigationManager.GetMenuAsync(DBNavigationProvider.MenuGroupName, AbpSession.ToUserIdentifier());

            return(menu.Items);
        }
コード例 #17
0
        public PartialViewResult Nav(string activeMenu = "")
        {
            var loginInformations = AsyncHelper.RunSync(() => _sessionAppService.GetCurrentLoginInformations());
            var menu = new TopMenuViewModel
            {
                MainMenu           = AsyncHelper.RunSync(() => _userNavigationManager.GetMenuAsync("MainMenu", AbpSession.ToUserIdentifier())),
                ActiveMenuItemName = activeMenu
            };

            return(PartialView("_Nav", Tuple.Create <TopMenuViewModel, GetCurrentLoginInformationsOutput>(menu, loginInformations)));
        }
コード例 #18
0
 public ActionResult LoginInfo()
 {
     return(Json(AbpSession.ToUserIdentifier()));
 }
コード例 #19
0
        public PartialViewResult Header(string currentPageName = "")
        {
            var headerModel = new HeaderViewModel();

            if (AbpSession.UserId.HasValue)
            {
                headerModel.LoginInformations = AsyncHelper.RunSync(() => _sessionCache.GetCurrentLoginInformationsAsync());
            }

            headerModel.Languages       = _languageManager.GetLanguages();
            headerModel.CurrentLanguage = _languageManager.CurrentLanguage;

            headerModel.Menu            = AsyncHelper.RunSync(() => _userNavigationManager.GetMenuAsync(FrontEndNavigationProvider.MenuName, AbpSession.ToUserIdentifier()));
            headerModel.CurrentPageName = currentPageName;

            headerModel.IsMultiTenancyEnabled     = _multiTenancyConfig.IsEnabled;
            headerModel.TenantRegistrationEnabled = SettingManager.GetSettingValue <bool>(AppSettings.TenantManagement.AllowSelfRegistration);

            return(PartialView("~/Views/Layout/_Header.cshtml", headerModel));
        }
コード例 #20
0
        public PartialViewResult SideMenu(string currentPageName = "")
        {
            var isGrantedPermission = PermissionChecker.IsGranted(AbpSession.ToUserIdentifier(), UserPermissions.User);
            var model = new SideMenuViewModel
            {
                MainMenu        = AsyncHelper.RunSync(() => _userNavigationManager.GetMenuAsync("Mpa", AbpSession.ToUserIdentifier())),
                CurrentPageName = currentPageName
            };

            return(PartialView("_SideMenu", model));
        }
コード例 #21
0
        private async Task Update(CreateOrEditCruiseItinerariesDto input)
        {
            _unitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant);
            string defaultCurrentLanguage = await SettingManager.GetSettingValueForUserAsync(AppSettings.DefaultCurrentLanguage, AbpSession.ToUserIdentifier());

            if (string.IsNullOrWhiteSpace(defaultCurrentLanguage))
            {
                defaultCurrentLanguage = "EN";
            }
            var cruiseItineraries = await _cruiseItinerariesRepository.FirstOrDefaultAsync((int)input.Id);

            var imageParts = input.ItineraryMap.Split(',').ToList <string>();

            byte[] mapInBytes = Convert.FromBase64String(imageParts[1]);
            cruiseItineraries.ItineraryMap   = mapInBytes;
            cruiseItineraries.ItineraryCode  = input.ItineraryCode;
            cruiseItineraries.ItineraryName  = input.ItineraryName;
            cruiseItineraries.Description    = input.Description;
            cruiseItineraries.Lang           = defaultCurrentLanguage.ToUpper();
            cruiseItineraries.OnBoardService = input.OnBoardService;
            await _cruiseItinerariesRepository.UpdateAsync(cruiseItineraries);

            // ObjectMapper.Map(input, cruiseItineraries);
        }
コード例 #22
0
        public async Task Should_Delete_All_Notifications_Between_StartDate_EndDate()
        {
            var now = DateTime.Now;

            var userIdentifier = AbpSession.ToUserIdentifier();
            await _notificationPublisher.PublishAsync("TestNotification", userIds : new[] { userIdentifier });

            Thread.Sleep(TimeSpan.FromSeconds(5));

            //this notification's creation time will be more than now+5sec
            await _notificationPublisher.PublishAsync("TestNotification2", userIds : new[] { userIdentifier });

            Thread.Sleep(TimeSpan.FromSeconds(5));

            //this notification's creation time will be more than now+10sec
            await _notificationPublisher.PublishAsync("TestNotification3", userIds : new[] { userIdentifier });

            var allNotifications = await _notificationStore.GetUserNotificationsWithNotificationsAsync(
                userIdentifier,
                startDate : now,
                endDate : now.AddSeconds(30)
                );

            allNotifications.Count.ShouldBe(3);

            //delete second added notification
            await _notificationStore.DeleteAllUserNotificationsAsync(
                userIdentifier,
                state : null,
                startDate : now.AddSeconds(5),
                endDate : now.AddSeconds(10)
                );

            //check
            var notifications = await _notificationStore.GetUserNotificationsWithNotificationsAsync(
                userIdentifier,
                startDate : now.AddSeconds(5),
                endDate : now.AddSeconds(10)
                );

            notifications.Count.ShouldBe(0);

            allNotifications = await _notificationStore.GetUserNotificationsWithNotificationsAsync(
                userIdentifier,
                startDate : now,
                endDate : now.AddSeconds(30)
                );

            allNotifications.Count.ShouldBe(2);

            //delete all added notification
            await _notificationStore.DeleteAllUserNotificationsAsync(
                userIdentifier,
                state : null,
                startDate : now,
                endDate : now.AddSeconds(30)
                );

            //check
            allNotifications = await _notificationStore.GetUserNotificationsWithNotificationsAsync(
                userIdentifier,
                startDate : now,
                endDate : now.AddSeconds(30)
                );

            allNotifications.Count.ShouldBe(0);
        }
コード例 #23
0
        /// <inheritdoc/>
        public IReadOnlyList <ISettingValue> GetAllSettingValues(SettingScopes scopes)
        {
            var settingDefinitions = new Dictionary <string, SettingDefinition>();
            var settingValues      = new Dictionary <string, ISettingValue>();

            //Fill all setting with default values.
            foreach (var setting in _settingDefinitionManager.GetAllSettingDefinitions())
            {
                settingDefinitions[setting.Name] = setting;
                settingValues[setting.Name]      = new SettingValueObject(setting.Name, setting.DefaultValue);
            }

            //Overwrite application settings
            if (scopes.HasFlag(SettingScopes.Application))
            {
                foreach (var settingValue in GetAllSettingValuesForApplication())
                {
                    var setting = settingDefinitions.GetOrDefault(settingValue.Name);

                    //TODO: Conditions get complicated, try to simplify it
                    if (setting == null || !setting.Scopes.HasFlag(SettingScopes.Application))
                    {
                        continue;
                    }

                    if (!setting.IsInherited &&
                        ((setting.Scopes.HasFlag(SettingScopes.Tenant) && AbpSession.TenantId.HasValue) || (setting.Scopes.HasFlag(SettingScopes.User) && AbpSession.UserId.HasValue)))
                    {
                        continue;
                    }

                    settingValues[settingValue.Name] = new SettingValueObject(settingValue.Name, settingValue.Value);
                }
            }

            //Overwrite tenant settings
            if (scopes.HasFlag(SettingScopes.Tenant) && AbpSession.TenantId.HasValue)
            {
                foreach (var settingValue in GetAllSettingValuesForTenant(AbpSession.TenantId.Value))
                {
                    var setting = settingDefinitions.GetOrDefault(settingValue.Name);

                    //TODO: Conditions get complicated, try to simplify it
                    if (setting == null || !setting.Scopes.HasFlag(SettingScopes.Tenant))
                    {
                        continue;
                    }

                    if (!setting.IsInherited &&
                        (setting.Scopes.HasFlag(SettingScopes.User) && AbpSession.UserId.HasValue))
                    {
                        continue;
                    }

                    settingValues[settingValue.Name] = new SettingValueObject(settingValue.Name, settingValue.Value);
                }
            }

            //Overwrite user settings
            if (scopes.HasFlag(SettingScopes.User) && AbpSession.UserId.HasValue)
            {
                foreach (var settingValue in GetAllSettingValuesForUser(AbpSession.ToUserIdentifier()))
                {
                    var setting = settingDefinitions.GetOrDefault(settingValue.Name);
                    if (setting != null && setting.Scopes.HasFlag(SettingScopes.User))
                    {
                        settingValues[settingValue.Name] = new SettingValueObject(settingValue.Name, settingValue.Value);
                    }
                }
            }

            return(settingValues.Values.ToImmutableList());
        }
コード例 #24
0
 public virtual async Task ChangeSettingForUserAsync(SettingValueInput input)
 {
     await SettingManager.ChangeSettingForUserAsync(AbpSession.ToUserIdentifier(), input.Name, input.Value);
 }
コード例 #25
0
        public async Task <GetNotificationSettingsOutput> GetNotificationSettings()
        {
            var output = new GetNotificationSettingsOutput();

            output.ReceiveNotifications = await SettingManager.GetSettingValueAsync <bool>(NotificationSettingNames.ReceiveNotifications);

            //Get general notifications, not entity related notifications.
            var notificationDefinitions = (await _notificationDefinitionManager.GetAllAvailableAsync(AbpSession.ToUserIdentifier())).Where(nd => nd.EntityType == null);

            output.Notifications = ObjectMapper.Map <List <NotificationSubscriptionWithDisplayNameDto> >(notificationDefinitions);

            var subscribedNotifications = (await _notificationSubscriptionManager
                                           .GetSubscribedNotificationsAsync(AbpSession.ToUserIdentifier()))
                                          .Select(ns => ns.NotificationName)
                                          .ToList();

            output.Notifications.ForEach(n => n.IsSubscribed = subscribedNotifications.Contains(n.Name));

            return(output);
        }
コード例 #26
0
        public async Task RemoveDelegation(EntityDto <long> input)
        {
            CheckUserDelegationOperation();

            await _userDelegationManager.RemoveDelegationAsync(input.Id, AbpSession.ToUserIdentifier());
        }
コード例 #27
0
        public async Task <GetProfilePictureOutput> GetFriendProfilePictureById(GetFriendProfilePictureByIdInput input)
        {
            if (!input.ProfilePictureId.HasValue || await _friendshipManager.GetFriendshipOrNullAsync(AbpSession.ToUserIdentifier(), new UserIdentifier(input.TenantId, input.UserId)) == null)
            {
                return(new GetProfilePictureOutput(string.Empty));
            }

            using (CurrentUnitOfWork.SetTenantId(input.TenantId))
            {
                var bytes = await GetProfilePictureByIdOrNull(input.ProfilePictureId.Value);

                if (bytes == null)
                {
                    return(new GetProfilePictureOutput(string.Empty));
                }

                return(new GetProfilePictureOutput(Convert.ToBase64String(bytes)));
            }
        }
コード例 #28
0
 public async Task UpdateUiManagementSettings(ThemeSettingsDto settings)
 {
     var themeCustomizer = _uiThemeCustomizerFactory.GetUiCustomizer(settings.Theme);
     await themeCustomizer.UpdateUserUiManagementSettingsAsync(AbpSession.ToUserIdentifier(), settings);
 }
コード例 #29
0
 public async Task ChangeUiTheme(ChangeUiThemeInput input)
 {
     await SettingManager.ChangeSettingForUserAsync(AbpSession.ToUserIdentifier(), AppSettingNames.UiTheme, input.Theme);
 }
コード例 #30
0
        public async Task <SkinOutput> GetUiTheme()
        {
            var skinOutput = new SkinOutput();

            skinOutput.Name = await SettingManager.GetSettingValueForUserAsync(AppSettingNames.UiTheme, AbpSession.ToUserIdentifier());

            return(skinOutput);
        }