Exemplo n.º 1
0
 public NomenklaturaDto(Nomenklatura nomenklatura, bool main)
     : base(nomenklatura?.Specialisation, false)
 {
     if (nomenklatura == null)
     {
         return;
     }
     if (main)
     {
         this.Id   = nomenklatura.Id;
         this.Name = nomenklatura.Name;
     }
     this.BasePrice        = nomenklatura.BasePrice;
     this.NomenklaturaId   = nomenklatura.Id;
     this.NomenklaturaName = nomenklatura.Name;
     this.LifeStyleId      = nomenklatura.Lifestyle;
     this.LifeStyle        = BillingHelper.GetLifestyle(nomenklatura.Lifestyle).ToString();
     this.Code             = nomenklatura.Code;
     this.Description      = nomenklatura.Description;
     if (string.IsNullOrEmpty(nomenklatura.PictureUrl))
     {
         this.PictureUrl = nomenklatura?.Specialisation?.ProductType?.PictureUrl ?? "";
     }
     else
     {
         this.PictureUrl = nomenklatura.PictureUrl;
     }
     this.BaseCount = nomenklatura.BaseCount;
 }
Exemplo n.º 2
0
        public async Task OnImplantInstalled(int model, string implantlifestyle, string autodoclifestyle)
        {
            var factorId = GetFactorId(ScoringFactorEnum.implant_install);
            var scoring  = GetScoringByModelId(model);

            if (!BillingHelper.LifestyleIsDefined(implantlifestyle) || !BillingHelper.LifestyleIsDefined(autodoclifestyle))
            {
                return;
            }
            var lifestyle = BillingHelper.GetLifestyle(implantlifestyle);

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

            factorId  = GetFactorId(ScoringFactorEnum.where_implant_install);
            lifestyle = BillingHelper.GetLifestyle(autodoclifestyle);
            await RaiseScoringEvent(scoring.Id, factorId, (context) =>
            {
                var ls    = (int)lifestyle;
                var value = context.Set <ScoringEventLifestyle>().AsNoTracking().FirstOrDefault(s => s.ScoringFactorId == factorId && s.EventNumber == ls);
                return(value?.Value ?? 1);
            });
        }
Exemplo n.º 3
0
        public async Task OnPillConsumed(int model, string pillLifestyle)
        {
            var factorId = GetFactorId(ScoringFactorEnum.pill_use);

            if (!BillingHelper.LifestyleIsDefined(pillLifestyle))
            {
                return;
            }
            var lifestyle = BillingHelper.GetLifestyle(pillLifestyle);
            var scoring   = GetScoringByModelId(model);

            await RaiseScoringEvent(scoring.Id, factorId, (context) =>
            {
                var ls    = (int)lifestyle;
                var value = context.Set <ScoringEventLifestyle>().AsNoTracking().FirstOrDefault(s => s.ScoringFactorId == factorId && s.EventNumber == ls);
                return(value?.Value ?? 1);
            });
        }
Exemplo n.º 4
0
        public ShopDto(int modelId, ShopWallet shop) : base(modelId, shop)
        {
            if (shop == null)
            {
                return;
            }
            Lifestyle = new LifestyleDto
            {
                Id   = shop.LifeStyle,
                Name = BillingHelper.GetLifestyle(shop.LifeStyle).ToString()
            };

            if (shop.Specialisations == null)
            {
                Specialisations = new List <int>();
            }
            else
            {
                Specialisations = shop.Specialisations.Select(s => s.SpecialisationId).ToList();
            }
            if (shop.TrustedUsers == null)
            {
                TrustedUsers = new List <int>();
            }
            else
            {
                TrustedUsers = shop.TrustedUsers.Select(s => s.Model).ToList();
            }
            if (shop.Wallet == null)
            {
                return;
            }
            Balance  = shop.Wallet.Balance;
            Comment  = shop.Comment;
            Location = shop.Location;
        }