public IEnumerable <ReviewStatusDto> GetReviewStatuses()
        {
            var values = Enum.GetValues(typeof(ReviewStatus));

            var statuses  = new List <ReviewStatusDto>();
            int sortOrder = 1;

            foreach (ReviewStatus val in values)
            {
                var name  = val.ToString();
                var color = ReviewHelper.GetStatusColor(val);

                statuses.Add(new ReviewStatusDto
                {
                    Alias     = name.ToLower(),
                    Color     = color,
                    Id        = (int)val,
                    Name      = name,
                    SortOrder = sortOrder
                });

                sortOrder++;
            }

            return(statuses);
        }
示例#2
0
 protected async override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     MainFrame.Navigate(typeof(MainView));
     SettingsFrame.Navigate(typeof(SettingsView));
     SettingsFrame.Visibility = Visibility.Collapsed;
     await ReviewHelper.TryRequestReviewAsync();
 }
示例#3
0
        public void RunCountIncrementsAfterPromptingForReview()
        {
            var reviewHelper = new ReviewHelper();

            reviewHelper.SuggestReview();

            Assert.AreEqual(SettingsManager.Get <int>("RunCount"), 1);
        }
示例#4
0
        private async Task appStartup()
        {
            ReviewHelper.TrackAppLaunch();
            AdjustWindowSettings();
            AdjustSettingsForAppVersion();
            await RegisterForDevCenterNotifcationsAsync();

            RegisterBackgroundTask();
            UpdateTiles();
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            await ReviewHelper.TryRequestReview();

            AnimateProgressBar();
            if (App.startupHelper.shouldAskForTilePinning)
            {
                await new AskForLiveTilePinDialog().ShowAsync();
            }
        }
示例#6
0
        public static ReviewStatusDto ReviewStatusToDto(ReviewStatus reviewStatus)
        {
            var name  = reviewStatus.ToString();
            var color = ReviewHelper.GetStatusColor(reviewStatus);

            return(new ReviewStatusDto
            {
                Alias = name.ToLower(),
                Id = (int)reviewStatus,
                Color = color,
                Name = name,
                SortOrder = 0
            });
        }
示例#7
0
        public void RunCountResetsAfterVersionChange()
        {
            var reviewHelper = new ReviewHelper();

            reviewHelper.SuggestReview();
            reviewHelper.SuggestReview();
            reviewHelper.SuggestReview();
            reviewHelper.SuggestReview();

            Assert.AreEqual(SettingsManager.Get <int>("RunCount"), 4);

            SettingsManager.Set("Version", "1.1.1.1");
            reviewHelper.SuggestReview();

            Assert.AreEqual(SettingsManager.Get <int>("RunCount"), 1);
        }
 public ReviewCRUD()
 {
     dalCrud      = new RestaurantReviewDataLayer.CRUD.ReviewCRUD();
     reviewHelper = new ReviewHelper();
 }
        public AdvisorDetailViewModel GetAdvisorDetailViewModel(int advisorId, bool isEdit)
        {
            var manager    = new AdvisorManager();
            var detailInfo = manager.GetProductDetailInfo(advisorId);

            if (detailInfo == null)
            {
                return(null);
            }

            detailInfo.IsEditable             = AdvisorIsEditable(detailInfo.AdvisorMasterEntityId, detailInfo.AdvisorCompanyMasterEntityId, detailInfo.AdvisorCompanyParentMasterEntityId);
            detailInfo.IsPreview              = false;
            detailInfo.AdvisorStatus          = TypeChanger.DoEnum(detailInfo.Status, ProfileStatus.Unknown);
            detailInfo.Certifications         = AdvisorInfoManager.GetAdvisorCertifications(detailInfo.AdvisorCertificationsXml);
            detailInfo.VisitedPlaces          = AdvisorInfoManager.GetVisitedPlaces(detailInfo.AdvisorPlacesVisitedXml);
            detailInfo.Interests              = BaseDetailInfoHelpers.GetTravelElements(detailInfo.AdvisorInterestTypesXml);
            detailInfo.SpecialtyDestinations  = BaseDetailInfoHelpers.GetTravelElements(detailInfo.AdvisorSpecialtyCountriesXml);
            detailInfo.Languages              = BaseDetailInfoHelpers.GetTravelElements(detailInfo.AdvisorLanguagesXml);
            detailInfo.AlliancePrograms       = BaseDetailInfoHelpers.GetTravelElements(detailInfo.AdvisorAllianceProgramsXml);
            detailInfo.ConditionalLeadsName   = AdvisorInfoManager.GetConditionalLeadsName(detailInfo.AlliancePrograms);
            detailInfo.AdvisorPrimarydAddress = ProfileContactInfoManagerBase.GetPrimaryAddress(detailInfo.ProfileAddressXml);
            ProfileAddressManager.DisambiguateAddressCity(detailInfo.AdvisorPrimarydAddress, isEdit);
            if (HttpContext.Current.Request.QueryString["consumer"] == "1")
            {
                detailInfo.IsEditable = false;
                detailInfo.IsPreview  = true;
            }

            var user      = FederatedLoginClient.User;
            var viewModel = new AdvisorDetailViewModel
            {
                AdvisorMasterEntityId = detailInfo.AdvisorMasterEntityId,
                Status      = detailInfo.AdvisorStatus,
                AdvisorName = string.Format("{0} {1}", detailInfo.AdvisorFirstName, detailInfo.AdvisorLastName)
            };

            viewModel.ShowReviewsTab = ReviewHelper.ShowReview(detailInfo.TotalCompletedReviews, detailInfo.TotalBlockedReviews, detailInfo.TotalActiveReviews);
            if (viewModel.ShowReviewsTab)
            {
                viewModel.ReviewsInfoJson = new RatingAndReviewManager().GetReviewsInfoJsonForAdvisor(detailInfo);
            }

            viewModel.HeaderInfoPlus = new AdvisorHeaderInfoPlus
            {
                Header = new AdvisorHeaderInfoViewModel {
                    AdvisorHeaderInfo = AdvisorInfoManager.BuildHeaderInfo(detailInfo)
                },
                ContactAdvisor = GetContactAdvisor(detailInfo),
                ReviewBadge    = ReviewHelper.BuildBadgeModelForAdvisorDetailPage(detailInfo)
            };

            viewModel.AboutMePlus = new AdvisorAboutMePlus
            {
                Alliances             = AdvisorInfoManager.BuildAboutMe(detailInfo),
                Overview              = GetProfileOverviewInfo(detailInfo),
                IsActive              = detailInfo.AdvisorIsActive,
                CompanyIsActive       = detailInfo.AdvisorCompanyIsActive,
                AdvisorMasterEntityId = advisorId
            };

            if (user.IsComposerUser)
            {
                AddCommunityInfoForAdvisor(viewModel.AboutMePlus);
            }

            viewModel.DetailInfo  = detailInfo;
            viewModel.ContactInfo = AdvisorContactInfoManager.BuildContactInfo(detailInfo);
            viewModel.CobrandInfo = new AdvisorCobrandInfoViewModel
            {
                AdvisorCobrandInfo = AdvisorCobrandAndSettingsManager.BuildCobrandInfo(detailInfo)
            };
            ProfileAddressManager.DisambiguateAddressCity(viewModel.ContactInfo.PrimaryAddress, isEdit);
            ProfileAddressManager.DisambiguateAddressCities(viewModel.ContactInfo.Addresses, isEdit);

            // note that if an advisor is using the agency default personalization, the advisor personalized address will be null
            var personalizedAddress = TouchPoints.Framework.Utilities.Xml.Deserialize <PersonalizationAddress>(detailInfo.AdvisorPersonalizedAddressXml) ?? new PersonalizationAddress();

            detailInfo.AdvisorPersonalizedAddress = personalizedAddress;
            viewModel.AdvisorPersonalization      = new AdvisorPersonalizationInfo
            {
                AdvisorName                     = detailInfo.AdvisorPersonalizedName,
                AgencyName                      = detailInfo.AgencyPersonalizedName,
                DoingBusinessAs                 = detailInfo.AdvisorPersonalizedDoingBusinessAs,
                AddressLine1                    = personalizedAddress.AddressLine1,
                AddressLine2                    = personalizedAddress.AddressLine2,
                City                            = personalizedAddress.City,
                RegionNameEng                   = personalizedAddress.State,
                RegionId                        = personalizedAddress.RegionId,
                RegionCode                      = personalizedAddress.RegionCode,
                CountryNameEng                  = personalizedAddress.Country,
                CountryId                       = personalizedAddress.CountryId,
                PostalCode                      = personalizedAddress.PostalCode,
                Phone                           = detailInfo.AdvisorPersonalizedPrimaryPhone,
                SecondPhone                     = detailInfo.AdvisorPersonalizedSecondaryPhone,
                WebAddress                      = detailInfo.AdvisorPersonalizedWebsite,
                Email                           = detailInfo.AdvisorPersonalizedEmail,
                StateOfSellerId                 = detailInfo.AdvisorPersonalizedStateOfSellerId,
                LogoUrl                         = detailInfo.AdvisorCompanyLogo,
                AssociatedMasterEntityId        = detailInfo.AdvisorMasterEntityId,
                AssociatedParentMasterEntityId  = detailInfo.AdvisorCompanyParentMasterEntityId,
                UseAgencyDefaultPersonalization = detailInfo.UseAgencyDefaultPersonalization
            };

            personalizedAddress             = Xml.Deserialize <PersonalizationAddress>(detailInfo.AgencyPersonalizedAddressXml) ?? new PersonalizationAddress();
            viewModel.AgencyPersonalization = new AgencyPersonalizationInfo
            {
                AgencyName                     = detailInfo.AgencyPersonalizedName,
                AddressLine1                   = personalizedAddress.AddressLine1,
                AddressLine2                   = personalizedAddress.AddressLine2,
                City                           = personalizedAddress.City,
                RegionNameEng                  = personalizedAddress.State,
                RegionId                       = personalizedAddress.RegionId,
                RegionCode                     = personalizedAddress.RegionCode,
                CountryNameEng                 = personalizedAddress.Country,
                CountryId                      = personalizedAddress.CountryId,
                PostalCode                     = personalizedAddress.PostalCode,
                Phone                          = detailInfo.AgencyPersonalizedPrimaryPhone,
                SecondPhone                    = detailInfo.AgencyPersonalizedSecondaryPhone,
                WebAddress                     = detailInfo.AgencyPersonalizedWebsite,
                Email                          = detailInfo.AgencyPersonalizedEmail,
                StateOfSellerId                = detailInfo.AgencyPersonalizedStateOfSellerId,
                LogoUrl                        = detailInfo.LogoUrl,
                AssociatedMasterEntityId       = detailInfo.AdvisorCompanyMasterEntityId,
                AssociatedParentMasterEntityId = detailInfo.AdvisorCompanyParentMasterEntityId,
            };
            viewModel.Information = new AdvisorInformationViewModel
            {
                AdvisorInformation = AdvisorInfoManager.BuildAdminInfo(detailInfo)
            };
            viewModel.Specialties = new AdvisorTravelSpecialtiesViewModel
            {
                AdvisorTravelSpecialties = AdvisorInfoManager.BuildTravelSpecialties(detailInfo)
            };

            // fill in personalization IC status, since the value in DetailInfo may be unreliable
            viewModel.AdvisorPersonalization.IsIndependentContractor = (viewModel.Information.AdvisorType.TypeId == AdvisorInfoManager.IndependentContractorTypeId);

            // TODO: only need these for edit by certain people with permissions
            if (null != viewModel.Specialties)
            {
                viewModel.Specialties.SpecialtyCountriesLookup = SpecialtyDestinations.Get(null, ProfileType.Advisor);
            }

            viewModel.OutOfOffice = new AdvisorOutOfOffice();
            viewModel.Settings    = AdvisorCobrandAndSettingsManager.BuildAdvisorSettings(detailInfo);
            AgencyViewManager.CalculateFieldLevelPermissions(viewModel.Settings, user);

            viewModel.SupplierMarketingOptions =
                new SupplierMarketingOptionsViewManager().GetSupplierMarketingOptionsForMember(advisorId);

            viewModel.SupplierMarketingOptions.MemberHasOverrideRole = detailInfo.OverrideAgencySupplierMarketing;
            viewModel.SupplierMarketingOptions.AgencyMeid            = detailInfo.AdvisorCompanyMasterEntityId;

            viewModel.ConsumerNotifications = new ConsumerNotificationsViewManager().GetNotificationsForAdvisor(advisorId, viewModel.Settings.Meid, viewModel.Settings.ParentMeid);

            viewModel.SecurityData = new AdvisorProfileSecurityData();

            var securityModel = TouchPoints.Framework.Utilities.Xml.Deserialize <StaffSecurityModelXml>(detailInfo.ProfileRolesXml);

            viewModel.AdvisorSecurity = SecurityManager.BuildAdvisorSecurity(securityModel);
            viewModel.HotelBooking    = new AdvisorHotelBookingViewModel();

            viewModel.HotelBooking.HotelBooking = new AdvisorHotelBooking
            {
                AdvisorMasterEntityId = viewModel.AdvisorMasterEntityId,
                AgentId = detailInfo.AgentId,
                BookingPrefatoryCode  = detailInfo.BookingPrefatoryCode,
                BookingPseudoCityCode = detailInfo.BookingPseudoCityCode,
                BookingQueueNumber    = detailInfo.BookingQueueNumber,
                AgentInterfaceId      = detailInfo.AgentInterfaceId,
                SameAsAgency          = detailInfo.IsBookingSameAsAgency
            };

            viewModel.AdvisorLogoExists            = !String.IsNullOrEmpty(viewModel.AdvisorPersonalization.LogoUrl);
            viewModel.AgencyDefaultLogoExists      = !String.IsNullOrEmpty(viewModel.AgencyPersonalization.LogoUrl);
            viewModel.PersonalizationGuidelinesUrl = Config.AppSettings.PersonalizationGuidelinesUrl;

            return(viewModel);
        }
 private async void GoToReviewApp()
 {
     await ReviewHelper.TryRequestReviewAsync();
 }