Esempio n. 1
0
        public SessionDto GetSessionInfo(int character)
        {
            var result = new SessionDto();

            try
            {
                var ls = BillingHelper.GetLifeStyleDto();
                result.LifeStyle = new SessionDto.LifeStyleDto(ls);
                var cycle = Factory.Job.GetLastCycle();
                result.Cycle = new SessionDto.CycleDto(cycle);
                var beatCharacters = Factory.Job.GetLastBeatAsNoTracking(Core.Primitives.BeatTypes.Characters);
                var beatItems      = Factory.Job.GetLastBeatAsNoTracking(Core.Primitives.BeatTypes.Items);
                var jsoncharacters = Factory.Settings.GetValue(Core.Primitives.SystemSettingsEnum.beat_characters_dto);
                var lsDto          = Serialization.Serializer.Deserialize <JobLifeStyleDto>(jsoncharacters);
                result.BeatCharacters = new SessionDto.BeatCharactersDto(beatCharacters, lsDto);
                var corps = Factory.Shop.GetCorporationDtos(c => true);
                var shops = Factory.Shop.GetShops(character, s => true);
                result.BeatItems = new SessionDto.BeatItemsDto(beatItems, corps, shops);
                result.Deploy    = Environment.GetEnvironmentVariable(SystemHelper.Billing);
                var sin = Factory.Billing.GetSINByModelId(character, s => s.Passport);
                result.PersonName = BillingHelper.GetPassportName(sin.Passport);
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.ToString());
            }
            return(result);
        }
Esempio n. 2
0
        public async Task OnShopLifestyle(SIN sin, int shoplifestyle)
        {
            var factorId     = GetFactorId(ScoringFactorEnum.shop_lifestyle);
            var dto          = BillingHelper.GetLifeStyleDto();
            var sinlifestyle = dto.GetLifeStyle(sin.Wallet);
            var scoring      = sin.Scoring;
            var lifestyle    = CompareLifestyle(shoplifestyle, (int)sinlifestyle);

            await RaiseScoringEvent(scoring.Id, factorId, (context) =>
            {
                var value = context.Set <ScoringEventLifestyle>().AsNoTracking().FirstOrDefault(s => s.ScoringFactorId == factorId && s.EventNumber == lifestyle);
                return(value?.Value ?? 1);
            });
        }