public IHttpActionResult GetAddPlayerData()
        {
            var licenseeFilterSelections = _adminQueries.GetLicenseeFilterSelections();

            var licensees = _brandQueries.GetLicensees()
                            .Where(x =>
                                   x.Brands.Any(y => y.Status == BrandStatus.Active) &&
                                   licenseeFilterSelections.Contains(x.Id))
                            .OrderBy(x => x.Name)
                            .Select(x => new { x.Id, x.Name });

            var response = new
            {
                Licensees         = licensees,
                Genders           = Enum.GetNames(typeof(Gender)),
                Titles            = Enum.GetNames(typeof(Title)),
                IdStatuses        = Enum.GetNames(typeof(IdStatus)),
                ContactMethods    = Enum.GetNames(typeof(ContactMethod)).OrderBy(x => x),
                SecurityQuestions = _queries.GetSecurityQuestions()
            };

            return(Ok(new { result = "success", data = response }));
        }
Esempio n. 2
0
        public async Task <IHttpActionResult> Get(Guid id)
        {
            VerifyPermission(Permissions.View, Modules.PlayerManager);

            var paymentPlayer = _paymentQueries.GetPlayer(id);

            var player = await _playerQueries.GetPlayerAsync(id);

            var paymentId = await _paymentQueries.GetPlayerPaymentLevels().SingleAsync(p => p.PlayerId == id);

            var brand = await _brandQueries.GetBrandOrNullAsync(player.BrandId);

            var brandTimeZone  = TimeZoneInfo.FindSystemTimeZoneById(brand.TimezoneId);
            var now            = DateTimeOffset.Now;
            var exemptFrom     = paymentPlayer.ExemptWithdrawalFrom ?? now;
            var exemptTo       = paymentPlayer.ExemptWithdrawalTo ?? now;
            var exemptFromText = TimeZoneInfo.ConvertTime(exemptFrom, brandTimeZone).ToString(DateFormat);
            var exemptToText   = TimeZoneInfo.ConvertTime(exemptTo, brandTimeZone).ToString(DateFormat);

            var question = await _playerQueries.GetSecurityQuestions().SingleOrDefaultAsync(x => x.Id == player.SecurityQuestionId);

            return(Ok(new
            {
                player.BrandId,
                player.Username,
                player.FirstName,
                player.LastName,
                DateOfBirth = Format.FormatDate(player.DateOfBirth, false),
                ParsedDateOfBirth = player.DateOfBirth.ToString("MMMM d, y"),
                Title = Enum.GetName(typeof(Title), player.Title),
                Gender = Enum.GetName(typeof(Gender), player.Gender),
                player.Email,
                player.PhoneNumber,
                player.MailingAddressLine1,
                player.MailingAddressLine2,
                player.MailingAddressLine3,
                player.MailingAddressLine4,
                player.MailingAddressCity,
                player.MailingAddressPostalCode,
                player.MailingAddressStateProvince,
                player.PhysicalAddressLine1,
                player.PhysicalAddressLine2,
                player.PhysicalAddressLine3,
                player.PhysicalAddressLine4,
                player.PhysicalAddressCity,
                player.PhysicalAddressPostalCode,
                player.PhysicalAddressStateProvince,
                player.CountryCode,
                PaymentLevel = paymentId != null ? (Guid?)paymentId.PaymentLevel.Id : null,
                ContactPreference = Enum.GetName(typeof(ContactMethod), player.ContactPreference),
                DateRegistered = player.DateRegistered.ToString(DateFormat),
                Licensee = brand.Licensee.Name,
                Brand = brand.Name,
                player.CurrencyCode,
                VipLevel = player.VipLevel == null ? (Guid?)null : player.VipLevel.Id,
                ExemptWithdrawalVerification = paymentPlayer.ExemptWithdrawalVerification.HasValue && paymentPlayer.ExemptWithdrawalVerification.Value,
                ExemptFrom = exemptFromText,
                ExemptTo = exemptToText,
                ExemptLimit = paymentPlayer.ExemptLimit ?? -1,
                SecurityQuestion = question != null ? question.Question : "",
                player.SecurityAnswer,
                player.IsOnline,
                player.AccountAlertEmail,
                player.AccountAlertSms,
                player.MarketingAlertEmail,
                player.MarketingAlertSms,
                player.MarketingAlertPhone,
                Frozen = player.IsFrozen,
                player.IsLocked,
                player.IsInactive,
                IsSelfExcluded = player.SelfExclusion.HasValue,
                IsTimedOut = player.TimeOut.HasValue
            }));
        }